Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Proper LD_LOAD_LIBRARY Syntax

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Proper LD_LOAD_LIBRARY Syntax Page: [1]
Login
Message << Older Topic   Newer Topic >>
Proper LD_LOAD_LIBRARY Syntax - Nov. 22, '04, 2:50:03 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi:

Still attempting to build ACE / TAO under INTERIX.

I am having a bit of an issue setting the the static library path and get the following from G++

/opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/../../../../i586-pc-interix3/bin/l
d: cannot find -lACE

I tried export (didn't work) and setenv (worked but still same error)..

I am also having a problem with templates..

I get an error like:
.....
DACE_HAS_EXCEPTIONS -D__ACE_INLINE__ -Iinclude -Ibe_include -Ife -DTAO_IDL_PR
EPROCESSOR=\"g++\" -Wl,-rpath -frepo /opt/ACE_wrappers/ace -L/opt/ACE_wrappers/
ace -L./ -L/opt/ACE_wrappers/TAO/tao -o tao_idl .obj/drv_args.o .obj/drv_preproc
.o .obj/tao_idl.o -lTAO_IDL_BE_DLL -lTAO_IDL_FE_DLL -lACE
/opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/../../../../i586-pc-interix3/bin/l
d: .obj/tao_idl.o (.data$_ZZN13ACE_SingletonI11TAO_CodeGen26ACE_Recursive_Thread
_MutexE8instanceEvE4lock): matching COMDAT symbol name not found

And was able to overcome it using the -frepo switch for the libraries unfortunately the same does not seem to be working here.

Thank You
Steve
Post #: 1
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 22, '04, 3:18:16 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Did you mean "LD_LIBRARY_PATH" instead of "LD_LOAD_LIBRARY" in the posting subject?

(in reply to sfrare)
Post #: 2
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 22, '04, 1:02:26 PM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi:

I think I got my Linux and Interix configuration mingled, I will have to have another run at trying this.

Thanks
Steve

(in reply to Rodney)
Post #: 3
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 22, '04, 10:34:22 PM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi:

Okay LD_LIBRARY_PATH was my problem, (on Linux...) sorry about that...

My problem on Interix is creating a shared library. I build the ACE shared library, which seems to go okay. Now when I am done with the library I do an "ld libACE.so" and it is bad...

Here is what I do and see, I have obviously dorked up something in either the compile or link step.


Compile (short sample, many files):
g++ -W -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -O2 -g -D_
REENTRANT -D_ALL_SOURCE -frepo -I/opt/ACE_wrappers -DACE_HAS_EXCEPTIONS -D_
_ACE_INLINE__ -DACE_BUILD_DLL -DACE_OS_BUILD_DLL -c -o .shobj/Asynch_Pseudo_Ta
sk.o Asynch_Pseudo_Task.cpp
g++ -W -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -O2 -g -D_
REENTRANT -D_ALL_SOURCE -frepo -I/opt/ACE_wrappers -DACE_HAS_EXCEPTIONS -D_
_ACE_INLINE__ -DACE_BUILD_DLL -DACE_OS_BUILD_DLL -c -o .shobj/POSIX_Asynch_IO.
o POSIX_Asynch_IO.cpp

Link line:
g++ -Wl,-h -Wl,libACE.so.5.4.0 -I/opt/ACE_wrappers -DACE_HAS_EXCEPTIONS -D__AC
E_INLINE__ -DACE_BUILD_DLL -DACE_OS_BUILD_DLL -shared -o libACE.so.5.4.0 .shobj/
ARGV.o .shobj/Argv_Type_Converter.o .shobj/Basic_Types.o .shobj/Time_Value.o .sh
... a bunch more object files ...
ply.o .shobj/Name_Space.o .shobj/Naming_Context.o .shobj/Registry_Name_Space.o .
shobj/Remote_Name_Space.o .shobj/NT_Service.o .shobj/UUID.o -Wl,-rpath -frepo -l
/opt/ACE_wrappers/ace -lpthread -L/opt/ACE_wrappers/ace -L./
rm -f libACE.so
cp -p libACE.so.5.4.0 libACE.so
chmod a+rx libACE.so.5.4.0

Run ld on libACE.so
% ld libACE.so
ld: warning: cannot find entry symbol ___PosixProcessStartup; defaulting to 0000
1000
libACE.so: undefined reference to `ACE_Select_Reactor_T<ACE_Select_Reactor_Token
_T<ACE_Token> >::wait_for_multiple_events(ACE_Select_Reactor_Handle_Set&, ACE_Ti
me_Value*)'
libACE.so: undefined reference to `ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Des
criptor*>::next(ACE_Static_Svc_Descriptor**&)'
libACE.so: undefined reference to `ACE_Malloc_T<ACE_MMAP_Memory_Pool, ACE_Proces

... Pages of errors ...

libACE.so: undefined reference to `ACE_Malloc_T<ACE_MMAP_Memory_Pool, ACE_Thread
_Mutex, ACE_Control_Block>::unbind(char const*, void*&)'
Segmentation fault
%

Any help is appreciated.

Thank You
Steve

(in reply to sfrare)
Post #: 4
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 1:18:51 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
The ld man pages says (nearer the begining):
Often, the last step in building a new compiled program to run is a call to ld(1).

Let's substitute "program" for "library" to match what your describing you do (ld libACE.so)
in the above quote. Then key to this is the word "often" which can mean "not always".
With Interix you don't do this step (as you would on some other systems, but not all systems).
At least I've not had to do it and I've build a fair number of shared libraries (C based though).

So try just removing this step and then get a program that links to your ACE shared lib and
see how it goes.

< Message edited by Rodney -- Nov. 23, '04, 1:20:57 AM >

(in reply to sfrare)
Post #: 5
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 2:41:36 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney:

I actually tried that first, this is back stepping to try and find the error.

I _think_ the issue is due to name mangling for C++. This is getting into OS specifics so I am treading lightly here...

Okay it says it cant find:
ACE_Unbounded_Set_Iterator

However an objdump shows:

[7570](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZN26ACE_Unbounded_Set_IteratorIP25ACE_Static_Svc_DescriptorE4nextERPS1_

[8231](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZN26ACE_Unbounded_Set_IteratorIPcEppEv

[8891](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZN26ACE_Unbounded_Set_IteratorIP25ACE_Static_Svc_DescriptorE7advanceEv

[9261](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZN26ACE_Unbounded_Set_IteratorIP25ACE_Static_Svc_DescriptorEC1ER17ACE_Unbounded_SetIS1_Ei

[9336](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZN26ACE_Unbounded_Set_IteratorIPcEdeEv

[9627](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 __ZNK26ACE_Unbounded_Set_IteratorIPcEneERKS1_

Okay, so it's a little overloaded... I didn't write it ;->

Thoughts?

Thanks
Steve

(in reply to Rodney)
Post #: 6
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 2:48:09 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney:

Okay so right after I wrote that message it occurs to me I haven't tried that since my first post and have made many changes since then....

It appears to be building...

I will have to get back to you with an update but until it fails, something went right!!

Thanks!
Steve

(in reply to sfrare)
Post #: 7
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 2:58:43 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney!

Argh!! That worked!! I wonder how long I have had this working for... ;-> All the test programs fail, but thats fine. They link, they run, they fail, they can be debugged. That's a whole other kettle of fish!

Thanks!
Steve

(in reply to sfrare)
Post #: 8
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 3:13:10 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Congratulations :-)

Fresh fish can always be refreshing! good luck.

(in reply to sfrare)
Post #: 9
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 9:15:25 PM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney:

Unfortunately I am a liar! (and a cheat, but whatever... ;-> )

I was dorking around with so many link lines I messed up the application link line so bad it did compile but going in to debug showed me what a mess I had made. Once I straightened that I am back to the same old issue...

Not sure where to go from here, still exploring.

Any ideas are welcome!

Thanks!
Steve

(in reply to Rodney)
Post #: 10
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 23, '04, 11:38:04 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I think I need to find out what the problem is again.
Reading back through everything I'm a bit muddled now. This is what the state
of this is (I think):
- you do the compile of the objects okay
- you skip doing the ld libACE.so
- you link a program (or try to) and get an error?

Is this right? If so what's the error currently?

(in reply to sfrare)
Post #: 11
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 24, '04, 12:07:40 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney:

Yep, you have the steps down. I build and link the shared library okay but fail to build the client. Here is a portion of the current output:

g++ -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -g -D_REENTR
ANT -D_ALL_SOURCE -D_ACE_OS_HAS_DLL -frepo -I/opt/ACE_wrappers -DACE_HAS_EXC
EPTIONS -D__ACE_INLINE__ -c -o .obj/aix_hack_for_main.o aix_hack_for_main.cpp
g++ -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -g -D_REENTR
ANT -D_ALL_SOURCE -D_ACE_OS_HAS_DLL -frepo -I/opt/ACE_wrappers -DACE_HAS_EXC
EPTIONS -D__ACE_INLINE__ -c -o .obj/Main.o Main.cpp <<--- Good to here!
g++ -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -g -D_REENTR
ANT -D_ALL_SOURCE -D_ACE_OS_HAS_DLL -frepo -I/opt/ACE_wrappers -DACE_HAS_EXC
EPTIONS -D__ACE_INLINE__ -L/opt/ACE_wrappers/ace -lpthread -o aix_hack_for_main
.obj/Main.o .obj/aix_hack_for_main.o -lTest_Output -lACE
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Select_Reactor_T<AC
E_Select_Reactor_Token_T<ACE_Token> >::wait_for_multiple_events(ACE_Select_React
or_Handle_Set&, ACE_Time_Value*)'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Stream<ACE_Thread_M
utex, ACE_Condition_Thread_Mutex>::link(ACE_Stream<ACE_Thread_Mutex, ACE_Conditi
on_Thread_Mutex>&)'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Unbounded_Set_Itera
tor<ACE_Static_Svc_Descriptor*>::next(ACE_Static_Svc_Descriptor**&)'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Select_Reactor_T<AC
E_Select_Reactor_Token_T<ACE_Token> >::max_notify_iterations()'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Unbounded_Queue<ACE
_Event_Tuple>::reset()'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Stream<ACE_Thread_M
utex, ACE_Condition_Thread_Mutex>::~ACE_Stream [in-charge]()'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Stream<ACE_Thread_M
utex, ACE_Condition_Thread_Mutex>::put(ACE_Message_Block*, ACE_Time_Value*)'
/opt/ACE_wrappers/ace/libACE.so: undefined reference to `ACE_Select_Reactor_T<AC
E_Select_Reactor_Token_T<ACE_Token> >::deactivated()'

I built a simple test executable this evening and a simple test shared libary. The test executable calls the shared library and the shared library uses templates, etc... Works fine...

Thanks
Steve

(in reply to Rodney)
Post #: 12
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 24, '04, 12:43:52 AM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi:

I am fairly convinced this has to do with templates, even though I was able to make my own tiny test program (not using ACE at all) with templates.

So I went into man G++ and read the following:

-fexternal-templates
Produce smaller code for template declarations, by generating only a
single copy of each template function where it is defined. To use this
option successfully, you must also mark all files that use templates
with either #pragma implementation (the definition) or #pragma
interface (declarations).
When your code is compiled with -fexternal-templates, all template
instantiations are external. You must arrange for all necessary
instantiations to appear in the implementation file. You can do this
with a typedef that references each instantiation needed. Conversely,
when you compile using the default option -fno-external-templates, all
template instantiations are explicitly internal.


So I added that and got the following:

g++ -Wall -Wpointer-arith -pipe -D_THREAD_SAFE -DACE_HAS_THREADS -g -D_REENTR
ANT -D_ALL_SOURCE -D_ACE_OS_HAS_DLL -frepo -fexternal-templates -I/opt/ACE_
wrappers -DACE_HAS_EXCEPTIONS -D__ACE_INLINE__ -DACE_BUILD_DLL -DACE_OS_BUILD_DL
L -c -o .shobj/ACE.o ACE.cpp
cc1plus: warning: switch "-fexternal-templates" is deprecated, please see
documentation for details
In file included from ACE.cpp:11:
/opt/ACE_wrappers/ace/Auto_Ptr.h:177: error: invalid #pragma implementation
In file included from /opt/ACE_wrappers/ace/SString.h:23,
from ACE.cpp:12:
/opt/ACE_wrappers/ace/String_Base.h:437: error: invalid #pragma implementation
In file included from /opt/ACE_wrappers/ace/SString.h:483,
from ACE.cpp:12:
/opt/ACE_wrappers/ace/String_Base.i: In constructor `
ACE_NS_WString::ACE_NS_WString(ACE_Allocator*)':
/opt/ACE_wrappers/ace/String_Base.i:15: instantiated from `ACE_String_Base<CHA
R>::ACE_String_Base(ACE_Allocator*) [with CHAR = ACE_WSTRING_TYPE]'
/opt/ACE_wrappers/ace/SString.i:15: instantiated from here
/opt/ACE_wrappers/ace/String_Base.i:15: warning: template `
ACE_String_Base<CHAR>::ACE_String_Base(ACE_Allocator* = 0)' defined in file
without #pragma interface
In file included from /opt/ACE_wrappers/ace/Message_Block.h:1037,
from ACE.cpp:14:
/opt/ACE_wrappers/ace/Message_Block_T.h: At global scope:
/opt/ACE_wrappers/ace/Message_Block_T.h:79: error: invalid #pragma
implementation
make[1]: *** [.shobj/ACE.o] Error 1
make[1]: Leaving directory `/opt/ACE_wrappers/ace'
make: *** [all] Error 2

So is the man page for g++ up to date? I made sure the #pragma implementation stuff was there.... Maybe I am following the wrong instructions here...

Thanks
Steve

(in reply to sfrare)
Post #: 13
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 24, '04, 4:07:27 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I'll reference you to the FAQ on these pragmas:
http://www.interopsystems.com/tools/forum/tm.asp?m=2357&mpage=1&key=व

(in reply to sfrare)
Post #: 14
RE: Proper LD_LOAD_LIBRARY Syntax - Nov. 24, '04, 8:40:43 PM   
sfrare

 

Posts: 28
Joined: Oct. 24, '04,
Status: offline
Hi Rodney:

Thanks Again! I will make sure that switch and #pragma is not used!

Thanks
Steve

(in reply to Rodney)
Post #: 15
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Proper LD_LOAD_LIBRARY Syntax Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.063