vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Help Please, I am trying to statically link the g++'s libstdc++.sl.5.5 and other gcc shared libraries, using g++ 3.3.3 on HPUX 11.11. To compile I am giving: ================= g++ -nostdlib -shared-libgcc -g -I/usr/local/include/ -I/usr/include/ -c receiver.cpp To statically link i am giving: ==================== g++ -v -static-libgcc -o Recv receiver.o -L../BiiNNM/lib_hpux/bmciilib -L/usr/local/lib -L/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3 -L/usr/lib -ldld -lCsup -lcl -lpthread -Wl,-B,immediate -Wl,-B,nonfatal -Wl,-B,verbose -Wl,-a,archive -lstdc++ -Wl,-a,archive -lgcc_eh It links without any errors but when I run it it gives following error: $ ./Recv aCC runtime: Error 22 from shl_findsym(/usr/lib/libCsup.2,_shlInit) Abort(coredump) Any help , thanks in advance Nilesh <hr><font face="Arial" size="2">Indiatimes Email now powered by <b>APIC Advantage</b>. <a href="http://email.indiatimes.com/apic/">Help!</a> </font><br><DIV align=left><a target="_blank" href="http://imaround.indiatimes.com/IMaround/presencefr.mss?userid=nlsh123" ><IMG alt="My Presence" border=0 src="http://203.199.93.51/IMaround/getpresence.mss?userid=nlsh123" ></a><a target="_blank" href="http://email.indiatimes.com/apic/userpage.html"><FONT face="Arial" size=2>Help</font></a></DIV><DIV align=left><FONT color=#008000 face="Lucida Sans Unicode" size=1>Click on the image to chat with me</FONT></DIV><a href=http://fastforward.indiatimes.com><img src=http://email.indiatimes.com/image/fastforward.gif border=0></a> |
| |||
| "Nilesh" <nileshg@gmail.com> writes: > Help Please, I am trying to statically link the g++'s libstdc++.sl.5.5 You can't statically link a shared library. You may give up now. > g++ -nostdlib -shared-libgcc -g -I/usr/local/include/ -I/usr/include/ > -c receiver.cpp Both '-nostdlib' and '-shared-libgcc' are meaningless and ignored on compile line. > g++ -v -static-libgcc -o Recv receiver.o -L../BiiNNM/lib_hpux/bmciilib > -L/usr/local/lib > -L/usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3 -L/usr/lib -ldld > -lCsup -lcl -lpthread -Wl,-B,immediate -Wl,-B,nonfatal -Wl,-B,verbose > -Wl,-a,archive -lstdc++ -Wl,-a,archive -lgcc_eh There are so many things wrong with that link line: - why are you linking against aCC runtime (libCsup) ? You do realize that aCC and g++ code can't be linked together, don't you? - Why are you linking against libc.a? (Final -Wl,-a,archive forces it) > <hr><font face="Arial" size="2">Indiatimes Email now powered by <b>APIC > Advantage</b>. <a href="http://email.indiatimes.com/apic/">Help!</a> Please don't post HTML. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| > There are so many things wrong with that link > line: > - why are you linking against aCC runtime > (libCsup) ? > You do realize that aCC and g++ code can't be linked together, > don't you? Is it impossible that 'hp-ld' links with the shared library compiled by g++ ? I've tried it a few days, but I have just error message like below. /usr/ccs/bin/ld: Unsatisfied symbols: func() (first referenced in demo_use.o) (code) Is there anyone to help me? |
| |||
| "dryest" <dry@uangel.com> writes: > Is it impossible that 'hp-ld' links with the shared library compiled by > g++ ? Huh? > I've tried it a few days, but I have just error message like below. > > /usr/ccs/bin/ld: Unsatisfied symbols: > func() (first referenced in demo_use.o) (code) How was demo_use.o compiled, where is 'func()' supposed to be defined, how was that source compiled, and what is the link command-line that fails? > Is there anyone to help me? Not unless you ask smarter questions: http://catb.org/%7Eesr/faqs/smart-questions.html Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| Paul Pluzhnikov writes: > "dryest" <dry@uangel.com> writes: > > >>Is it impossible that 'hp-ld' links with the shared library compiled by >>g++ ? > > > Huh? > > >>I've tried it a few days, but I have just error message like below. >> >>/usr/ccs/bin/ld: Unsatisfied symbols: >> func() (first referenced in demo_use.o) (code) > > > How was demo_use.o compiled, where is 'func()' supposed to be > defined, how was that source compiled, and what is the link > command-line that fails? In HP-UX b.11.11 machine, I used g++ 3.3.2, aCC A.03.37 and ld B.11.41 There are two source files. libhello.c and demo_use.c 1. Compile libhello.c $> g++ -fPIC -Wall -g -c libhello.c 2. Generate shared library. $> g++ -g -shared -fPIC -o libhello.sl libhello.o -lc 3. Compile demo_use.c $> aCC -AA -g -c demo_use.c -o demo_use.o 4. Link aCC -AA -g -o demo_use demo_use.o -L. -lhello --> Then /usr/ccs/bin/ld: Unsatisfied symbols: func() (first referenced in demo_use.o)(code) > > >>Is there anyone to help me? > > > Not unless you ask smarter questions: > http://catb.org/%7Eesr/faqs/smart-questions.html > > Cheers, |
| ||||
| dryest <dry@uangel.com> writes: .... tries to link 'g++' and 'aCC' compiled object code together and gets: > /usr/ccs/bin/ld: Unsatisfied symbols: > func() (first referenced in demo_use.o)(code) This is expected and everything is working *as designed*. Different C++ compilers are *not* link-compatible, because they do not use compatible object layout (e.g. they can make different decision on where to place virtual table pointer, how to align class members, etc.). If you had managed to link such incompatible code together, the result would have most likely been a runtime crash. Instead, they use different name mangling schemes http://en.wikipedia.org/wiki/Name_ma...ing_in_C.2B.2B which stops you from shooting your foot off. If you do '/usr/ccs/bin/nm -Ap demo_use.o libhello.o | grep func', you'll see name mangling in action, and will probably better understand the error you are getting. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |