Bug 240850 - sysutils/coreutils fails to build with PIE
Summary: sysutils/coreutils fails to build with PIE
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-27 01:44 UTC by Miyashita Touka
Modified: 2022-11-02 16:51 UTC (History)
6 users (show)

See Also:
lwhsu: maintainer-feedback? (jharris)


Attachments
build log (634.00 KB, text/plain)
2019-09-27 01:44 UTC, Miyashita Touka
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miyashita Touka 2019-09-27 01:44:25 UTC
Created attachment 207865 [details]
build log

The coreutils port fails in the package stage with the following error on 12-STABLE amd64:

gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/coreutils/work/coreutils-8.31'
strip: open /wrkdirs/usr/ports/sysutils/coreutils/work/stage/usr/local/libexec/coreutils/libstdbuf.so failed: No such file or directory
*** Error code 1

To reproduce:
1) enable WITH_PIE=yes in src.conf and rebuild (if it's not default)
2) set kern.elf64.aslr.enable and kern.elf64.aslr.pie_enable sysctls to 1
3) add the following to make.conf:
CFLAGS+= -fPIE
CXXFLAGS+= -fPIE
LDFLAGS+= -pie
4) build the port

Perhaps it just needs an updated plist file.
Comment 1 jharris 2019-10-08 19:17:33 UTC
Sorry, I'm not setup to duplicate/test this.

Please send a patch that a committer can check for correctness.

Thanks.
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2020-06-16 22:33:29 UTC
Is this still happending?
Comment 3 jharris 2020-06-16 23:47:53 UTC
(In reply to Li-Wen Hsu from comment #2)

No idea - I'm not setup to test this...
Comment 4 dewayne 2020-06-18 13:03:50 UTC
(In reply to Li-Wen Hsu from comment #2)
Yes. The package fails to build with -fPIE and -pie on "FreeBSD 12.1-STABLE #0 r362003M: Thu Jun 11"
Comment 5 dewayne 2020-07-04 06:39:53 UTC
(In reply to dewayne from comment #4)
Just to clarify.  I can successfully build coreutils packages on both i386 (march=prescott) and amd64 (march=haswell).

Using CFLAGS+=-fPIE and LDFLAGS+=-fpie (per Miyashita's comment), I can build and install corefiles (on both i386 and amd64), but when a package is attempted these prevent the package:

pkg-static: Unable to access file /usr/ports/sysutils/coreutils/work/stageusr/local/bin/gstdbuf:No such file or directory
pkg-static: Unable to access file /usr/ports/sysutils/coreutils/work/stageusr/local/libexec/coreutils/libstdbuf.so:No such file or directory
pkg-static: Unable to access file /usr/ports/sysutils/coreutils/work/stageusr/local/man/man1/gstdbuf.1.gz:No such file or directory
*** Error code 1