Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Issue while building a shared library: (6 Items)
   
Issue while building a shared library  
I have a project that builds couple of library project and then it builds an application project that uses these library
 files, I have the following issue,

I am able to compile the libraries in static mode and able to link and crate an executable however if I try building 
shared library I am getting error ''undefined reference to XYZ", what might be the reason ???
Re: Issue while building a shared library  
On 10-11-18 09:34 AM, Girisha SG wrote:
> I have a project that builds couple of library project and then it
> builds an application project that uses these library files, I have the
> following issue,
>
> I am able to compile the libraries in static mode and able to link and
> crate an executable however if I try building shared library I am
> getting error ''undefined reference to XYZ", what might be the reason ???

The reason you're not resolving the dependencies the shared object has 
on other libraries. You need to link against the libraries that provide 
the definitions for XYZ using the -l option.

You don't see this when you create a static archive because the linker 
does not resolve the libraries dependencies as an archive is a just 
format containing individual object files.

Regards,

Ryan Mansfield
Re: Issue while building a shared library  
HI,
Thanks for the reply.

I have libraries B,C,D,E,F and application program A that uses these libraries and I have the following queries,

I I build only the libraries I am not getting any error but when I try to build & link them with the application I am 
getting the 'undefined reference to XYZ...'

While building the libraries I am getting the warning 'undefined reference to XYZ...'
Even if I link the dependent .so while compiling I am getting the same error.

Re: Issue while building a shared library  
Finally I am able to build it :) thanks for all your help.

I have following queries,
1. Whether we have libgcc.so file for ARMV7 that defines '__aeabi_uldivmod' symbol ?

2. I am having multiple folders and one .so within each folder, while building the executable I am giving the .so file 
paths relative to the current folder, suppose I copy the .so & .exe files in the same folder on the target and run the 
executable it works. Now suppose I want to retain the existing command while building the executable but while running I
 want all these .so files to be present in some other folder, how can I do this & how OS/exe comes to know where are the
 .so files and how to load it?

This will help my development using QNX.
Re: Issue while building a shared library  
On 10-11-19 04:46 AM, Girisha SG wrote:
> Finally I am able to build it :) thanks for all your help.
>
> I have following queries,
> 1. Whether we have libgcc.so file for ARMV7 that defines
> '__aeabi_uldivmod' symbol ?

Yes.. libgcc.a has this routine..

ntoarm-nm 
/opt/qnx650/host/linux/x86/usr/lib/gcc/arm-unknown-nto-qnx6.5.0eabi/4.4.2/pic/libgcc.a 
| grep __aeabi_uldivmod
00000000 T __aeabi_uldivmod

>
> 2. I am having multiple folders and one .so within each folder, while
> building the executable I am giving the .so file paths relative to the
> current folder, suppose I copy the .so & .exe files in the same folder
> on the target and run the executable it works. Now suppose I want to
> retain the existing command while building the executable but while
> running I want all these .so files to be present in some other folder,
> how can I do this & how OS/exe comes to know where are the .so files and
> how to load it?

Use LD_LIBRARY_PATH to tell the dynamic linker where to find the shared 
objects on your target,

Regards,

Ryan Mansfield
Re: Issue while building a shared library  
After linking gcc library __aeabi_uldivmod error has gone but now i am getting the following error

ldd:FATAL: Unresolved symbol "__gnu_uldivmod_helper" called from Executable

Which library should we link to resolve this issue ?