Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2011 13:19:25 +0100
From:      "O. Hartmann" <ohartman@zedat.fu-berlin.de>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        Ed Schouten <ed@80386.nl>, Current FreeBSD <freebsd-current@freebsd.org>, Ports FreeBSD <freebsd-ports@freebsd.org>
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
Message-ID:  <4EFC5ACD.5010701@zedat.fu-berlin.de>
In-Reply-To: <20111229115904.GH50300@deviant.kiev.zoral.com.ua>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig8486F0C1902EA172FA10AF3C
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Am 12/29/11 12:59, schrieb Kostik Belousov:
> On Thu, Dec 29, 2011 at 12:19:40PM +0100, O. Hartmann wrote:
>> Am 12/29/11 11:48, schrieb Rainer Hurling:
>>> On 28.12.2011 19:31 (UTC+1), Kostik Belousov wrote:
>>>> On Wed, Dec 28, 2011 at 07:21:00PM +0100, O. Hartmann wrote:
>>>>> Am 12/28/11 19:10, schrieb Ed Schouten:
>>>>>> * Rainer Hurling<rhurlin@gwdg.de>, 20111228 17:31:
>>>>>>> error: macro "_Static_assert" passed 3 arguments, but takes just =
2
>>>>>>> In file included from
>>>>>>> /usr/ports/lang/gcc46/work/gcc-4.6-20111209/libstdc++-v3/include/=
precompiled/stdc++.h:103:0:
>>>>>>>
>>>>>>
>>>>>> Hmmm... This seems to apply to my changes. I will look into this
>>>>>> tomorrow. Thanks for the report!
>>>>>>
>>>>>
>>>>>
>>>>> Be aware that the error produced by the linker I mentioned in the
>>>>> initial post occurs on FreeBSD 10 as well as FreeBSD 9.0.
>>>>>
>>>>> I already filed a PR about the problem of a non compiling lang/gcc4=
6
>>>>> today (ports/163672: lang/gcc46: make failed for lang/gcc46). For t=
est
>>>>> puproses, I rebuild gcc46 on our FreeBSD 9.0 boxes - without any
>>>>> problem.
>>>>>
>>>>> I guess, the commit r228902 has been done to FreeBSD 10.0 and not 9=
=2E0.
>>>>
>>>> Obviously, linker error during the compilation of third-party softwa=
re
>>>> has nothing to do with compiler error occuring when building gcc.
>>>>
>>>> Do people ever read the texts of the messages ?
>>>
>>> Kostik, probably you are right. I had read the messages, but there ar=
e
>>> some strange errors with gcc46 on head for two days now, which leaded=
 me
>>> in the wrong direction. So sorry for erroneously 'hijacking' this thr=
ead
>>> with another problem most certain only existing in head.
>>>
>>>
>>> I found another trail, which hopefully is more usefull for solving th=
e
>>> problem Oliver described.
>>>
>>> Whe I try to build lang/lua I get this error:
>>>
>>> [..snip..]
>>> cc -o liblua.so -O2 -fno-strict-aliasing -pipe -msse3  -Wall
>>> -DLUA_USE_LINUX   -shared -Wl,-soname=3Dliblua-5.1.so.1 lapi.o lcode.=
o
>>> ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes=
=2Eo
>>> lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
>>> lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o
>>> lstrlib.o loadlib.o linit.o
>>> ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o
>>> llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltabl=
e.o
>>> ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o
>>> lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o
>>> ranlib liblua.a
>>> cc -o lua  lua.o liblua.a -lm -Wl,-E -lreadline
>>> cc -o luac  luac.o print.o liblua.a -lm -Wl,-E -lreadline
>>> /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
>>> *** Error code 1
>>>
>>>
>>> It also gives a linker error, almost the same relocation is named. Th=
is
>>> does only happen with option '-msse3' enabled in /etc/make.conf:
>>>
>>> CFLAGS=3D -O2 -fno-strict-aliasing -pipe -msse3
>>>
>>> Using CLFAGS without -msse3 (default) works well:
>>>
>>> CFLAGS=3D -O2 -fno-strict-aliasing -pipe
>>>
>>>
>>> The systems processor, were this happens, is a
>>>
>>> CPU: AMD Phenom(tm) II X6 1090T Processor (3214.32-MHz K8-class CPU)
>>>   Origin =3D "AuthenticAMD"  Id =3D 0x100fa0  Family =3D 10  Model =3D=
 a
>>> Stepping =3D 0
>>> Features=3D0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTR=
R,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
>>>
>>>   Features2=3D0x802009<SSE3,MON,CX16,POPCNT>
>>>   AMD
>>> Features=3D0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+=
,3DNow!>
>>>   AMD
>>> Features2=3D0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OS=
VW,IBS,SKINIT,WDT>
>>>
>>>   TSC: P-state invariant, performance statistics
>>>
>>> FreeBSD 10-CURRENT (amd64) r228920
>>>
>>> In hope of a more belonging posting,
>>> Rainer
>>> _______________________________________________
>>
>>
>> WOW!
>>
>> I tried lang/lua on FreeBSD 9.0-PRE and see exactly this error:
>>
>> clang -O2  -fno-strict-aliasing -pipe -march=3Dcore2 -Wall -DLUA_USE_L=
INUX
>> -c print.c
>> clang -o liblua.so -O2  -fno-strict-aliasing -pipe -march=3Dcore2 -Wal=
l
>> -DLUA_USE_LINUX   -shared -Wl,-soname=3Dliblua-5.1.so.1 lapi.o lcode.o=

>> ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.=
o
>> lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
>> lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o
>> lstrlib.o loadlib.o linit.o
>> /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
>> ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o
>> llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable=
=2Eo
>> ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o
>> lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o
>> ranlib liblua.a
>> 1 error
>> *** Error code 2
>> 1 error
>> *** Error code 2
>> 1 error
>> *** Error code 1
>>
>> Stop in /usr/ports/lang/lua.
>>
>> =3D=3D=3D>>> make failed for lang/lua
>> =3D=3D=3D>>> Aborting update
>>
>>
>>
>> On FreeBSD 10.0-CURRENT I see this:
>> clang -O2 -fno-strict-aliasing -pipe -march=3Dcore2 -Wall -DLUA_USE_LI=
NUX
>> -c linit.c
>> ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o
>> llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable=
=2Eo
>> ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o
>> lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o
>> ranlib liblua.a
>> clang -O2 -fno-strict-aliasing -pipe -march=3Dcore2 -Wall -DLUA_USE_LI=
NUX
>> -c lua.c
>> clang -o lua  lua.o liblua.a -lm -Wl,-E -lreadline
>> clang -O2 -fno-strict-aliasing -pipe -march=3Dcore2 -Wall -DLUA_USE_LI=
NUX
>> -c luac.c
>> clang -O2 -fno-strict-aliasing -pipe -march=3Dcore2 -Wall -DLUA_USE_LI=
NUX
>> -c print.c
>> clang -o luac  luac.o print.o liblua.a -lm -Wl,-E -lreadline
>> clang -o liblua.so -O2 -fno-strict-aliasing -pipe -march=3Dcore2 -Wall=

>> -DLUA_USE_LINUX   -shared -Wl,-soname=3Dliblua-5.1.so.1 lapi.o lcode.o=

>> ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.=
o
>> lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
>> lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o
>> lstrlib.o loadlib.o linit.o
>> /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.
>>
>> =3D=3D=3D>>> make failed for lang/lua
>> =3D=3D=3D>>> Aborting update
>>
>> Terminated
>> Terminated
>>
>> This is very strange!
> What is strange ? It is exactly the same problem as in the first messag=
e
> started this thread. You must use -fPIC flag for compiler when compilin=
g
> 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=3D" and "COPTFLAGS=3D" as in
/usr/share/examples/etc/make.conf and on one box, one box I accidentally
set those flags to "CFLAGS+=3D" and "COPTFLAGS+=3D" and there it works an=
d
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 update=
s.

>=20
> Again, -msse3 is not relevant there. Presense of -msse3 flag might
> casually change compiler output to generate the relocation unsuitable
> for dso, but compiler has full permit to do so without -msse3 as well.
>=20
> Issue with broken gcc 4.6 build is different, it is indeed due to recen=
t
> changes in system headers due to C11 compliance work. Hopefully, Ed wil=
l
> fix it.


--------------enig8486F0C1902EA172FA10AF3C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQEcBAEBAgAGBQJO/FrNAAoJEOgBcD7A/5N8W1gH/0avBCfZqwQrMTI19kefBPmg
JVxfjGrUrFAuS31aGd6ss30uiDvbkez3BIilSzJAXBTkKtEn242bxjlia837/zMa
uvC6YgY2WSnNjbQakh46rcqZvs56mAfnaAO6rj9CYH3ZGuVyVF/lxYC4n9hedO/2
L9NJSjh0Pt0o8AbdyiivaTOOK7+2FWR+bP+V/eHRP43T8ZBRuo8wwxAXO8wonp8r
/2+15Jn9vwXNznP/rUsBUGkkkXOUN+bECygkgSwzH1NIFdWhbdgyQPHgMzU1uM/X
oXJ2Ycq0J8F7R+LHD/pcS9nGlwANOvVIq6+r+PLFpuQkNJzKkNO6SguXPn6PxaY=
=XAJh
-----END PGP SIGNATURE-----

--------------enig8486F0C1902EA172FA10AF3C--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EFC5ACD.5010701>