Bug 268981

Summary: mk/Features/pie.mk: add cmake support (multimedia/cmrtlib: not WITH_PIE safe)
Product: Ports & Packages Reporter: Alexander Leidinger <netchild>
Component: Individual Port(s)Assignee: Alexander Leidinger <netchild>
Status: Open ---    
Severity: Affects Some People CC: arrowd, emaste, portmgr
Priority: --- Flags: netchild: maintainer-feedback? (portmgr)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 272898    
Attachments:
Description Flags
use CMake support
none
use CMake support jbeich: maintainer-approval? (portmgr)

Description Alexander Leidinger freebsd_committer freebsd_triage 2023-01-16 11:27:49 UTC
Hi,

building the port with WITH_PIE makes it fail (error message tells "-pie unused" during compilation). Until this is fixed, the port should get PIE_UNSAFE=yes in the Makefile (this fixes the build for me).

Bye,
Alexander.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2023-01-21 16:24:34 UTC
Created attachment 239623 [details]
use CMake support

WITH_PIE should be using https://cmake.org/cmake/help/latest/variable/CMAKE_POSITION_INDEPENDENT_CODE.html instead of *blindly* forcing LDFLAGS+=-pie.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2023-01-21 16:27:51 UTC
Created attachment 239624 [details]
use CMake support

CMAKE_ON helper doesn't work from within Mk/
Comment 3 Jan Beich freebsd_committer freebsd_triage 2023-05-04 05:09:47 UTC
^Triage: Reset Assignee after ports b5c25e6c4b7b
Comment 4 Gleb Popov freebsd_committer freebsd_triage 2024-01-08 17:40:46 UTC
The change makes sense overall and also fixes the problem with this specific port.

I'd say let's get this in, but it probably would invalidate a lot of exp-run results in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272898

Thanks for working on this, Jan, please push this in.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2024-01-08 17:55:15 UTC
> it probably would invalidate a lot of exp-run results

If this fixes a general class of problem we can just request another exp-run in 272898 after it's in.  (That said it looks like the biggest issues in the exp-run are caused by gfortran.)
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2024-04-09 06:37:50 UTC
Alexander, can you land this?
Comment 7 Alexander Leidinger freebsd_committer freebsd_triage 2024-04-09 07:32:00 UTC
(In reply to Gleb Popov from comment #6)

I assume you don't mean my initial workaround, but the CMake part of jbeich. Correct?

If correct: I further assume this is not a request of blindly committing that sane-looking (I don't know enough about cmake to be sure, but it looks at least sane) patch, but about working with portmgr about an exp-run and so on. Correct?

If my understanding is correct: yes, I can do that.
Comment 8 Gleb Popov freebsd_committer freebsd_triage 2024-04-09 07:34:35 UTC
Yes, I was talking about Jan's patch, sorry.

However, I don't think it requires an exp-run because PIE is turned off by default. It merely will improve the situation for the consecutive WITH_PIE=yes exp-run in future.
Comment 9 Alexander Leidinger freebsd_committer freebsd_triage 2024-04-09 07:55:37 UTC
The patch fixes the PIE build of multimedia/cmrtlib, math/blas and math/lapack (those cmake ports which failed PIE build in my own poudriere runs).

I assume this will fix a lot of the cmake-using ports. This also solves Bug 268985.
Comment 10 Alexander Leidinger freebsd_committer freebsd_triage 2024-04-09 08:01:29 UTC
portmgr, is an PIE-enabled exp-run needed, or do you want to do one anyway, or can I commit this? For a validation see the comment above this one.