PSOPT / psopt

PSOPT Optimal Control Software
GNU Lesser General Public License v2.1
193 stars 75 forks source link

PSOPT 5.0 MacOS Installation - target_compile_features no known features for CXX compiler #34

Open Urbanair1 opened 3 years ago

Urbanair1 commented 3 years ago

Greetings,

I am unable to install PSOPT in MacOS because of the following error. Please recommend!

(base) ARSLA18090409:build urbanair1$ cmake -DBUILD_EXAMPLES=ON -DCXX=g++-10 -DCC=gcc-10 .. -- AdolC has not been installed on this system and will be automatically added to this project. -- Configuring done -- Generating done -- Build files have been written to: /Users/urbanair1/PSOPT/build/adolc-download [100%] Built target adolc CMake Error at CMakeLists.txt:30 (target_compile_features): target_compile_features no known features for CXX compiler

"AppleClang"

version 10.0.1.10010046.

-- Configuring incomplete, errors occurred! See also "/Users/urbanair1/PSOPT/build/CMakeFiles/CMakeOutput.log".

schulz0r commented 3 years ago

Try cmake -DBUILD_EXAMPLES=ON CXX=g++-10 CC=gcc-10 ..(CXX and CC without -D).

Urbanair1 commented 3 years ago

Thanks for the email!

Unfortunately, it did NOT work as gcc version 10.2 is NOT being recognized.

The location of gcc upon reinstalling using homebrew:

/usr/local/Cellar/gcc/10.2.0

However, older version of gcc is placed at the following location:

/Library/Developer/CommandLineTools/usr/bin

Please let me know if you have any other recommendations!

On Fri, Oct 2, 2020 at 10:36 AM schulz0r notifications@github.com wrote:

Try cmake -DBUILD_EXAMPLES=ON CXX=g++-10 CC=gcc-10 ..(without -D)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PSOPT/psopt/issues/34#issuecomment-702865276, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARHMZJSP5O7KM45YCXUWZ4LSIYFSPANCNFSM4SB6ATVA .

schulz0r commented 3 years ago

I think this problem is not related to PSOPT. I guess this Stackoverflow thread is what you are looking for.

Urbanair1 commented 3 years ago

Thank you, appreciate it!

On Mon, Oct 5, 2020 at 3:05 AM schulz0r notifications@github.com wrote:

I think this problem is not related to PSOPT. I guess this Stackoverflow thread https://stackoverflow.com/questions/24380456/how-can-i-make-cmake-use-gcc-instead-of-clang-on-mac-os-x is what you are looking for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PSOPT/psopt/issues/34#issuecomment-703533644, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARHMZJV6DWWKLMVYQ4WM3STSJGK7LANCNFSM4SB6ATVA .

Urbanair1 commented 3 years ago

I added the following lines in CMakelists.txt per your recommendation and the previous error was completely resolved:

set(CMAKE_C_COMPILER "/usr/local/Cellar/gcc/10.2.0/bin/gcc-10") set(CMAKE_CXX_COMPILER "/usr/local/Cellar/gcc/10.2.0/bin/g++-10")

Also, I updated the bash_profile file as follows: export CXX=/usr/local/Cellar/gcc/10.2.0/bin/g++-10 export CC=/usr/local/Cellar/gcc/10.2.0/bin/gcc-10

However, I observed the following new error:

CMake Error at CMakeLists.txt:34 (target_compile_features): target_compile_features no known features for CXX compiler

"GNU"

version 10.2.0.

-- Configuring incomplete, errors occurred!

Please help me out if you are aware of the solution!

schulz0r commented 3 years ago

CMake looks if your compiler supports delegate constructors. Seems like this CMake feature is buggy and does not support GCC 10.2. Try deleting the line with the feature check and see if it works. Normally, this feature should be included in the C++11 standard, but for some reason, I could not configure the project with just C++11 specified. Maybe you have better luck. I will investigate this problem in the coming days.

Urbanair1 commented 3 years ago

The previously mentioned error went off with the following command: cmake -DBUILD_EXAMPLES=ON

I am using MACOS - 10.14.6, So I think whatever you recommended me regarding bash_profile and CMakeLists.txt update was correct except for the Cmake command, it does NOT need -DCXX=g++-10 -DCC=gcc-10 ..

Now when I ran $ Make command on the terminal, I got the following new errors: [ 27%] Linking CXX executable alpine ld: can't map file, errno=22 file '../../adolc-build/lib64' for architecture x86_64 collect2: error: ld returned 1 exit status make[2]: [examples/alpine/alpine] Error 1 make[1]: [examples/alpine/CMakeFiles/alpine.dir/all] Error 2 make: *** [all] Error 2

Urbanair1 commented 3 years ago

Also, not sure if the following bug in ColPack (1.0.10) has been reported:

After performing $ cd ColPack

$ ./configure --prefix=/usr/local -bash: ./configure: No such file or directory

Thanks!