Bug 207324 - lang/lua52: on arm (rpi2), lapi.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' . . . recompile with -fPIC
Summary: lang/lua52: on arm (rpi2), lapi.o: relocation R_ARM_MOVW_ABS_NC against `a lo...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Some People
Assignee: Ian Lepore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-19 05:50 UTC by Mark Millard
Modified: 2016-02-20 19:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-02-19 05:50:57 UTC
When attempting to build devel/kyua on a rpi2b under projects/clang380-import -r295601 via portmaster -DK devel/kyua the attempt failed in lang/lua52 with:

--- lapi.o ---
/usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access -B/usr/local/arm-gnueabi-freebsd/bin/ -Wall -DLUA_COMPAT_ALL  -pipe -mfloat-abi=softfp  -isystem /usr/local/include -g -fno-strict-aliasing -I/usr/local/include -isystem /usr/local/include -DLUA_USE_LINUX -c lapi.c -o lapi.o
. . .
--- liblua-5.2.so ---
/usr/local/arm-gnueabi-freebsd/bin/ld: lapi.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
lapi.o: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [liblua-5.2.so] Error code 1



(Side note: Even buildworld/buildkernel used: -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access based on my src.conf for the rpi2.)
Comment 1 Ian Lepore freebsd_committer 2016-02-20 03:34:24 UTC
Confirmed, all the lua ports fail to build on armv6 when CPUTYPE or -march has been set to a non-default value.  I think we need to use -fPIC on all arches, it's the right thing to do considering the files are being compiled into a shared lib, and only a couple arches can accidentally do that without -fPIC.

I'll get the change made in all 3 lua ports.
Comment 2 commit-hook freebsd_committer 2016-02-20 19:20:31 UTC
A commit references this bug:

Author: ian
Date: Sat Feb 20 19:19:51 UTC 2016
New revision: 409263
URL: https://svnweb.freebsd.org/changeset/ports/409263

Log:
  Use -fPIC on all arches; lua builds the object files into a shared lib.

  Since the object files get built into a shared lib, using -fPIC on all
  arches is the right thing to do, instead of adding it to each new arch that
  comes along which doesn't accidentally allow non-PIC modules in shared libs.

  PR:		207324
  Approved by:	mat(mentor)
  Differential Revision:	https://reviews.freebsd.org/D5362

Changes:
  head/lang/lua51/Makefile
  head/lang/lua52/Makefile
  head/lang/lua53/Makefile