pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

64 bit ABI issue on Solaris



Hi all,

Pkgsrc on Sparc/Solaris 9. ABI=64 (set in mk.conf). Gcc 3.4.6.

Compiling my first c++ port, graphics/tiff fails in the linking phase:


libtool: link: g++ -shared -nostdlib -L/usr/lib -Wl,-R/usr/lib -L/usr/local/lib 
-Wl,-R/usr/local/lib /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crti.o 
/usr/ccs/lib/values-Xa.o /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtbegin.o 
 .libs/tif_stream.o  -Wl,-z -Wl,allextract ../port/.libs/libport.a -Wl,-z 
-Wl,defaultextract  -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/tiff-3.9.4/libtiff/.libs -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib -Wl,-R -Wl,/usr/gcc/lib 
-Wl,-R -Wl,/usr/local/lib -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib -Wl,-R -Wl,/usr/gcc/lib 
-L/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib ../libtiff/.libs/libtiff.so 
/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib/libjpeg.so -lz -lc 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6 
-L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6 -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../.. 
/usr/gcc/lib/libstdc++.so 
-L/opt/src/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/src -L/opt/src/g
 cc-obj/sparc-sun-solaris2.9/libstdc++-v3/src/.libs -L/opt/src/gcc-obj/gcc -lm 
-lgcc /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtend.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtn.o  -mcpu=ultrasparc -mtune=v9 
-Wl,-R/usr/local/lib   -Wl,-h -Wl,libtiffxx.so.3 -o .libs/libtiffxx.so.3.9.4
ld: fatal: file .libs/tif_stream.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to .libs/libtiffxx.so.3.9.4
collect2: ld returned 1 exit status


As I want a 64 bit ABI, lib_stream.o seems to be in the correct format. 
.work.log shows that this is translated into

[*] /tmp/pkgsrc/graphics/tiff/work/.wrapper/bin/g++ 
/tmp/pkgsrc/graphics/tiff/work/.wrapper/bin/g++ -shared -nostdlib -L/usr/lib 
-Wl,-R/usr/lib -L/usr/local/lib -Wl,-R/usr/local/lib 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crti.o /usr/ccs/lib/values-Xa.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtbegin.o .libs/tif_stream.o 
-Wl,-z -Wl,allextract ../port/.libs/libport.a -Wl,-z -Wl,defaultextract -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/tiff-3.9.4/libtiff/.libs -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib -Wl,-R -Wl,/usr/gcc/lib 
-Wl,-R -Wl,/usr/local/lib -Wl,-R 
-Wl,/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib -Wl,-R -Wl,/usr/gcc/lib 
-L/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib ../libtiff/.libs/libtiff.so 
/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib/libjpeg.so -lz -lc 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6 
-L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6 -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../.. /usr/gcc/lib/libs
 tdc++.so -L/opt/src/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/src 
-L/opt/src/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/src/.libs 
-L/opt/src/gcc-obj/gcc -lm -lgcc 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtend.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtn.o -mcpu=ultrasparc -mtune=v9 
-m64 -Wl,-R/usr/local/lib -Wl,-h -Wl,libtiffxx.so.3 -o .libs/libtiffxx.so.3.9.4
WARNING: [transform-gcc] passing unknown option -nostdlib
WARNING: [transform-gcc] passing unknown option -mtune=v9
<.> /tmp/pkgsrc/graphics/tiff/work/.gcc/bin/g++ -shared -nostdlib 
-L/tmp/pkgsrc/graphics/tiff/work/.buildlink/lib -Wl,-R/usr/local/lib 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crti.o /usr/ccs/lib/values-Xa.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtbegin.o .libs/tif_stream.o 
-Wl,-z -Wl,allextract ../port/.libs/libport.a -Wl,-z -Wl,defaultextract 
-Wl,-R/tmp/pkgsrc/graphics/tiff/work/tiff-3.9.4/libtiff/.libs 
../libtiff/.libs/libtiff.so -L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtend.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtn.o -mcpu=ultrasparc -mtune=v9 
-m64 -Wl,-h -Wl,libtiffxx.so.3 -o .libs/libtiffxx.so.3.9.4 -m64 
-I/tmp/pkgsrc/graphics/tiff/work/.buildlink/include  -ljpeg -lz -lc -lstdc++ 
-lm -lgcc


Apparently, some object files such as crti.o are taken from 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6. That are the 32 bit files. The 64 
bit files reside under /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9. 
Same for values-Xa.o.


Compiling a c++ hello world program shows that g++ is automatically doing the 
right thing (relevant lines shown only):


$ g++ -v hello.cc
Reading specs from /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/specs
:
:
 /usr/gcc/libexec/gcc/sparc-sun-solaris2.9/3.4.6/collect2 -V -Y 
P,/usr/ccs/lib:/usr/lib -Qy /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crt1.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crti.o /usr/ccs/lib/values-Xa.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtbegin.o 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6 
-L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6 -L/usr/ccs/bin -L/usr/ccs/lib 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../.. /var/tmp//ccHlHBYw.o 
-lstdc++ -lm -lgcc -lc -lgcc -lc 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtend.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/crtn.o

vs


$ g++ -m64 -v hello.cc
Reading specs from /usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/specs
:
:
 /usr/gcc/libexec/gcc/sparc-sun-solaris2.9/3.4.6/collect2 -V -Y 
P,/usr/lib/sparcv9 -Qy 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9/crt1.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9/crti.o 
/usr/ccs/lib/sparcv9/values-Xa.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9/crtbegin.o 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6 
-L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9 
-L/usr/lib/gcc/sparc-sun-solaris2.9/3.4.6 -L/usr/ccs/bin/sparcv9 -L/usr/ccs/bin 
-L/usr/ccs/lib/sparcv9 -L/usr/ccs/lib 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../../sparcv9 
-L/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../.. -L/lib/sparcv9 
-L/usr/lib/sparcv9 /var/tmp//ccjyZ2Bq.o -lstdc++ -lm -lgcc -lc -lgcc -lc 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9/crtend.o 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9/crtn.o

Gcc is picking up object files from either y 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/ or y 
/usr/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.6/sparcv9. Pkgsrc is intervening 
somehow.


I didn't have such issues when compiling c programs, only.

Changing the directory names on the command line fixed the issue. So, the only 
problem with compiling tiff is the wrong directories.

What goes wrong here?

 Stefan
 

-- 

Scotty: Captain, we din' can reference it!
Kirk:   Analysis, Mr. Spock?
Spock:  Captain, it doesn't appear in the symbol table.
Kirk:   Then it's of external origin?
Spock:  Affirmative.
Kirk:   Mr. Sulu, go to pass two.
Sulu:   Aye aye, sir, going to pass two.


Home | Main Index | Thread Index | Old Index