Opened 5 years ago

Closed 5 years ago

#59329 closed defect (fixed)

mpich-default: "error: Aborting because C++ compiler does not work"

Reported by: Schamschula (Marius Schamschula) Owned by: dstrubbe (David Strubbe)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), aaschwanden (Andy Aschwanden)
Port: mpich openmpi

Description

While installing an octave package under Mojave (Xcode 10.3), after installing libgcc9 and gcc9,

I get

configure:46412: error: Aborting because C++ compiler does not work.  If you do not need a C++ compiler, configure with --disable-cxx

This is the second machine with this error. Full log attached.

Attachments (1)

mpich-default-config.log.zip (40.3 KB) - added by Schamschula (Marius Schamschula) 5 years ago.

Download all attachments as: .zip

Change History (13)

Changed 5 years ago by Schamschula (Marius Schamschula)

comment:1 Changed 5 years ago by dstrubbe (David Strubbe)

I'm not sure this is a problem of mpich per se. The key lines are:

configure:46366: checking whether the C++ compiler /usr/bin/clang++ can build an executable
configure:46395: /usr/bin/clang++ -o conftest  -pipe -stdlib=libstdc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64  -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_mpich/mpich-default/work/mpich-3.3.1/src/mpl/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_mpich/mpich-default/work/mpich-3.3.1/src/mpl/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_mpich/mpich-default/work/mpich-3.3.1/src/openpa/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_mpich/mpich-default/work/mpich-3.3.1/src/openpa/src -D_REENTRANT -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_mpich/mpich-default/work/mpich-3.3.1/src/mpi/romio/include -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 conftest.cpp  >&5
clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:46395: $? = 1

comment:2 Changed 5 years ago by Schamschula (Marius Schamschula)

comment:3 Changed 5 years ago by gjolleyrogers (Garry Jolley-Rogers)

+1.

Encountered after I decided to reinstall all ports fresh. osx 10.14 Xcode 11.

double plus frustrating

.

Version 0, edited 5 years ago by gjolleyrogers (Garry Jolley-Rogers) (next)

comment:4 Changed 5 years ago by jmroot (Joshua Root)

Cc: MarcusCalhoun-Lopez added

[31b04db7a19d7d0b5b9952943094cbca2620723e/macports-ports] added the stdlib setting. I guess that change wasn't correct for all cases if it's being used with clang and not just macports-gcc.

comment:5 Changed 5 years ago by jmroot (Joshua Root)

Port: openmpi added

#59330 reported a very similar problem with openmpi.

comment:6 Changed 5 years ago by willic3 (Charles Williams)

I believe that this ticket is similar to, but not identical to #59330. For that ticket, I believe that 'cxx_stdlib' is being set to 'libstdc++' in the compilers PortGroup (I may be wrong about this). Is there a way to determine where these variables are being set?

comment:7 Changed 5 years ago by rubendibattista (Ruben Di Battista)

I'm also hitting this problem.

Do the updates to ports get checked with build bots? Shouldn't this had been caught during build tests?

comment:8 Changed 5 years ago by rubendibattista (Ruben Di Battista)

diff --git a/_resources/port1.0/group/compilers-1.0.tcl b/_resources/port1.0/group/compilers-1.0.tcl
index 9fc68b4c8fa..d4b0435fab8 100644
--- a/_resources/port1.0/group/compilers-1.0.tcl
+++ b/_resources/port1.0/group/compilers-1.0.tcl
@@ -116,7 +116,7 @@ foreach v ${gcc_versions} {
     set cdb(gcc$v,fc)       ${prefix}/bin/gfortran-mp-$compiler_version
     set cdb(gcc$v,f77)      ${prefix}/bin/gfortran-mp-$compiler_version
     set cdb(gcc$v,f90)      ${prefix}/bin/gfortran-mp-$compiler_version
-    set cdb(gcc$v,cxx_stdlib) libstdc++
+    set cdb(gcc$v,cxx_stdlib) libc++
 }
 
 set clang_versions {33 34 37 39 40 50 60 70 80 90}
 

This fix the configure problem. For what I can understand in the code of compilers.tcl, that cxx_stdlib option should not be set if compiling with clang. So I don't get why it actually happens.

comment:9 Changed 5 years ago by willic3 (Charles Williams)

This fix makes perfect sense to me, because the fortran compilers won't care about the setting, and the clang compilers require libc++. This is much better than my temporary (and non-portable) fix, which involved setting CXXFLAGS for the configure arguments.

comment:10 Changed 5 years ago by aaschwanden (Andy Aschwanden)

Cc: aaschwanden added

comment:11 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Using the compilers PG, the variant gccX can have two different meanings:

  1. Use GCC for all compilers (C, C++, etc.)
  2. Use GCC for Fortran only

For case 2, configure.cxx_stdlib should not be changed, which is what happened in a recent commit.

comment:12 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In 13ef5adf8b1a9b527beaeab10d3139bc3ce0b0fb/macports-ports (master):

compilers PG: don't set c++ stdlib for Fortran GCC

Fixes #59329

Note: See TracTickets for help on using tickets.