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.
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.
Created attachment 239624 [details] use CMake support CMAKE_ON helper doesn't work from within Mk/
^Triage: Reset Assignee after ports b5c25e6c4b7b
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.
> 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.)
Alexander, can you land this?
(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.
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.
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.
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.
(In reply to Alexander Leidinger from comment #10) Moin moin As it is off by default, I think we can get this in without an exp-run. Please go ahead. mfg Tobias
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=b40aa97071012f71a9c8937ef41d3153f070243f commit b40aa97071012f71a9c8937ef41d3153f070243f Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2024-05-14 08:35:00 +0000 Commit: Alexander Leidinger <netchild@FreeBSD.org> CommitDate: 2024-05-14 08:39:24 +0000 Mk/Features: WITH_PIE - add cmake support Use cmake specific options to enable position independent code generation. This fixes several ports (at least multimedia/cmrtlib, math/blas and math/lapack) which are build with cmake when WITH_PIE is enabled. PR: 268981 Approved by: portmgr Mk/Features/pie.mk | 4 ++++ 1 file changed, 4 insertions(+)
At netchild's request, I tested some Fortran ports with the proposed patch with WITH_PIE: most of them are safe, but I noticed 3 failures. 1) science/hdf5-110 Fails to configure: checking for Fortran libraries of gfortran13... -L/usr/local/lib/gcc13 -L/usr/local/lib -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.2.0 -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.2.0/../../../../../x86_64-portbld-freebsd15.0/lib -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.2.0/../../.. -lgfortran -lm -lssp_nonshared -lquadmath checking for dummy main to link with Fortran libraries... none checking for Fortran name-mangling scheme... lower case, underscore, no extra underscore checking if Fortran compiler supports intrinsic SIZEOF... no checking if Fortran compiler supports intrinsic C_SIZEOF... no checking if Fortran compiler supports intrinsic STORAGE_SIZE... no configure: error: Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE 2) math/mumps Linkage failure with MPI stuff (does not seems related to PIE, but it usually builds fine): gfortran13 -shared lr_common.o ana_omp_m.o ana_orderings_wrappers_m.o mumps_memory_mod.o mumps_static_mapping.o mumps_sol_es.o fac_future_niv2_mod.o mumps_comm_ibcast.o mumps_ooc_common.o double_linked_list.o fac_asm_build_sort_index_m.o fac_asm_build_sort_index_ELT_m.o omp_tps_common_m.o mumps_l0_omp_m.o front_data_mgt_m.o fac_maprow_data_m.o fac_descband_data_m.o fac_ibct_data_m.o ana_orderings.o ana_AMDMF.o bcast_errors.o estim_flops.o mumps_type_size.o mumps_type2_blocking.o mumps_version.o tools_common.o mumps_print_defined.o mumps_common.o mumps_pord.o mumps_metis.o mumps_metis64.o mumps_metis_int.o mumps_scotch.o mumps_scotch64.o mumps_scotch_int.o mumps_size.o mumps_io.o mumps_io_basic.o mumps_io_thread.o mumps_io_err.o ana_set_ordering.o mumps_numa.o mumps_thread.o mumps_save_restore_C.o -Wl,-soname,libmumps_common.so.5 -L../lib -L/usr/local/lib -lmetis -L../PORD/lib/ -lpord -L/lib -lesmumps -lscotch -lscotcherr -lz -lpthread -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc13 -L/usr/local/lib/gcc13 -pie -fstack-protector-strong -lgfortran -o ../lib/libmumps_common.so.5 /usr/local/bin/ld: /usr/lib/Scrt1.o: in function `_start': /usr/src/lib/csu/amd64/crt1_s.S:67: undefined reference to `main' /usr/local/bin/ld: mumps_static_mapping.o: in function `__mumps_static_mapping_MOD_mumps_compute_distrib': mumps_static_mapping.F:(.text+0x255c): undefined reference to `mpi_get_processor_name_' /usr/local/bin/ld: mumps_static_mapping.F:(.text+0x2803): undefined reference to `mpi_bcast_' /usr/local/bin/ld: mumps_static_mapping.F:(.text+0x2bd0): undefined reference to `mpi_bcast_' /usr/local/bin/ld: mumps_static_mapping.o: in function `__mumps_static_mapping_MOD_mumps_init_arch_parameters': mumps_static_mapping.F:(.text+0x3a07): undefined reference to `mpi_comm_rank_' /usr/local/bin/ld: mumps_static_mapping.F:(.text+0x3a51): undefined reference to `mpi_comm_rank_' /usr/local/bin/ld: mumps_static_mapping.F:(.text+0x3ed3): undefined reference to `mpi_allreduce_' /usr/local/bin/ld: bcast_errors.o: in function `mumps_propinfo_': bcast_errors.F:(.text+0x67): undefined reference to `mpi_allreduce_' /usr/local/bin/ld: tools_common.o: in function `mumps_abort_': tools_common.F:(.text+0x25): undefined reference to `mpi_abort_' /usr/local/bin/ld: tools_common.o: in function `mumps_secdeb_': tools_common.F:(.text+0x692): undefined reference to `mpi_wtime_' /usr/local/bin/ld: tools_common.o: in function `mumps_secfin_': tools_common.F:(.text+0x6b7): undefined reference to `mpi_wtime_' /usr/local/bin/ld: tools_common.o: in function `mumps_mem_centralize_': tools_common.F:(.text+0x9e6): undefined reference to `mpi_reduce_' /usr/local/bin/ld: tools_common.F:(.text+0xa2e): undefined reference to `mpi_reduce_' /usr/local/bin/ld: tools_common.F:(.text+0xa84): undefined reference to `mpi_reduce_' /usr/local/bin/ld: tools_common.o: in function `mumps_bcast_i8_': tools_common.F:(.text+0x1179): undefined reference to `mpi_bcast_' /usr/local/bin/ld: tools_common.o: in function `mumps_reducei8_': tools_common.F:(.text+0x11fe): undefined reference to `mpi_reduce_' /usr/local/bin/ld: tools_common.o: in function `mumps_allreducei8_': tools_common.F:(.text+0x1284): undefined reference to `mpi_allreduce_' /usr/local/bin/ld: tools_common.o: in function `mumps_get_proc_per_node_': tools_common.F:(.text+0x2558): undefined reference to `mpi_get_processor_name_' /usr/local/bin/ld: tools_common.F:(.text+0x27d1): undefined reference to `mpi_bcast_' /usr/local/bin/ld: tools_common.F:(.text+0x2b66): undefined reference to `mpi_bcast_' collect2: error: ld returned 1 exit status 3) net/openmpi Fails at configure: checking if Fortran compiler works... no ********************************************************************** * It appears that your Fortran compiler is unable to produce working * executables. A simple test application failed to properly * execute. Note that this is likely not a problem with Open MPI, * but a problem with the local compiler installation. More * information (including exactly what command was given to the * compiler and what error resulted when the command was executed) is * available in the config.log file in the Open MPI build directory. ********************************************************************** configure: error: Could not run a simple Fortran program. Aborting.