charm icon indicating copy to clipboard operation
charm copied to clipboard

Build switches compiler in "charmconfig.out" on MacOS bigSur

Open BJWiley233 opened this issue 3 years ago • 3 comments

I am interested why I see 2 different compiler used during build (not sure if this is cause of build failure) in the charmconfig.out file during my build using Gnu gcc-11 from homebrew along with standard library/headers from MacOS since it needs _stdio.h which Gnu gcc does not have. Also how do I specify -mmacosx-version-min equal to 11.6 using the build script. It's defaulting to 10.7. I see gcc-11 used 37 times in log, g++-11 used 96 times, and clang++ used 4 times which give an error each time.

Build command was

./build LIBS multicore-darwin-x86_64 gcc-11 gfortran --basedir /Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr

In the file charmconfig.out I see:

gcc-11 -fPIC -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -c test.c -o test.o
### whether C++ signed char and char differ
#include <stdlib.h>
class er {
 protected:
   void operator()(char &v,const char *desc=NULL) {};
   void operator()(signed char &v,const char *desc=NULL) {};
};
g++-11 -fPIC -Wno-deprecated -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -fno-lifetime-dse -c test.cpp -o test.o
### whether typeinfo/typeid works
#include <typeinfo>

earlier on however I see

clang++ -fPIC -dynamic -fno-common -stdlib=libc++ -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -c test.cpp -o test.o
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/map:481:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:14:
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

clang++ -fPIC -dynamic -fno-common -stdlib=libc++ -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -c test.cpp -o test.o -std=c++11
...
<Same issue as above>
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

### whether C++ compiler supports C++11 with '--c++11'
// Check for Intel compiler incompatibility with the active g++/libstdc++ by
// including an arbitrary standard library header (cf bug #1560)
#include <map>

// Check for an excessively old g++/libstdc++ that can't handle features we use
#include <memory>
#include <vector>
...
clang++ -fPIC -dynamic -fno-common -stdlib=libc++ -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -c test.cpp -o test.o --c++11
clang: error: unsupported option '--c++11'

### whether C++ compiler supports C++11 with '-h std=c++11'
// Check for Intel compiler incompatibility with the active g++/libstdc++ by
// including an arbitrary standard library header (cf bug #1560)
#include <map>

// Check for an excessively old g++/libstdc++ that can't handle features we use
#include <memory>
#include <vector>
std::unique_ptr<int> i;
...
clang++ -fPIC -dynamic -fno-common -stdlib=libc++ -DCMK_GFORTRAN -mmacosx-version-min=10.7 -D_DARWIN_C_SOURCE -D_REENTRANT -I../include -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX-SDKs/MacOSX11.3.sdk/usr/include -c test.cpp -o test.o -h std=c++11
clang: error: unknown argument: '-h'

BJWiley233 avatar Jan 24 '22 02:01 BJWiley233

I just used Clang and can get it to compile with MPI. What boggles my mind is that the notes from the NAMD download it says to cd to <build>/tests/charm++/megatest and make pgm when there is no rule or file pgm.C in this directory. It's sounds like I am missing something or I am just silly for reading the notes file? Is this an old thing?

Build and test the Charm++/Converse library (MPI version):
  cd charm-6.10.2
  env MPICXX=mpicxx ./build charm++ mpi-linux-x86_64 --with-production
  cd mpi-linux-x86_64/tests/charm++/megatest
  make pgm
  mpiexec -n 4 ./pgm   (run as any other MPI program on your cluster)
  cd ../../../../..

BJWiley233 avatar Jan 26 '22 07:01 BJWiley233

Now I am think the instructions all changed to just make the programs to run. So I did an install with ./build LIBS ... which should have built all libraries including ck-libs/multiphaseSharedArrays but testing the example in charm-7.0.0/examples/multiphaseSharedArrays I error t3.C:2:10: fatal error: 'msa/msa.h' file not found from the simpletest

BJWiley233 avatar Jan 26 '22 07:01 BJWiley233

It's odd that it's using clang on test.cpp; not certain about why. I know that Charm++ determines which compiler to build charmxi based on the platform, and that bypasses the user's suggested compiler.

The instructions may be out of date. You can run make -j to build it, then run the executable named megatest.

Inlining my response from #3561: I usually run make from src/libs/ck-libs/multiphaseSharedArrays/ to make -module msa available.

jszaday avatar Jan 27 '22 14:01 jszaday