Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The C++ compiler "/usr/bin/c++.exe" is not able to compile a simple test program" on Windows 10 with Cygwin 64 #108

Closed
pfeja opened this issue Apr 9, 2018 · 9 comments

Comments

@pfeja
Copy link

pfeja commented Apr 9, 2018

I tried to compile OpenFAST asper the documentation. I followed all steps one-by-one, but when I try to do the actual compilation, CMake fails with:

$ FC=gfortran cmake ../
-- The CXX compiler identification is GNU 6.4.0
-- The C compiler identification is GNU 6.4.0
-- The Fortran compiler identification is GNU 6.4.0
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- broken
CMake Error at /usr/share/cmake-3.6.2/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "/usr/bin/c++.exe" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /home/FejPau/code/OpenFAST/build/CMakeFiles/CMakeTmp



  Run Build
  Command:"/cygdrive/c/opal-rt/rt-lab/v11.2.1.100/common/bin/gmake.exe"
  "cmTC_af8f7/fast"

  C:\opal-rt\rt-lab\v11.2.1.100\common\bin\gmake.exe -f
  CMakeFiles/cmTC_af8f7.dir/build.make CMakeFiles/cmTC_af8f7.dir/build

  gmake.exe: command not found: /bin/sh

  gmake.exe: *** [cmTC_af8f7/fast] Error 0x7f





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


-- Configuring incomplete, errors occurred!
See also "/home/FejPau/code/OpenFAST/build/CMakeFiles/CMakeOutput.log".
See also "/home/FejPau/code/OpenFAST/build/CMakeFiles/CMakeError.log".

I attached CMakeOutput.log and CMakeError.log.

The strange thing is, when looking at CMakeError.log, it calls gmake.exe from C:\opal-rt\rt-lab\v11.2.1.100\common\bin\gmake.exe. I tried to remove this folder from the PATH environment variable, but it still tries to run gmake.exe from there.

I can't uninstall rt-lab because I need this for another project.

What else can I try?

CMakeError.log
CMakeOutput.log

@sayerhs
Copy link
Contributor

sayerhs commented Apr 9, 2018

Do you have GNU gcc and g++ compilers installed? If so, you can nudge CMake to use those similar to how you have asked it to use gfortran

CC=gcc CXX=g++ FC=gfortran cmake ../

@pfeja
Copy link
Author

pfeja commented Apr 10, 2018

I just tried this, but I get the same error.

Edit: I might add, that during the installation of Cygwin due to proxy settings I didn't select http://www.gtlib.gatech.edu and Direct connection, but installed it from another Mirror. However I guess this shouldn't make any difference...

@rafmudaf
Copy link
Collaborator

rafmudaf commented Apr 10, 2018

@pfeja you can verify the compilers that CMake is using by looking in CMakeCache.txt. For example,

mbp@~/Development/openfast/build: grep -ni "cxx_compiler" CMakeCache.txt 
87:CMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
603://ADVANCED property for variable: CMAKE_CXX_COMPILER
604:CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1

Could you verify that you are indeed using the c++ compiler you expect?

If CMake did not pick up gcc, try deleting CMakeCache.txt and running CMake again.

@rafmudaf
Copy link
Collaborator

And FYI you can also see the other compilers by searching for cmake_c_compiler and cmake_fortran_compiler.

@pfeja
Copy link
Author

pfeja commented Apr 12, 2018

After temporarily renaming the opal-rt directory, deleting the CMakeCache.txt file and running cmake with your recommended settings, and additionally, with -DCMAKE\_INSTALL\_PREFIX:PATH=$HOME/software, it compiles and runs when running inside the Cygwin Shell.

But then I added the C:\cygwin64\lib\lapack and C:\cygwin64\home\FejPau\software\bin to my PATH in the Control Panel and tried to run openfast -h from Command prompt and it complains about not finding all the Cygwin DLL files like cygwin1.dll

2018-04-12 11_21_42-eingabeaufforderung - openfast -h

EDIT: I also added C:\cygwin64\bin to the PATH but it didn't change anything.

What am I missing now?

@pfeja
Copy link
Author

pfeja commented Apr 24, 2018

I have created a workaround to run openfast from the Command prompt. I have created a .sh script reading
#!/bin/bash
openfast $@
and a corresponding .bat file with
bash run_openfast.sh myfile.fst
This helps, but doesn't solve the issue itself. Any ideas on this?

@rafmudaf
Copy link
Collaborator

@pfeja Am I understanding correctly that you are trying to run the OpenFAST executable which you compiled in CygWin from the Windows Command Prompt?

@rafmudaf
Copy link
Collaborator

rafmudaf commented Nov 30, 2018

If so, you must run anything compiled by CygWin within the CygWin terminal. This is from the CygWin website:

Cygwin is not:

a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.

Your final problem looks like a path configuration problem where cmd cannot find the cygwin dll.

I believe this issue is resolved so I'm closing it, but @pfeja feel free to open it again, if necessary.

@yugoo90
Copy link

yugoo90 commented Sep 8, 2022

Hi,
I am experiencing same issue as above. I am running a WSL ubuntu distro and using vsCode as my text editor.
Any help I could get on how to resolve this issue would be very much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants