Created attachment 346038 [details] build log On my hardened ~amd64 system I tried to merge gmp-ecm. This resulted in the following error after starting the test suite. make[1]: Leaving directory `/var/tmp/portage/sci-mathematics/gmp-ecm-6.4.4-r1/work/ecm-6.4.4' ./test.pp1 ./ecm /var/tmp/portage/sci-mathematics/gmp-ecm-6.4.4-r1/work/ecm-6.4.4/.libs/ecm: error while loading shared libraries: libecm.so.0: cannot enable executable stack as shared object requires: Permission denied ############### ERROR ############### Expected return code 8 but got 127 make: *** [check] Error 1
Created attachment 346040 [details] emerge --info
There is an "append-ldflags "-Wl,-z,noexecstack" in the ebuild to take care of this problem. Unfortunately it doesn't seem to work. I cannot that this flag is used at all during linking.
OK appending the LDFLAGS during src_install is not working because it is not picked up by emake. Calling "emake LDFLAGS="${LDFLAGS}"" instead of plain emake will work. But it is even better to move the append-flags call into src_configure where LDFLAGS will be picked up by configure.
(In reply to Francois Bissey from comment #3) > OK appending the LDFLAGS during src_install is not working because it is not > picked up by emake. Calling "emake LDFLAGS="${LDFLAGS}"" instead of plain > emake will work. But it is even better to move the append-flags call into > src_configure where LDFLAGS will be picked up by configure. move append-ldflags "-Wl,-z,noexecstack" from src_compile to src_configure (before econf) works. Thank you!
Well that was a blast from the past. I have a newer ebuild in the sage-on-gentoo overlay. Including gmp-emc-7.0 now. It is quite complicated to get upstream to fix this nicely. The assembly files are generated and we want to insert the proper assembly statement only in key architectures. It is quite subtle.
Got it. It's indeed a bit hard to handle such type programs. I have both overlay version and official static-linked version now. So... we can close this bug ?
Well, it is kind of definitely fixed upstream in 7.0.4. They add the flag on linux during configure. I would have favored the assembly to be fixed but that was the easiest way. 7.0.4 is available in the sage-on-gentoo overlay but currently in package.mask because sage doesn't work yet with that version (interface change).
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bbb8b0f1cb8b3c8a42775c5077e610ad7f4f558 commit 4bbb8b0f1cb8b3c8a42775c5077e610ad7f4f558 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-02-28 13:34:04 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2020-02-28 13:36:47 +0000 sci-mathematics/gmp-ecm: new EAPI=7 revision. The dependencies and build system of gmp-ecm have been improved over the years, and much of the cruft in the ebuild could simply be deleted. This commit adds an -r2, based on François Bissey's ebuild in the sage-on-gentoo overlay, to modernize things. I've manually verified the diff for sanity, and the test suite passes for me on amd64. Closes: https://bugs.gentoo.org/466498 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r2.ebuild | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+)