Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Queries related to RVCT(Real view compiler tool chain) with QNX: Page 1 of 2 (26 Items)
   
Queries related to RVCT(Real view compiler tool chain) with QNX  
I am using RVCT 4.1, I have the following queries,

I have a application project that uses couple of library projects,

1. I would like to compile the library project code using RVCT and create shared libraries, how can I do it ?

2. I would like to compile the application project code using RVCT and create shared libraries, how can I do it ?

Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-19 06:48 AM, Girisha SG wrote:
> I am using RVCT 4.1, I have the following queries,
>
> I have a application project that uses couple of library projects,
>
> 1. I would like to compile the library project code using RVCT and
> create shared libraries, how can I do it ?
>
> 2. I would like to compile the application project code using RVCT and
> create shared libraries, how can I do it ?

Compile the objects such that they have position independent code (-fpic 
option in gcc) then use qcc to link the shared object. e.g.

qcc -shared foo.o bar.o -o libbaz.so

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
I have compiled the code using '--apcs=//fpic' option to armcc.

I am getting the following errors while linking,

../private/debug_support.o: In function `__AssertFunc':
../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined reference to `_printf_percent'
../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined reference to `_printf_d'
../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined reference to `_printf_int_dec'
../../../private/OSAL/QNX/debug_support.c:(.text+0x1c): undefined reference to `__2sprintf'
../../../private/OSAL/QNX/debug_support.c:(.text+0xbc): undefined reference to `__stderr'
../../../private/OSAL/QNX/debug_support.c:(.text+0xc0): undefined reference to `__stderr'
../../../private/OSAL/QNX/debug_support.c:(.text+0xc8): undefined reference to `__stderr'
../../../private/OSAL/QNX/debug_support.c:(.text+0xcc): undefined reference to `__stderr'
../../../private/OSAL/QNX/debug_support.c:(.text+0xd4): undefined reference to `__stderr'
../private/debug_support.o:../../../private/OSAL/QNX/debug_support.c:(.text+0xdc): more undefined references to `
__stderr' follow

Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-19 08:10 AM, Girisha SG wrote:
> I have compiled the code using '--apcs=//fpic' option to armcc.
>
> I am getting the following errors while linking,
>
> ../private/debug_support.o: In function `__AssertFunc':
> ../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined
> reference to `_printf_percent'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined
> reference to `_printf_d'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0x0): undefined
> reference to `_printf_int_dec'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0x1c): undefined
> reference to `__2sprintf'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xbc): undefined
> reference to `__stderr'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xc0): undefined
> reference to `__stderr'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xc8): undefined
> reference to `__stderr'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xcc): undefined
> reference to `__stderr'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xd4): undefined
> reference to `__stderr'
> ../private/debug_support.o:../../../private/OSAL/QNX/debug_support.c:(.text+0xdc):
> more undefined references to `__stderr' follow

These aren't symbols defined in the QNX runtime so RVCT is making 
references to its own runtime libraries. It's unlikely you'll be able to 
use them. Are you still compiling with --library-interface=aeabi_clib90?

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
No I am not using '--library-interface=aeabi_clib90' in the compilation option.

following is the compilation option ...
armcc -c --enum_is_int --wchar32 --c99 --gnu --apcs=//interwork/softfp -O3 --dwarf2 -Otime --no_unaligned_access --
vectorize --apcs=//fpic  -g
--cpu=Cortex-A8 --device=OMAP35xx -D__QNX__ -DVARIANT_so -DVARIANT_le -DVARIANT_v7 -DBUILDENV_qss  -D__QNXNTO__ -
D__LITTLEENDIAN__ -D__ARM__ ....................
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
 No I am not using '--library-interface=aeabi_clib90' in the compilation option
 .
 
 following is the compilation option ...
 armcc -c --enum_is_int --wchar32 --c99 --gnu --apcs=//interwork/softfp -O3 --
 dwarf2 -Otime --no_unaligned_access --vectorize --apcs=//fpic  -g
 --cpu=Cortex-A8 --device=OMAP35xx -D__QNX__ -DVARIANT_so -DVARIANT_le -
 DVARIANT_v7 -DBUILDENV_qss  -D__QNXNTO__ -D__LITTLEENDIAN__ -D__ARM__ ........
 ............

These are not the function defines by us and hence if I compile and make a static library it works fine & problem is 
only when I try to make it a shared library using '--apcs=//fpic' option to armcc compiler. Please let me know how can I
 resolve it ???
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-22 01:20 AM, Girisha SG wrote:
>
> No I am not using '--library-interface=aeabi_clib90' in the compilation
> option
> .
>
> following is the compilation option ...
> armcc -c --enum_is_int --wchar32 --c99 --gnu --apcs=//interwork/softfp
> -O3 --
> dwarf2 -Otime --no_unaligned_access --vectorize --apcs=//fpic -g
> --cpu=Cortex-A8 --device=OMAP35xx -D__QNX__ -DVARIANT_so -DVARIANT_le -
> DVARIANT_v7 -DBUILDENV_qss -D__QNXNTO__ -D__LITTLEENDIAN__ -D__ARM__
> ........
> ............
>
> These are not the function defines by us and hence if I compile and make
> a static library it works fine & problem is only when I try to make it a
> shared library using '--apcs=//fpic' option to armcc compiler. Please
> let me know how can I resolve it ???

As I've told you several times now when you create a static archive it 
does not resolve the archive. Only when you link a static archive into 
an executable or a shared object will the objects in the archive be linked.

Did you try compiling with --library-interface=aeabi_clib90? You need to 
have armcc to generate code which makes standard libc function calls 
instead of calling its own runtime libraries. This will be an armcc 
option so you need to read the RVCT documentation.

Regards,

Ryan Mansfield

Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
I have tried compiling with --library-interface=aeabi_clib90 & linked math library & gcc while creating the shared 
library but I am observing the same errors as earlier.
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
If I change --c99 option to compiler to --c90 & put --library-interface=aeabi_clib90 & link libm & lgcc, I am getting 
only the following errors.

../../../private/flpOperations.c:(.text+0x11c): undefined reference to `powf'
flpOperations.o: In function `linear2db_flp':
../../../private/flpOperations.c:(.text+0x12c): undefined reference to `logf'
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: libBasicSignalProcessing_g.so: hidde
n symbol `powf' isn't defined
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed: Nonrepresentable
section on output
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-22 06:16 AM, Girisha SG wrote:
> If I change --c99 option to compiler to --c90 & put
> --library-interface=aeabi_clib90 & link libm & lgcc, I am getting only
> the following errors.
>
> ../../../private/flpOperations.c:(.text+0x11c): undefined reference to
> `powf'
> flpOperations.o: In function `linear2db_flp':
> ../../../private/flpOperations.c:(.text+0x12c): undefined reference to
> `logf'
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld:
> libBasicSignalProcessing_g.so: hidde
> n symbol `powf' isn't defined
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed:
> Nonrepresentable
> section on output

Both powf and logf are provided in libm so you're not actually linking 
against libm..

$ ntoarm-nm /opt/qnx650/target/qnx6/armle-v7/lib/libm.so.2 | grep powf
0000bb40 T cpowf
00014820 T powf

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
I was trying to link with shared math library i.e. libm.so and I was getting the above errors.
If I link this statically I am getting the following error,

C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../../../../../QNX650/target/qnx6/ar
mle-v7/lib\libm.a(feraiseexcept.o): relocation R_ARM_MOVW_ABS_NC against `_Tls_s
etup__Fenv' can not be used when making a shared object; recompile with -fPIC
../../../../../QNX650/target/qnx6/armle-v7/lib\libm.a: could not read symbols: B
ad value

Related to position independent code
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-22 06:36 AM, Girisha SG wrote:
> I was trying to link with shared math library i.e. libm.so and I was getting the above errors.
> If I link this statically I am getting the following error,
>
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../../../../../QNX650/target/qnx6/ar
> mle-v7/lib\libm.a(feraiseexcept.o): relocation R_ARM_MOVW_ABS_NC against `_Tls_s
> etup__Fenv' can not be used when making a shared object; recompile with -fPIC
> ../../../../../QNX650/target/qnx6/armle-v7/lib\libm.a: could not read symbols: B
> ad value

Yes, you're linking the non-PIC version of libm into a shared object. 
You need to link against libm.so OR libmS.a.

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
Thanks.

If I link against libmS.a I am able to compile & create .so file but as I said earlier if I try to link against libm.so 
I am getting the same error as earlier i.e.,

../private/flpOperations.o: In function `db2linear_flp':
../../../private/flpOperations.c:(.text+0x11c): undefined reference to `powf'
../private/flpOperations.o: In function `linear2db_flp':
../../../private/flpOperations.c:(.text+0x12c): undefined reference to `logf'
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../lib/libBasicSignalProcessing_g.so
: hidden symbol `powf' isn't defined
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed: Nonrepresentable
section on output

Is this expected behaviour ?
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
Along with the above problem I am facing the following problems too :)

../private/debug_support.o: In function `__AssertFunc':
../../../private/OSAL/QNX/debug_support.c:(.text+0xac): undefined reference to `
__aeabi_stderr'
../private/debug_support.o: In function `__Breakpoint':
../../../private/OSAL/QNX/debug_support.c:(.text+0xf0): undefined reference to `
__aeabi_SIG_DFL'
../../../private/OSAL/QNX/debug_support.c:(.text+0xf4): undefined reference to `
__aeabi_SIGINT'
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../lib/libePIAF_g.so: hidden symbol
`__aeabi_SIGINT' isn't defined
C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed: Nonrepresentable
section on output

any insights ?
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-22 08:26 AM, Girisha SG wrote:
> Along with the above problem I am facing the following problems too :)
>
> ../private/debug_support.o: In function `__AssertFunc':
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xac): undefined
> reference to `
> __aeabi_stderr'
> ../private/debug_support.o: In function `__Breakpoint':
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xf0): undefined
> reference to `
> __aeabi_SIG_DFL'
> ../../../private/OSAL/QNX/debug_support.c:(.text+0xf4): undefined
> reference to `
> __aeabi_SIGINT'
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../lib/libePIAF_g.so: hidden
> symbol
> `__aeabi_SIGINT' isn't defined
> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed:
> Nonrepresentable
> section on output

These are routines defined by the CLIBABI which we currently do not 
adhere to. I think you should be able to work around it by doing 
something like the following:

#include <stdio.h>

FILE *__aeabi_stdin;
FILE *__aeabi_stdout;
FILE *__aeabi_stderr;
static void __attribute__((constructor)) setup_aeabi_stdio()
{
     __aeabi_stdin = stdin;
     __aeabi_stdout = stdout;
     __aeabi_stderr = stderr;
}

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-22 09:12 AM, Ryan Mansfield wrote:
> On 10-11-22 08:26 AM, Girisha SG wrote:
>> Along with the above problem I am facing the following problems too :)
>>
>> ../private/debug_support.o: In function `__AssertFunc':
>> ../../../private/OSAL/QNX/debug_support.c:(.text+0xac): undefined
>> reference to `
>> __aeabi_stderr'
>> ../private/debug_support.o: In function `__Breakpoint':
>> ../../../private/OSAL/QNX/debug_support.c:(.text+0xf0): undefined
>> reference to `
>> __aeabi_SIG_DFL'
>> ../../../private/OSAL/QNX/debug_support.c:(.text+0xf4): undefined
>> reference to `
>> __aeabi_SIGINT'
>> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: ../lib/libePIAF_g.so: hidden
>> symbol
>> `__aeabi_SIGINT' isn't defined
>> C:\QNX650\host\win32\x86\usr\bin\ntoarm-ld: final link failed:
>> Nonrepresentable
>> section on output

Sorry, my last post only convered the stdio/__aeabi_std* routines. 
You'll have to also add some support libraries that map  __aeabi_SIG 
routines to the signal.h macros.

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
In the above error we have errors related to,
1. __aeabi_stderr
2. __aeabi_SIG_DFL
3. __aeabi_SIGINT

which library needs to be linked for this, any suggestions  ?
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-23 07:51 AM, Girisha SG wrote:
> In the above error we have errors related to,
> 1. __aeabi_stderr
> 2. __aeabi_SIG_DFL
> 3. __aeabi_SIGINT
>
> which library needs to be linked for this, any suggestions ?

As I said in my last two posts, you will need to implement these 
routines yourself.

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
Thanks for the help, I really dont know how can I add these,
     __aeabi_SIG_DFL
     __aeabi_SIGINT 

Sorry to ask lot of questions :( ... but no other go :)
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-23 08:41 AM, Girisha SG wrote:
> Thanks for the help, I really dont know how can I add these,
> __aeabi_SIG_DFL
> __aeabi_SIGINT
>
> Sorry to ask lot of questions :( ... but no other go :)

Something like:

#include <signal.h>

const int __aeabi_SIGINT = SIGINT;

void __aeabi_SIG_DFL(int n) { /* stub */ }

Regards,

Ryan Mansfield



Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
I have 2 more issues :),

1. const int __aeabi_SIGINT = SIGINT; 
I am getting the following error
Error:  #28: expression must have a constant  value  const int __aeabi_SIGINT = SIGINT; 

2.I have multiple libraries lets say A, B, C such that B depends on A, C depends on A & B
    1. I am linking A.so while building B.so & A.so & B.so while building C.so but still I am getting the compilation 
error(undefined function ...) for the functions defined in A & B, however if I include the .o file that has the 
definition while building .so resolves the compilation error.

Please suggest the way to handle these
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-24 08:53 AM, Girisha SG wrote:
> I have 2 more issues :),
>
> 1. const int __aeabi_SIGINT = SIGINT;
> I am getting the following error
> Error: #28: expression must have a constant value const int
> __aeabi_SIGINT = SIGINT;

SIGINT is defined in signal.h to be 5 which is a constant. Are you not 
including the header?

> 2.I have multiple libraries lets say A, B, C such that B depends on A, C
> depends on A & B
> 1. I am linking A.so while building B.so & A.so & B.so while building
> C.so but still I am getting the compilation error(undefined 
function
> ...) for the functions defined in A & B, however if I include the .o
> file that has the definition while building .so resolves the compilation
> error.

Are the functions in A and B exported? C should be able to link against 
definitions provided in A and B. I can't tell you what you're doing wrong.

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
 SIGINT is defined in signal.h to be 5 which is a constant. Are you not 
 including the header?
[Girish]: Its value is 4 & I have included the header. Instead of the above statement if I use,
__aeabi_SIGINT = 4; 
It compiles without any error.

 Are the functions in A and B exported? C should be able to link against 
 definitions provided in A and B. I can't tell you what you're doing wrong.
 
[Girish]: Functions in A & B are global functions, should I also need to make them as extern functions in the file that 
calls them ?


Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
On 10-11-24 09:10 AM, Girisha SG wrote:
>
> SIGINT is defined in signal.h to be 5 which is a constant. Are you not
> including the header?
> [Girish]: Its value is 4 & I have included the header. Instead of the
> above statement if I use,
> __aeabi_SIGINT = 4;
> It compiles without any error.

Sorry, I misread the constant (BTW it's not 4 either).

      96 #define SIGHUP      1   /* hangup */
      97 #define SIGINT      2   /* interrupt */
      98 #define SIGQUIT     3   /* quit */

Regardless of the value, you should using the definition in the QNX 
signal.h and not assigning the constant yourself. Check to make sure 
you're including the QNX signal.h.

Regards,

Ryan Mansfield
Re: Queries related to RVCT(Real view compiler tool chain) with QNX  
Thanks a lot for your help.
1. Since I am compiling the source code using RVDS it is using signal.h file from RVDS folder and in that SIGINT is 
defined as 

#define SIGABRT   1 /* abort                         */
#define SIGFPE    2 /* arithmetic exception          */
#define SIGILL    3 /* illegal instruction           */
#define SIGINT    4 /* attention request from user   */

I have tried again to compile using 'const int __aeabi_SIGINT = SIGINT;' and observing the same error.
 Error:  #28: expression must have a constant value

2. I have tried making some of the functions extern and linked the library while building the .so but still I am 
observing the compilation issues. It compiles fine if I add those .o files while building the .so. 
How to handle this ?
In one of the previous replies you said exporting ... how should I do that ?