From owner-freebsd-current@FreeBSD.ORG Thu Dec 29 12:35:10 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F5621065675 for ; Thu, 29 Dec 2011 12:35:10 +0000 (UTC) (envelope-from daniel@digsys.bg) Received: from smtp-sofia.digsys.bg (smtp-sofia.digsys.bg [193.68.3.230]) by mx1.freebsd.org (Postfix) with ESMTP id 7FAE98FC08 for ; Thu, 29 Dec 2011 12:35:09 +0000 (UTC) Received: from dcave.digsys.bg (dcave.digsys.bg [192.92.129.5]) (authenticated bits=0) by smtp-sofia.digsys.bg (8.14.4/8.14.4) with ESMTP id pBTCYxEh092208 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Thu, 29 Dec 2011 14:35:04 +0200 (EET) (envelope-from daniel@digsys.bg) Message-ID: <4EFC5E72.806@digsys.bg> Date: Thu, 29 Dec 2011 14:34:58 +0200 From: Daniel Kalchev User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111228 Thunderbird/9.0 MIME-Version: 1.0 To: freebsd-current@freebsd.org References: <4EFAF3FC.60002@zedat.fu-berlin.de> <20111228135808.GW50300@deviant.kiev.zoral.com.ua> <4EFB2344.3000302@zedat.fu-berlin.de> <20111228142957.GX50300@deviant.kiev.zoral.com.ua> <4EFB447D.3000808@gwdg.de> <20111228181054.GF1895@hoeg.nl> <4EFB5E0C.90302@zedat.fu-berlin.de> <20111228183132.GB50300@deviant.kiev.zoral.com.ua> <4EFC4579.6060608@gwdg.de> <4EFC4CCC.3050507@zedat.fu-berlin.de> <20111229115904.GH50300@deviant.kiev.zoral.com.ua> <4EFC5ACD.5010701@zedat.fu-berlin.de> In-Reply-To: <4EFC5ACD.5010701@zedat.fu-berlin.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: lang/lua: /usr/bin/ld: lapi.o: relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2011 12:35:10 -0000 On 29.12.11 14:19, O. Hartmann wrote: > Am 12/29/11 12:59, schrieb Kostik Belousov: >> On Thu, Dec 29, 2011 at 12:19:40PM +0100, O. Hartmann wrote: >>> [...] >>> /usr/bin/ld: lapi.o: relocation R_X86_64_32 against `luaO_nilobject_' >>> can not be used when making a shared object; recompile with -fPIC >>> lapi.o: could not read symbols: Bad value >>> clang: error: linker command failed with exit code 1 (use -v to see >>> invocation) >>> *** Error code 1 >>> >>> Stop in /usr/ports/lang/lua/work/lua-5.1.4/src. >>> *** Error code 1 >>> >>> Stop in /usr/ports/lang/lua/work/lua-5.1.4/src. >>> *** Error code 1 >>> >>> Stop in /usr/ports/lang/lua/work/lua-5.1.4. >>> *** Error code 1 >>> >>> Stop in /usr/ports/lang/lua. >>> >>> ===>>> make failed for lang/lua >>> ===>>> Aborting update >>> >>> Terminated >>> Terminated >>> >>> This is very strange! >> What is strange ? It is exactly the same problem as in the first message >> started this thread. You must use -fPIC flag for compiler when compiling >> objects that shall be later linked into dso. So, for lua case, -fPIC >> must be present on the cc -c command line. > This therefore strange, since this problem with lua occurs on machines, > where I've set "CFLAGS=" and "COPTFLAGS=" as in > /usr/share/examples/etc/make.conf and on one box, one box I accidentally > set those flags to "CFLAGS+=" and "COPTFLAGS+=" and there it works and > the -fPIC flag is set by the FreeBSD's port framework. > > So I guess there is a bug introduced with one of the last Mk-files updates. > As suggested by the "howto" for using newer GCC versions, http://www.freebsd.org/doc/en/articles/custom-gcc/article.html you are supposed to use CFLAGS+= to add additional compile flags. By the way, "-O2 -fno-strict-aliasing -pipe" are the default flags, that are used when CFLAGS is not set by the user. COPTFLAGS is used only to build the kernel and doing it with non-system GCC is not likely to be safe. Daniel