Re: ports head -r487783: on armv7 x11/pixman fails to build: /usr/bin/ld: error: can't create dynamic relocation R_ARM_V4BX against local symbol in readonly segment; recompile object files with -fPIC

Mark Millard via freebsd-x11 <[email protected]>
Newsgroups gmane.os.freebsd.devel.x11,gmane.os.freebsd.devel.ports
Message-ID <[email protected]>
[Looks like there are 2 stages involved in that
2mmjnk.txt file that I generated. Before
MACHINE_ARCH is explicitly assigned and after.]

On 2018-Nov-14, at 15:40, Mark Millard <marklmi at yahoo.com> wrote:

> [Evidence from inside poudriere bulk -j... -i ports-mgmt/pkg .
> Use of native /nxb-bin/. . . leads to MACHINE_ARCH being amd64
> instead of armv7 or the like. See later supporting material.]
> 
> On 2018-Nov-14, at 14:38, Bryan Drewery <[email protected]> wrote:
> 
>> On 11/14/18 2:35 PM, Mark Millard wrote:
>>> [Looking at package fallout logs: the official armv6 and armv7
>>> builds are using -O2 because of MACHINE_ARCH being defined
>>> because of qemu-user-static use. (mips too?) The logic in
>>> share/mk/sys.mk is not causing -O . An implication
>>> is that -O2 for armv6 and armv7 is probably far more tested
>>> than people generally expect. The share/mk/sys.mk change
>>> goes back to -r319861 2017-Jun-12 . Previously the logic
>>> would have caused -O use for armv6 or armv7 in MACHINE_ARCH .]
>> 
>> r319861 doesn't look related here.
> 
> # more /etc/make.conf 
> .sinclude "/etc/make.nxb.conf"
> USE_PACKAGE_DEPENDS=yes
> BATCH=yes
> WRKDIRPREFIX=/wrkdirs
> PORTSDIR=/usr/ports
> PACKAGES=/packages
> DISTDIR=/distfiles
> FORCE_PACKAGE=yes
> PACKAGE_BUILDING=yes
> PACKAGE_BUILDING_FLAVORS=yes
> MACHINE=arm
> MACHINE_ARCH=armv7
> ARCH=${MACHINE_ARCH}
> #### /usr/local/etc/poudriere.d/make.conf ####
> #### /usr/ports/Mk/Scripts/ports_env.sh ####
> _CCVERSION_9d218390=FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1) Target: armv7-unknown-freebsd13.0-gnueabihf Thread model: posix InstalledDir: /nxb-bin/usr/bin
> _ALTCCVERSION_9d218390=none
> _CXXINTERNAL_9c45a5b1=FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1) Target: armv7-unknown-freebsd13.0-gnueabihf Thread model: posix InstalledDir: /nxb-bin/usr/bin "/nxb-bin/usr/bin/ld" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld-elf.so.1" "--hash-style=both" "--enable-new-dtags" "-o" "a.out" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/lib/crtbegin.o" "-L/usr/lib" "/dev/null" "-lc++" "-lm" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/crtend.o" "/usr/lib/crtn.o"
> CC_OUTPUT_9d218390_58173849=yes
> CC_OUTPUT_9d218390_9bdba57c=yes
> CC_OUTPUT_9d218390_6a4fe7f5=yes
> CC_OUTPUT_9d218390_6bcac02b=yes
> CC_OUTPUT_9d218390_67d20829=yes
> CC_OUTPUT_9d218390_bfa62e83=yes
> CC_OUTPUT_9d218390_f0b4d593=yes
> CC_OUTPUT_9d218390_308abb44=yes
> CC_OUTPUT_9d218390_f00456e5=yes
> CC_OUTPUT_9d218390_65ad290d=yes
> CC_OUTPUT_9d218390_f2776b26=yes
> CC_OUTPUT_9d218390_b2657cc3=yes
> CC_OUTPUT_9d218390_380987f7=yes
> CC_OUTPUT_9d218390_160933ec=yes
> CC_OUTPUT_9d218390_fb62803b=yes
> _OBJC_CCVERSION_9d218390=FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1) Target: armv7-unknown-freebsd13.0-gnueabihf Thread model: posix InstalledDir: /nxb-bin/usr/bin
> _OBJC_ALTCCVERSION_9d218390=none
> ARCH=armv7
> OPSYS=FreeBSD
> _OSRELEASE=13.0-CURRENT
> OSREL=13.0
> OSVERSION=1300003
> PYTHONBASE=/usr/local
> _SMP_CPUS=32
> CONFIGURE_MAX_CMD_LEN=262144
> HAVE_PORTS_ENV=1
> #### Misc Poudriere ####
> GID=0
> UID=0
> PACKAGES=/packages
> 
> # more /etc/src.conf
> /etc/src.conf: No such file or directory
> 
> # more Makefile
> all:
>        echo ${MACHINE_ARCH}
>        echo ${MACHINE_CPUARCH}
>        echo ${CFLAGS}
> 
> # make
> echo armv7
> armv7
> echo arm
> arm
> echo -O2 -pipe
> -O2 -pipe
> 
> # grep -r "\-O2" /usr/src/share/mk/
> /usr/src/share/mk/sys.mk:CFLAGS		?=	-O2 -pipe
> 
> # grep -r "\-pipe" /usr/src/share/mk/
> /usr/src/share/mk/sys.mk:CFLAGS		?=	-O -pipe
> /usr/src/share/mk/sys.mk:CFLAGS		?=	-O2 -pipe
> 
> Those lines come from:
> 
> .if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
> CFLAGS          ?=      -O -pipe
> .else
> CFLAGS          ?=      -O2 -pipe
> .endif
> 
> So I used:
> 
> # make -dA 2>2mmjnk.txt 1>1mmjnk.txt
> 
> and looked for the first -pipe in 2mmjnk.txt. (It is also
> the first -O , in this case -O2 .)
> 
> . . .
> Got 'C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v[67])?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/' from '${__TO_CPUARCH}'}
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "mips(n32|64)?(el)?(hf)?"
> Modifier pattern: "mips"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "arm(v[67])?(eb)?"
> Modifier pattern: "arm"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "powerpc(64|spe)"
> Modifier pattern: "powerpc"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "riscv64(sf)?"
> Modifier pattern: "riscv"
> Result[MACHINE_ARCH] of :C is "amd64"
> lhs = "amd64", rhs = "arm", op = ==
> Got 'C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v[67])?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/' from '${__TO_CPUARCH}'}
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "mips(n32|64)?(el)?(hf)?"
> Modifier pattern: "mips"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "arm(v[67])?(eb)?"
> Modifier pattern: "arm"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "powerpc(64|spe)"
> Modifier pattern: "powerpc"
> Result[MACHINE_ARCH] of :C is "amd64"
> Applying[MACHINE_ARCH] :C to "amd64"
> Modifier pattern: "riscv64(sf)?"
> Modifier pattern: "riscv"
> Result[MACHINE_ARCH] of :C is "amd64"
> lhs = "amd64", rhs = "mips", op = ==
> ParseReadLine (172): 'CFLAGS            ?=      -O2 -pipe'
> Global:CFLAGS = -O2 -pipe
> 
> It looks like the poudriere builds based on /nxb-bin/. . .
> See the amd64 MACHINE_ARCH in the context that shows:
> 
> # uname -apKU
> FreeBSD FBSDamd64TR 13.0-CURRENT FreeBSD 13.0-CURRENT arm armv7 1300003 1300003


# grep "MACHINE_.*ARCH" 2mmjnk.txt
ParseReadLine (17): 'MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}}'
Global:MACHINE_CPUARCH = ${MACHINE_ARCH:${__TO_CPUARCH}}
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
Applying[MACHINE_ARCH] :C to "amd64"
Result[MACHINE_ARCH] of :C is "amd64"
ParseReadLine (12): 'MACHINE_ARCH=armv7'
Global:MACHINE_ARCH = armv7
ParseReadLine (13): 'ARCH=${MACHINE_ARCH}'
Global:ARCH = ${MACHINE_ARCH}
ParseReadLine (2): '	echo ${MACHINE_ARCH}'
ParseReadLine (3): '	echo ${MACHINE_CPUARCH}'
MACHINE_CPUARCH  = ${MACHINE_ARCH:${__TO_CPUARCH}}
MACHINE_ARCH     = armv7
Applying[MACHINE_ARCH] :C to "armv7"
Result[MACHINE_ARCH] of :C is "armv7"
Applying[MACHINE_ARCH] :C to "armv7"
Result[MACHINE_ARCH] of :C is "arm"
Applying[MACHINE_ARCH] :C to "arm"
Result[MACHINE_ARCH] of :C is "arm"
Applying[MACHINE_ARCH] :C to "arm"
Result[MACHINE_ARCH] of :C is "arm"
MACHINE_CPUARCH  = ${MACHINE_ARCH:${__TO_CPUARCH}}
MACHINE_ARCH     = armv7

Part of the issue is the ?= use from before the
explicit MACHINE_ARCH assignment blocks any later
?= attempt form changing the result.

I'll note that any of the following executing before the
explicitly MACHINE_ARCH assignment would apparently get
the amd64 value from the /nxb-bin/. . . context, just like
the .if conditional in under investigation:

# grep -r "^\..*MACHINE_ARCH" /usr/src/Makefile* /usr/src/share/mk/ /usr/ports/Mk/ | more
/usr/src/Makefile.inc1:.if ${MACHINE_ARCH} != ${BUILD_ARCH}
/usr/src/Makefile.inc1:.warning "To cross-build, set TARGET_ARCH ${MACHINE_ARCH} != ${BUILD_ARCH} ."
/usr/src/Makefile.inc1:.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
/usr/src/Makefile.inc1:.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BUILD_WITH_STRICT_TMPPATH} != 0
/usr/src/Makefile.inc1:.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
/usr/src/Makefile.inc1:.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
/usr/src/share/mk/bsd.arch.inc.mk:.elif exists(${.CURDIR}/Makefile.${MACHINE_ARCH})
/usr/src/share/mk/bsd.arch.inc.mk:.include "Makefile.${MACHINE_ARCH}"
/usr/src/share/mk/local.meta.sys.mk:.if empty(MACHINE_ARCH)
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "sparc64"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "powerpc"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "powerpcspe"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "powerpc64"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "sparc64"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "powerpc"
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH} == "sparc64"
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Mmips*el*} != ""
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Mmips64*} != ""
/usr/src/share/mk/bsd.cpu.mk:. elif ${MACHINE_ARCH:Mmipsn32*} != ""
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Mmips*hf}
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Marmv6*} != ""
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Marmv7*} != ""
/usr/src/share/mk/bsd.cpu.mk:. if ${MACHINE_ARCH:Marmv[67]*} == ""
/usr/src/share/mk/bsd.cpu.mk:.if ${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
/usr/src/share/mk/bsd.cpu.mk:.if ${MACHINE_ARCH} == "powerpcspe"
/usr/src/share/mk/bsd.cpu.mk:.if ${MACHINE_ARCH:Mriscv*sf}
/usr/src/share/mk/bsd.endian.mk:.if ${MACHINE_ARCH} == "aarch64" || \
/usr/src/share/mk/bsd.endian.mk:.elif ${MACHINE_ARCH} == "powerpc" || \
/usr/ports/Mk/Uses/gnustep.mk:.if ${MACHINE_ARCH} == "i386"

(I have not tried to figure out which have a chance of
executing before the MACHINE_ARCH explicit assignment.)

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-x11
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.