I am still having issues statically linking some inhouse code. I (tried to) (re)arrange the linker args in my Makefile to link what can be statically-linked statically & the rest dynamically, see below.


    .
    .
    .

chmod: /usr/local/bin/PreBFCGL.opteron.TEST.static: No such file or directory
*** [/usr/local/bin/PreBFCGL.opteron.TEST.static] Error code 1 (ignored)
ar xv /home/wam/V8/Cnx/test/junk/cart/unstaggered/bfc/pre/../lib/R4/opteron/libmaiPre.a Main.o
x - Main.o
gcc5 -o /usr/local/bin/PreBFCGL.opteron.TEST.static -Wl,-s,--allow-multiple-definition,-rpath=/usr/local/lib/gcc5 Main.o -L/home/wam/V8/Cnx/test/junk/cart/unstaggered /bfc/pre/../lib/R4/opteron -L/home/wam/lib/R4 -L/usr/lib64/openmotif -Wl,--start-group -lmaiPre -lPre -lPrecxx -lutils -lftndmp -lftnO2pre -lftnO2 -lBC_Phi -license -Wl,--end-group -lMemIO -lMotif -lStdHash -lmpi -ltet -lgomp -lMrm -lXm -lXt -lGL -lGLU -lGLw -lX11 -ljpeg -lpng -lz -lm -static-libgcc -lstdc++ -static-libstdc++ -Bs
tatic -lgfortran -static-libgfortran && \rm -f Main.o
chmod -fv go+rx,a-w /usr/local/bin/PreBFCGL.opteron.TEST.static
/usr/local/bin/PreBFCGL.opteron.TEST.static
Done with /usr/local/bin/PreBFCGL.opteron.TEST.static.

    .
    .
    .

From the compile box:


[wam@devbox, pre, 10:05:02am] 4226 % uname -a
FreeBSD devbox 9.3-RELEASE-p30 FreeBSD 9.3-RELEASE-p30 #0: Mon Nov 2 10:11:50 UTC 2015 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
[wam@devbox, pre, 10:05:05am] 4227 %


However, when I copy the statically linked executables over to another FreeBSD 9.3R box (this one, as it happens) & try to run it, I get the following:


[wam@kabini1, ~, 9:51:46am] 906 % ll -tr LIST /usr/local/bin/[B,P]* /usr/local/bin/*WAM* /usr/local/bin/*et*en* ; ps -Taux ; uname -a ; /sbin/hwclock -r ; date lrwxr-xr-x 1 root wheel 20 Aug 27 2014 /usr/local/bin/PreBFCGL.TEST@ -> PreBFCGL.TEST.static lrwxr-xr-x 1 root wheel 23 Aug 27 2014 /usr/local/bin/PreBFCGL.TEST.R8@ -> PreBFCGL.TEST.static.R8
-r-xr-xr-x  1 root  wheel     15071 Mar 18  2015 /usr/local/bin/POST*
-rw-------  1 wam   users       437 Jul 11 23:13 LIST
-r-xr-xr-x 1 wam wheel 11197960 Aug 7 05:40 /usr/local/bin/PreBFCGL.SSE4.1.TEST.static* -r-xr-xr-x 1 wam wheel 11211944 Aug 7 05:40 /usr/local/bin/PreBFCGL.SSE4.1.TEST.static.R8* -r-xr-xr-x 1 root wheel 420 Aug 20 13:15 /usr/local/bin/rarian-sk-get-extended-content-list* -r-xr-xr-x 1 root wheel 400 Aug 20 13:15 /usr/local/bin/rarian-sk-get-content-list* lrwxr-xr-x 1 root wheel 35 Aug 20 13:15 /usr/local/bin/scrollkeeper-get-extended-content-list@ -> rarian-sk-get-extended-content-list lrwxr-xr-x 1 root wheel 26 Aug 20 13:15 /usr/local/bin/scrollkeeper-get-content-list@ -> rarian-sk-get-content-list -r-xr-xr-x 1 root wheel 2299 Oct 10 22:20 /usr/local/bin/pamstretch-gen* -r-x------ 1 wam wheel 4140184 Dec 7 07:39 /usr/local/bin/BFC.opteron.TEST.static.R8* -r-x------ 1 wam wheel 4038096 Dec 7 07:39 /usr/local/bin/BFC.opteron.TEST.static.R4* -r-x------ 1 wam wheel 4033688 Dec 7 07:39 /usr/local/bin/BFC.bdver1.TEST.static.R8* -r-x------ 1 wam wheel 4047376 Dec 7 07:39 /usr/local/bin/BFC.bdver1.TEST.static.R4* lrwxr-xr-x 1 root wheel 30 Dec 7 07:39 /usr/local/bin/PreBFCGL.TEST.static.R8@ -> PreBFCGL.bdver1.TEST.static.R8 lrwxr-xr-x 1 root wheel 27 Dec 7 07:39 /usr/local/bin/PreBFCGL.TEST.static@ -> PreBFCGL.bdver1.TEST.static -r-xr-xr-x 1 wam wheel 6472832 Dec 9 09:50 /usr/local/bin/PreBFCGL.opteron.TEST.static.R8* -r-xr-xr-x 1 wam wheel 6500736 Dec 9 09:50 /usr/local/bin/PreBFCGL.opteron.TEST.static* -r-xr-xr-x 1 wam wheel 6574464 Dec 9 09:50 /usr/local/bin/PreBFCGL.barcelona.TEST.static* -r-xr-xr-x 1 wam wheel 6518848 Dec 9 09:50 /usr/local/bin/PreBFCGL.barcelona.TEST.static.R8* -r-xr-xr-x 1 wam wheel 6422688 Dec 9 09:50 /usr/local/bin/PreBFCGL.bdver1.TEST.static.R8* -r-xr-xr-x 1 wam wheel 6488448 Dec 9 09:50 /usr/local/bin/PreBFCGL.bdver1.TEST.static*
USER   PID %CPU %MEM   VSZ   RSS TT  STAT STARTED    TIME COMMAND
wam  73608  0.0  0.0 16304  2168 32  R+   10:03AM 0:00.00 ps -Taux
wam 81998 0.0 0.1 91408 20712 32 S 1Nov15 0:45.31 xterm -sl 5000 -maximized -rv
wam  95269  0.0  0.0 18616  4288 32  Ss   12Oct15 0:02.51 tcsh
FreeBSD kabini1.local 9.3-RELEASE-p24 FreeBSD 9.3-RELEASE-p24 #0: Sat Aug 22 01:54:44 UTC 2015 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
/sbin/hwclock: Command not found.
Wed Dec  9 10:03:28 MCST 2015
[wam@kabini1, ~, 10:03:28am] 907 % PreBFCGL.TEST
/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.11 required by /usr/local/bin/PreBFCGL.TEST not found
[wam@kabini1, ~, 10:03:30am] 908 % PreBFCGL.TEST.static
/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.11 required by /usr/local/bin/PreBFCGL.TEST.static not found
[wam@kabini1, ~, 10:03:55am] 909 % PreBFCGL.bdver1.TEST.static
/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.11 required by /usr/local/bin/PreBFCGL.bdver1.TEST.static not found
[wam@kabini1, ~, 10:04:05am] 910 % uname -a
FreeBSD kabini1.local 9.3-RELEASE-p24 FreeBSD 9.3-RELEASE-p24 #0: Sat Aug 22 01:54:44 UTC 2015 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
[wam@kabini1, ~, 10:06:43am] 911 %


I found that I needed both the '-lstdc++ -static-libstdc++' in the link line or the C++ stuff didn't get linked in (i.e., '-static-libstdc++' alone doesn't link). The man page for gcc5 carefully mentions using 'g++' to link C++ code, while mentioning GCC for other static-linker options, is that my problem here ? If not, any clues what is :-) ? TIA & have a good one.

--

        William A. Mahaffey III

 ----------------------------------------------------------------------

        "The M1 Garand is without doubt the finest implement of war
         ever devised by man."
                           -- Gen. George S. Patton Jr.

_______________________________________________
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to