View topic - Shared Libs don't build from multiple files ?

Shared Libs don't build from multiple files ?

anything that doesn't fit to other groups.

Postby cdhruv » Thu Oct 07, 2004 2:23 am

cburgess wrote:By losing symbols, do you mean that you get a bunch of "unknown symbol" messages when trying to load the shared object?

If so, you have been bitten by a 6.3.0 linker bug.

BTW - the segfault on dlopen under 6.2.1 is almost certainly a non-shared object being linked in - check your map file, and check (with objdump -h) for the presence of rel.text or rel.rodata - these are sure signs.

Under 6.3.0 this wouldn't fail, since it will detect the code relocations and just make your 'shared' object a private copy.


Hi,

I am facing exactly this problem, I believe. I am trying to build and test a complex, big shared library on QNX 6.3.0. Here are the details:

Host: Self-hosted QNX Neutrino 6.3.0
Building Adaptive Communications Environment middleware library (its open source, ported to several platforms: http://www.cs.wustl.edu/~schmidt/ACE.html)

After the usual initial struggle, I could build the library, libACE.so on the QNX host. I could also compile and build the executables corresponding to ACE tests that use libACE.so.

So far, so good. But the moment I try to execute one of these ELF execuable ACE tests, I get a huge pile of messages "unknown symbol:" and lastly "Could not resolve all symbols" and the test terminates without running at all.

I think this is what is going on:

The executable is linked against a shared library.

Running
$ ldd <executable> shows all libraries being reached by ldd including libACE


When attempting to execute, the process manager, looking at the ELF header, figures out that this executable is linked with shared objects and it tells the runtime linker to load the shared libraries in the process address space.

The run-time linker some how cannot resolve the symbols in libACE.so:

=>I tried all options - giving -rpath, -Bsymbolic, -E etc options to the linker - both for building the library as well as the application; but does not work at all - same error message as above is spit out.

=> the issue could be either *locating* the shared lib and/or resolving the symbols within the shared lib. I suspect it is the latter as I linked libACE.so at various paths (pointed to by LD_LIBRARY_PATH *in the build file of procnto* as well as my typical environment variable LD_LIBRARY_PATH. The latter contains path to libACE.so)

A couple of interesting tests / observations:
<> Building the libACE.so, tests and *running* the tests that use libACE all work seamlessly on Linux.

<> On QNX 6.3.0, *IF I BUILD LlibACE, and the tests as STATICALY LINKED objects * - means ACE is build as libABC.a - building the libACE(.a), the tests and *running* the tests WORKS. Confirms my observation that there is an issue with loading dynamic object(s) and executing an ELF executable that is linked dynamically against those objects

<> I wrote a trivial program, a hello world type and created an executable linking it dynamically with libACE.so. I DID NOT CALL ANYTHING FROM libACE, and yet, trying to run that executable (linked with libACE.so) gave exactly the same problem.

Is something wrong with the library (libACE.so) ?

Bug with the run-time linker ?

I am foxed by this problem - went thru all QNX 6.3.0 docs, did not help ..

Has anyone faced such issue - any hint / help is greatly appreciated ..
-cdhruv
cdhruv
New Member
 
Posts: 1
Joined: Thu Oct 07, 2004 1:20 am

Postby bjchip » Thu Oct 07, 2004 5:03 am

So far no joy. I am in a reasonable position to work around using the static link stuff until we get a 6.3.1 variant which fixes this. I am not optimistic of it happening in the short term. If you have that trivial routine that elicits the trouble my contract lets me dumpt it "up" to QNX Oz and thereon into the corporate bugstream.

I think there's a few qnx employees about here too. e-mail me -
bchippindale*@**networkadvantage*.*biz - but without the asterisks.

I am pretty keen to get this fixed, but too busy to focus on it if I have a workaround ( which I do ).

Thanks
BJ
bjchip
Active Member
 
Posts: 46
Joined: Wed Nov 26, 2003 10:20 pm

Postby cburgess » Fri Oct 08, 2004 7:15 pm


Yes, 3.3.1 as well as 2.95.3 -
hmmmm... a separate 6.2.1 linker? Could I use it under 6.3 ?



Are you 100% sure that you're seeing it with gcc 3.3.1? The bug we are aware of is that the newer ld doesn't understand how to edit 2.95.3 exception handling records. :cry:
cburgess
QNX Master
 
Posts: 209
Joined: Tue Aug 31, 2004 8:40 pm
Location: Ottawa

Postby JoshRodgers » Wed May 03, 2006 6:59 am

Sorry to bumb up an old thread, but I am having this exact problem in 6.3...

using 2.95.3 a stream of "unknown symbols:" were reported with no other info.

then using 3.3.5 "unknown symbols:" were reported, however the symbols wer actually displayed.

Was there a final solution to this problem???

Cheers,
Josh.
JoshRodgers
New Member
 
Posts: 5
Joined: Wed Apr 26, 2006 5:37 am

Postby rgallen » Wed May 03, 2006 3:51 pm

JoshRodgers wrote:Sorry to bumb up an old thread, but I am having this exact problem in 6.3...

using 2.95.3 a stream of "unknown symbols:" were reported with no other info.

then using 3.3.5 "unknown symbols:" were reported, however the symbols wer actually displayed.

Was there a final solution to this problem???

Cheers,
Josh.


Yes. Upgrade to 6.3.0SP2. I build tons of C++ shared libraries, and I thoroughly encountered the problem described in this thread, but with SP2 everything is fine (since you have 3.3.5 I think that means you have SP2), so more than likely the problem is yours.

Do you have a simple example where you can't run an exec built with a shared library? (i.e. fooapi.cc, foo.cc, build libfooapi.so link foo.o against libfooapi.so, set the LD_LIBRARY_PATH run foo, and get unknown symbols).
rgallen
QNX Master
 
Posts: 671
Joined: Thu Jul 11, 2002 6:48 pm

Postby bricedebrignaisplage » Thu Mar 27, 2008 9:14 am

exact same problem here with:

QNX 6.3.2
gcc 2.95.3
ld 2.12.1qnx-nto


gcc 2.95.3 is a bit old. How can I use a newer version? Hopefully would solve my problem...
bricedebrignaisplage
Active Member
 
Posts: 10
Joined: Tue Dec 04, 2007 9:55 am
Location: singapore

Postby mario » Thu Mar 27, 2008 9:49 am

You already have 3.3.5, check qcc doc.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Postby emijah » Fri Aug 14, 2009 2:12 am

Has this issue been resolved?

I'm currently trying to compile libACE on qnx 6.4.1 with the default gcc compiler(4.3.3) and have run into the same problems.
The compile itself is fine so long as you do the proper configuration under the ACE_wrapper/ace directory and add the next two lines:

#define ACE_LACKS_ISCTYPE
#define ACE_HAS_3_PARAM_READDIR_R

to config-qnx-neutrino.h.

However when the compile process tries to compile the examples you get a bunch of messages like,

/bin/sh ../../../libtool --tag=CXX --mode=link QCC -W -Wall -Wpointer-arith -g -O2 -O -I. -I.. -o SAXPrint SAXPrint-Print_Handler.o SAXPrint-SAXPrint_Handler.o SAXPrint-main.o ../../../ACEXML/parser/parser/libACEXML_Parser.la ../../../ACEXML/common/libACEXML.la ../../../ace/libACE.la
QCC -W -Wall -Wpointer-arith -g -O2 -O -I. -I.. -o .libs/SAXPrint SAXPrint-Print_Handler.o SAXPrint-SAXPrint_Handler.o SAXPrint-main.o ../../../ACEXML/parser/parser/.libs/libACEXML_Parser.so /home/d3user/src/ACE/ACE_wrappers/build/ACEXML/common/.libs/libACEXML.so
../../../ACEXML/common/.libs/libACEXML.so /home/d3user/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so ../../../ace/.libs/libACE.so
-Wl,--rpath -Wl,/usr/local/lib
SAXPrint-main.o: In function `ace_main_i(int, char**)':
/home/testuser/src/ACE/ACE_wrappers/build/ACEXML/examples/SAXPrint/../../../../ACEXML/examples/SAXPrint/main.cpp:54: undefined reference to `ACE_Get_Opt::opt_arg() const'
/home/testuser/src/ACE/ACE_wrappers/build/ACEXML/examples/SAXPrint/../../../../ACEXML/examples/SAXPrint/main.cpp:57: undefined reference to `ACE_Get_Opt::opt_arg() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Time_Value::ACE_Time_Value(timeval const&)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Log_Msg::priority_mask(ACE_Log_Msg::MASK_TYPE)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Reactor::resume_handler(int)'
/home/testuser/src/ACE/ACE_wrappers/build/ACEXML/common/.libs/libACEXML.so: undefined reference to `ACE_Dynamic::set()'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `bind'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Mem_Map::unmap(int)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `operator-(ACE_Time_Value const&, ACE_Time_Value const&)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to 'ACE_Control_Block::ACE_Malloc_Header::init_ptr(ACE_Control_Block::ACE_Malloc_Header**,ACE_Control_Block::ACE_Malloc_Header*, void*)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Handle_Set::operator fd_set*()'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Process_Mutex::acquire_read()'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl(bool)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_MEM_SAP::acquire_buffer(int)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Message_Block::msg_priority(unsigned long
)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `gethostbyname'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Pipe::write_handle() const'
/home/testuser/src/ACE/ACE_wrappers/build/ACEXML/common/.libs/libACEXML.so: undefined reference to `ACE_Message_Block::prev(ACE_Mess
age_Block*)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Task_Base::is_writer() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Service_Type_Impl::object() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Message_Block::size() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_SOCK_IO::~ACE_SOCK_IO()'
/home/testuser/src/ACE/ACE_wrappers/build/ACEXML/common/.libs/libACEXML.so: undefined reference to `ACE_SOCK_IO::recv(void*, unsigned int, int, ACE_Time_Value const*) const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Sig_Guard::ACE_Sig_Guard(ACE_Sig_Set*, bool)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_IO_SAP::get_handle() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Message_Block::end() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Message_Block::space() const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_SPIPE_Stream::get_remote_addr(ACE_SPIPE_Addr&) const'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Reactor::suspend_handler(int)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Framework_Component::ACE_Framework_Component(void*, char const*, char const*)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Notification_Buffer::~ACE_Notification_Buffer()'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_NS_WString::ACE_NS_WString(ACE_Allocator*)'
/home/testuser/src/ACE/ACE_wrappers/build/ace/.libs/libACE.so: undefined reference to `ACE_Message_Block::msg_execution_time() const
'

The fact that it can't find "gethostbyname" is worrying and I'm thinking of looking at this from that angle but I would appreciate any input on this.

Cheers,
emijah
New Member
 
Posts: 5
Joined: Wed Aug 15, 2007 2:03 pm

Postby mario » Fri Aug 14, 2009 12:07 pm

missing -lsocket probably
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Same thing for ACE/TAO 6.0 on QNX 6.5.0

Postby macaques » Fri Jan 21, 2011 3:35 pm

Anybody has solved this? I got the same link error.

I put these to ace/config-qnx-neutrino.h

#define ACE_LACKS_ISCTYPE
#define ACE_HAS_3_PARAM_READDIR_R
#define ACE_HAS_SOCKLEN_T

Can someone please help? Any input is appreciated!!!
macaques
New Member
 
Posts: 2
Joined: Mon Jan 17, 2011 11:29 pm

Previous

Return to General Programming

Who is online

Users browsing this forum: No registered users and 2 guests