From owner-freebsd-toolchain@freebsd.org Wed Dec 9 20:15:42 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECFDC9D5B91 for ; Wed, 9 Dec 2015 20:15:42 +0000 (UTC) (envelope-from wam@hiwaay.net) Received: from fly.hiwaay.net (fly.hiwaay.net [216.180.54.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C277F1F6E for ; Wed, 9 Dec 2015 20:15:42 +0000 (UTC) (envelope-from wam@hiwaay.net) Received: from kabini1.local (dynamic-216-186-213-32.knology.net [216.186.213.32] (may be forged)) (authenticated bits=0) by fly.hiwaay.net (8.13.8/8.13.8/fly) with ESMTP id tB9KFd1V027999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 9 Dec 2015 14:15:39 -0600 Subject: Re: ongoing link issues References: <56685C44.10802@hiwaay.net> Cc: FreeBSD toolchain mailing list !!!! From: "William A. Mahaffey III" Message-ID: <56688BEA.1080708@hiwaay.net> Date: Wed, 9 Dec 2015 14:21:08 -0553.75 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 20:15:43 -0000 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.