Re: ongoing link issues

2015-12-09 Thread Dimitry Andric
On 09 Dec 2015, at 17:50, William A. Mahaffey III  wrote:
> 
> I am still trying to statically link my inhouse code. I switched to using 
> g++5 in the link line:
...
> g++5 -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 -static-libstdc++ 
> -Bstatic -lgfortran -static-libgfortran && \rm -f Main.o

> [wam@kabini1, ~, 10:51:48am] 917 % PreBFCGL.TEST
> /lib/libgcc_s.so.1: version GCC_4.6.0 required by 
> /usr/local/lib/gcc48/libgfortran.so.3 not found
> [wam@kabini1, ~, 10:51:52am] 918 % PreBFCGL.TEST.static
> /lib/libgcc_s.so.1: version GCC_4.6.0 required by 
> /usr/local/lib/gcc48/libgfortran.so.3 not found
> [wam@kabini1, ~, 10:52:02am] 919 % PreBFCGL.bdver1.TEST.static
> /lib/libgcc_s.so.1: version GCC_4.6.0 required by 
> /usr/local/lib/gcc48/libgfortran.so.3 not found
> [wam@kabini1, ~, 10:52:04am] 920 % uname -a

Instead of all the complicated stuff above, can't you simply use -static
while linking?  I'm not sure why you want a half-dynamic, half-static
executable?

If you want to link *some* of the libraries statically, you must enclose
these in a -Wl,-Bstatic ... -Wl,-Bdynamic pair.  For example:

-Wl,-Bstatic -lstdc++ -lgfortran -lgcc -Wl,-Bdynamic

Also, you should probably link using gcc5 instead of g++5, otherwise the
latter might add its own -lstdc++ arguments.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: ongoing link issues

2015-12-09 Thread William A. Mahaffey III

On 12/09/15 12:03, Dimitry Andric wrote:

On 09 Dec 2015, at 17:50, William A. Mahaffey III  wrote:

I am still trying to statically link my inhouse code. I switched to using g++5 
in the link line:

...

g++5 -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 -static-libstdc++ -Bstatic -lgfortran -static-libgfortran && 
\rm -f Main.o
[wam@kabini1, ~, 10:51:48am] 917 % PreBFCGL.TEST
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:51:52am] 918 % PreBFCGL.TEST.static
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:52:02am] 919 % PreBFCGL.bdver1.TEST.static
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:52:04am] 920 % uname -a

Instead of all the complicated stuff above, can't you simply use -static
while linking?  I'm not sure why you want a half-dynamic, half-static
executable?

If you want to link *some* of the libraries statically, you must enclose
these in a -Wl,-Bstatic ... -Wl,-Bdynamic pair.  For example:

-Wl,-Bstatic -lstdc++ -lgfortran -lgcc -Wl,-Bdynamic

Also, you should probably link using gcc5 instead of g++5, otherwise the
latter might add its own -lstdc++ arguments.

-Dimitry



I went ahead & tried the -Wl,-Bstatic & -Wl,-Bdynamic (I show output 
from successful dynamic link & problematic static link for comparison):


.
.
.

chmod: /usr/local/bin/PreBFCGL.opteron.TEST.R8: No such file or directory
*** [/usr/local/bin/PreBFCGL.opteron.TEST.R8] Error code 1 (ignored)
ar xv 
/home/wam/V8/Cnx/test/junk/cart/unstaggered/bfc/pre/../lib/R8/opteron/libmaiPre.a 
Main.o

x - Main.o
g++5 -o /usr/local/bin/PreBFCGL.opteron.TEST.R8 
-Wl,-s,--allow-multiple-definition,-rpath=/usr/local/lib/gcc5 Main.o 
-L/home/wam/V8/Cnx/test/junk/cart/unstaggered/bfc
/pre/../lib/R8/opteron -L/home/wam/lib/R8  -L/usr/lib64/openmotif 
-L/home/wam/V8/Cnx/test/junk/cart/unstaggered/bfc/pre/../lib/R4/opteron 
-L/home/wam/lib/R4  -L/usr/l
ib64/openmotif -Wl,--start-group -lmaiPre -lPre -lPrecxx -lutils 
-lftndmp -lftnO2pre -lftnO2 -lBC_Phi -license -Wl,--end-group -lMemIO 
-lMotif -lStdHash -lgfortran -l
gomp -lgcc -lmpi -ltet -lMrm -lXm -lXt -lGL -lGLU -lGLw -lX11 -ljpeg 
-lpng -lz -lm && \rm -f Main.o

chmod -fv go+rx,a-w /usr/local/bin/PreBFCGL.opteron.TEST.R8
/usr/local/bin/PreBFCGL.opteron.TEST.R8
Done with /usr/local/bin/PreBFCGL.opteron.TEST.R8.
MakePRE: Everything usual up to Date.
Everything MemLibs up to date.
Everything HashLibs up to date.
Everything DumpLibs up to date.
Everything BCLibs up to date.
Everything allLibs up to date.
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
g++5 -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 -static-libstdc++ -Wl,-Bstatic 
-lgfortran -lgomp -lgcc -Wl,-Bdynamic -lmpi -ltet -lMrm -lXm -lXt -lGL 
-lGLU -lGLw -lX11 -ljp

eg -lpng -lz -lm && \rm -f Main.o
/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd9.3/5.2.1/../../../libgfortran.a(write.o): 
In function `write_float':
/usr/ports/lang/gcc5-devel/work/build/x86_64-portbld-freebsd9.3/libgfortran/../.././../gcc-5-20151124/libgfortran/io/write_float.def:1306: 
undefined reference to `sig

nbitq'
/usr/ports/lang/gcc5-devel/work/build/x86_64-portbld-freebsd9.3/libgfortran/../.././../gcc-5-20151124/libgfortran/io/write_float.def:1306: 
undefined reference to `fin

iteq'
/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd9.3/5.2.1/../../../libgfortran.a(write.o): 
In function `determine_en_precision':
/usr/ports/lang/gcc5-devel/work/build/x86_64-portbld-freebsd9.3/libgfortran/../.././../gcc-5-20151124/libgfortran/io/write_float.def:1213: 
undefined reference to `fin

iteq'
/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd9.3/5.2.1/../../../libgfortran.a(write.o): 
In function `write_float':
/usr/ports/lang/gcc5-devel/work/build/x86_64-portbld-freebsd9.3/libgfortran/../.././../gcc-5-20151124/libgfortran/io/write_float.def:1306: 
undefined reference to `isn

anq'

Re: ongoing link issues

2015-12-09 Thread William A. Mahaffey III

On 12/09/15 12:03, Dimitry Andric wrote:

On 09 Dec 2015, at 17:50, William A. Mahaffey III  wrote:

I am still trying to statically link my inhouse code. I switched to using g++5 
in the link line:

...

g++5 -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 -static-libstdc++ -Bstatic -lgfortran -static-libgfortran && 
\rm -f Main.o
[wam@kabini1, ~, 10:51:48am] 917 % PreBFCGL.TEST
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:51:52am] 918 % PreBFCGL.TEST.static
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:52:02am] 919 % PreBFCGL.bdver1.TEST.static
/lib/libgcc_s.so.1: version GCC_4.6.0 required by 
/usr/local/lib/gcc48/libgfortran.so.3 not found
[wam@kabini1, ~, 10:52:04am] 920 % uname -a

Instead of all the complicated stuff above, can't you simply use -static
while linking?  I'm not sure why you want a half-dynamic, half-static
executable?

If you want to link *some* of the libraries statically, you must enclose
these in a -Wl,-Bstatic ... -Wl,-Bdynamic pair.  For example:

-Wl,-Bstatic -lstdc++ -lgfortran -lgcc -Wl,-Bdynamic

Also, you should probably link using gcc5 instead of g++5, otherwise the
latter might add its own -lstdc++ arguments.

-Dimitry



Thanks for your reply. I tried '-static' earlier (see posts last week) & 
the linker couldn't find static libraries for LibGL, libGLU & libGLw.



I also tried gcc5 to link (see earlier posts today) & it seemed to still 
dynamically link libstdc++, even w/ the '-static-libstdc++' argument. 
Your suggestion to use the explicit linker arguments -Bstatic & 
-Bdynamic is the next thing to try, however they will require a bit more 
mods to my Makefile & I thought my attempts using various 
'-static-lib' should/would work, based on my read of the man 
pages.



--

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"