|
From: Roger R. <w3...@co...> - 2025-11-12 21:09:33
|
HI Brian,
If you didn't get this fixed, then try substituting the following code
for the "# Fortran setup" block in CMakeLists.txt in the main source
directory. If you try that please let me know whether or not it solves
your issue. If so, we'll add the change to the official code. If not,
I have a more complicated (and therefore less desirable) fix that could
be done.
Thanks and 73,
Roger
W3SZ
--------------------
#
# Fortran setup
#
set (General_FFLAGS "-Wall -Wno-conversion -Wno-c-binding-type
-fno-second-underscore")
# FFLAGS depend on the compiler
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER}
NAME)
if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
# gfortran-specific flags
if (CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}
-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if (CMAKE_OSX_SYSROOT)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -isysroot
${CMAKE_OSX_SYSROOT}")
endif()
# Add assembler flag to disable executable stack
if (UNIX AND Fortran_COMPILER_NAME MATCHES "gfortran.*")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wa,--noexecstack")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}
-fbounds-check -funroll-all-loops -fno-f2c
-ffpe-summary=invalid,zero,overflow,underflow ${General_FFLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -ggdb
-O0 -fbacktrace -fcheck=all -fbounds-check -fno-f2c
-ffpe-summary=invalid,zero,overflow,underflow ${General_FFLAGS}")
# FPE traps currently disabled in Debug configuration builds until
# we decide if they are meaningful, without these FP instructions
# run in nonstop mode and do not trap
#set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}
${CMAKE_Fortran_FLAGS_DEBUG} -ffpe-trap=invalid,zero,overflow")
elseif (Fortran_COMPILER_NAME MATCHES "ifort.*")
# Intel Fortran
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}
-f77rtl ${General_FFLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -f77rtl
${General_FFLAGS}")
elseif (Fortran_COMPILER_NAME MATCHES "g77")
# g77
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}
-funroll-all-loops -fno-f2c -m32 ${General_FFLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}
-fbounds-check -fno-f2c -m32 ${General_FFLAGS}")
else()
message("CMAKE_Fortran_COMPILER full path: ${CMAKE_Fortran_COMPILER}")
message("Fortran compiler: ${Fortran_COMPILER_NAME}")
message("No optimized Fortran compiler flags are known, we just try
-O3...")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O3
${General_FFLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -g
-fbacktrace -fcheck=all -fbounds-check ${General_FFLAGS}")
endif()
--------------------
On 11/3/2025 8:03 AM, Brian Morrison via wsjt-devel wrote:
> On Mon, 13 Oct 2025 18:16:48 +0200
> Jaroslav Škarvada via wsjt-devel <wsj...@li...>
> wrote:
>
>> Hi,
>>
>> linux distros are trying to harden with the noexecstack and the
>> execstack in decoder.f90 is causing problems. E.g. [1], [2]. It seems
>> the g++ linker doesn't allow combination of binaries with exec/noexec
>> stacks [1], so the whole binary needs to be compiled with the
>> execstack which may be unacceptable for some distros. The patch
>> proposed in [1] uses mprotect, should something similar be upstreamed?
>>
>> Build failure of wsjtx-2.7.0 with the gcc-c++-15.2.1 in Fedora
>> rawhide: [81%] Building Fortran object
>> qmap/libqmap/CMakeFiles/qmap_impl.dir/f77_wisdom.f.o
>> cd
>> /builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/redhat-linux-build/qmap/libqmap
>> && /usr/bin/gfortran -DBIGSYM=1 -DBOOST_ALL_DYN_LINK
>> -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_DYN_LINK
>> -DBOOST_CHRONO_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK
>> -DBOOST_FILESYSTEM_NO_LIB -DBOOST_LOG_DYN_LINK -DBOOST_LOG_NO_LIB
>> -DBOOST_LOG_SETUP_DYN_LINK -DBOOST_LOG_SETUP_NO_LIB
>> -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK
>> -DBOOST_THREAD_NO_LIB -DCMAKE_BUILD -DFOX_OTP -DQT5 -DQT_CORE_LIB
>> -DQT_NO_DEBUG -DUNIX
>> -I/builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/redhat-linux-build/qmap/libqmap
>> -I/builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/qmap/libqmap
>> -I/builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/redhat-linux-build/qmap/libqmap/qmap_impl_autogen/include
>> -I/builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/redhat-linux-build
>> -I/usr/include -I/usr/include/qt5 -I/usr/include/qt5/QtCore
>> -I/usr/lib64/qt5/mkspecs/linux-g++ -O2 -fexceptions -g
>> -grecord-gcc-switches -pipe -Wall
>> -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
>> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
>> -fstack-protector-strong
>> -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64
>> -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
>> -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer
>> -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules -DNDEBUG
>> -fbounds-check -funroll-all-loops -fno-f2c
>> -ffpe-summary=invalid,zero,overflow,underflow -Wall -Wno-conversion
>> -fno-second-underscore -fvisibility=hidden -fPIC -c
>> /builddir/build/BUILD/wsjtx-2.7.0-build/wsjtx-2.7.0/wsjtx/qmap/libqmap/f77_wisdom.f
>> -o CMakeFiles/qmap_impl.dir/f77_wisdom.f.o [ 81%] Linking CXX
>> executable ldpcsim240_74 /usr/bin/cmake -E cmake_link_script
>> CMakeFiles/ldpcsim240_74.dir/link.txt --verbose=1
>> /usr/bin/ld: error: decoder.f90.o: is triggering the generation of an
>> executable stack (because it has an executable .note.GNU-stack
>> section)
>> /usr/bin/ld: failed to set dynamic section sizes: no error
>> collect2: error: ld returned 1 exit status
>>
>> thanks & regards
>>
>> Jaroslav
>>
>> [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278939
>> [2] https://bugzilla.redhat.com/show_bug.cgi?id=2385733
> Any update on this Jaroslav, or indeed anyone else? It's a bit of a
> nightmare in Fedora at least.
>
|