Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#59973 closed defect (fixed)

cmake-1.1 portgroup debug variant adds -fno-limit-debug-info before port has a chance to specify compiler

Reported by: TheLastLovemark Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: haspatch Cc: mascguy (Christopher Nielsen)
Port:

Description (last modified by TheLastLovemark)

I tried to install flann with: sh-3.2# port -vd install flann +gcc9 +debug +openmpi +python37

which gave me this debug error message:

-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /opt/local/bin/mpicc-openmpi-gcc9
-- Check for working C compiler: /opt/local/bin/mpicc-openmpi-gcc9 -- broken
CMake Error at /opt/local/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/opt/local/bin/mpicc-openmpi-gcc9"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_283d7/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_283d7.dir/build.make CMakeFiles/cmTC_283d7.dir/build
    Building C object CMakeFiles/cmTC_283d7.dir/testCCompiler.c.o
    /opt/local/bin/mpicc-openmpi-gcc9   -pipe -Os -g -fno-limit-debug-info -DDEBUG -I/opt/local/include  -arch x86_64 -mmacosx-version-min=10.13   -o CMakeFiles/cmTC_283d7.dir/testCCompiler.c.o   -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/build/CMakeFiles/CMakeTmp/testCCompiler.c
    gcc-mp-9: error: unrecognized command line option '-fno-limit-debug-info'
    make[1]: *** [CMakeFiles/cmTC_283d7.dir/testCCompiler.c.o] Error 1
    make: *** [cmTC_283d7/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


-- Configuring incomplete, errors occurred!
See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/build/CMakeFiles/CMakeOutput.log".
See also "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/build/CMakeFiles/CMakeError.log".
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev flann-1.9.1 -DBUILD_MATLAB_BINDINGS=OFF -DBUILD_CUDA_LIB=OFF -DUSE_MPI=ON -DCMAKE_STRIP:FILEPATH=/bin/echo -DPYTHON_EXECUTABLE=/opt/local/bin/python3.7 -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DCMAKE_OSX_SYSROOT="/" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_flann/flann/work/flann-1.9.1 
Exit code: 1
Error: Failed to configure flann: configure failure: command execution failed

Initially I did not have an mpi selection set.

I changed that with:

sh-3.2# port select --set mpi openmpi-gcc9-fortran
Selecting 'openmpi-gcc9-fortran' for 'mpi' succeeded. 'openmpi-gcc9-fortran' is now active.

which yelded:

$ port select --summary
Name       Selected              Options
====       ========              =======
clang      mp-clang-9.0          mp-clang-3.7 mp-clang-9.0 none
cython     cython37              cython27 cython37 cython38 none
gcc        mp-gcc9               mp-gcc5 mp-gcc6 mp-gcc7 mp-gcc8 mp-gcc9 none
ipython    py37-ipython          py37-ipython py38-ipython none
ipython3   py37-ipython          py37-ipython py38-ipython none
llvm       mp-llvm-9.0           mp-llvm-3.7 mp-llvm-7.0 mp-llvm-8.0 mp-llvm-9.0 none
mpi        openmpi-gcc9-fortran  mpich-mp-fortran openmpi-clang90-fortran openmpi-gcc9-fortran openmpi-mp-fortran none
nosetests  nosetests37           nosetests27 nosetests37 nosetests38 none
pip        pip37                 pip27 pip37 pip38 none
pip2       pip27                 pip27 none
pip3       pip37                 pip37 pip38 none
pygments   py37-pygments         py27-pygments py37-pygments py38-pygments none
pytest     pytest37              pytest37 pytest38 none
python     python37              python27 python27-apple python37 python38 none
python2    python27              python27 python27-apple none
python3    python37              python37 python38 none
sphinx     py37-sphinx           py27-sphinx py37-sphinx py38-sphinx none
wxWidgets  none                  wxWidgets-3.0 none

I ran sh-3.2# port -vd install flann +gcc9 +debug +openmpi +python37 again, but it still failed.

The log file is attached.

Thanks for all your help!

Attachments (1)

flann_main.log (122.7 KB) - added by TheLastLovemark 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by TheLastLovemark

Attachment: flann_main.log added

comment:1 Changed 5 years ago by TheLastLovemark

Description: modified (diff)

comment:2 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Owner: set to ryandesign
Port: flann removed
Status: newaccepted
Summary: broken mpicc-openmpi-gcc9 causes flann +gcc9 +debug +openmpi +python37 build failurecmake-1.1 portgroup debug variant adds -fno-limit-debug-info before port has a chance to specify compiler

It has nothing to do with openmpi, nor even with flann. The problem appears to be that the flag -fno-limit-debug-info is being supplied to gcc-mp-9, and that is not a flag that gcc understands; it is a clang-specific flag, as far as I have been able to determine.

The -fno-limit-debug-info flag is coming from the cmake-1.1 portgroup, which intends to add that flag when the +debug variant is set (which it is in your case) and the compiler is clang (which is not supposed to be the case here). But clang is the default compiler. It seems that the cmake-1.1 portgroup is checking what the compiler is before the port has had a chance to specify what compiler it wants, so the cmake-1.1 portgroup is seeing the default compiler rather than the one the port ultimately chose.

If you weren't using both the +debug variant and a gcc variant, you wouldn't see this problem, so if you can do without one or the other that would be a workaround.

Putting everything that the debug variant does within a pre-configure { ... } block seems to work for me to fix this specific problem, though I don't know if it'll cause other problems. I've submitted https://github.com/macports/macports-ports/pull/6171 to fix this.

FYI, anything you do with sudo port select is for your own benefit on the command line. Other ports you install should not be influenced by what you have selected. (If they are, it is a bug in that port.)

comment:3 Changed 5 years ago by TheLastLovemark

I was going to ask how to do the pre-configure { ... } block solution, but if it could cause problems later on, I'll wait for a more permanent solution.

Thanks for the update.

comment:4 in reply to:  3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to TheLastLovemark:

I was going to ask how to do the pre-configure { ... } block solution,

Well you can look at the PR if you want to know how I did that.

but if it could cause problems later on, I'll wait for a more permanent solution.

I don't know if there is any other more permanent solution. It's just that portgroups can interact with each other in unexpected ways, such as the unexpected way in which the cmake 1.1 portgroup's debug variant here did interact unexpectedly with the way that the compilers 1.0 portgroup works. I simply don't know if making this change will cause problems for other combinations of portgroup or esoteric portfiles. Unless somebody looks at my change and can immediately see some way in which it will cause a problem, we probably won't know until we merge it and then later get bug reports.

comment:5 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In e35120b701a150f19c62afed12abc2967cb23939/macports-ports (master):

cmake-1.1: debug variant wait until pre-configure

The debug variant was inspecting the compiler before a port had a chance
to override it, resulting in the clang-specific -fno-limit-debug-info
flag being passed to non-clang compilers, resulting in failure.

Closes: #59973

comment:6 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

In e35120b701a150f19c62afed12abc2967cb23939/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

cmake-1.1: debug variant wait until pre-configure

The debug variant was inspecting the compiler before a port had a chance
to override it, resulting in the clang-specific -fno-limit-debug-info
flag being passed to non-clang compilers, resulting in failure.

Closes: #59973

comment:7 Changed 4 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added
Note: See TracTickets for help on using tickets.