This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem building with cmake under cygwin (need clang)


Marco Atzeri wrote:
On 26/07/2016 17:10, LMH wrote:
Csaba Raduly wrote:


Steps for building in a separate build directory:

mkdir _build
cd    _build
cmake ..

Csaba


I looked for the syntax for this when I first started. I assumed the the
author put the CMakeLists.txt file in the right place. I almost never
have my make file in the src directory when using gnu make, so this
looked the same to me. I didn't find any doc about how to have the
CMakeLists.txt and the src in different directories.


Csaba was clear but it seems you are misunderstanding,
the call to cmake is

        cmake [options] <path-to-source>

so I will put together his suggestion and Tony's one:

$ git pull https://bitbucket.org/tomilov/quickhull/src
$ ls src/
CMakeLists.txt  include  README.md  src  test
$ mkdir build
$ cd build
$ cmake -DCMAKE_CXX_COMPILER=clang  ../src

the "build" directory is in this case parallel to the "src" one.

Unfortunately it will fail on "Compiler does not support C++1z standard"
and you will need to modify the original CMakeLists.txt.
I cut
-------------------------------------------------------------------
-CHECK_CXX_COMPILER_FLAG("-std=gnu++1z" COMPILER_SUPPORTS_CXX1Z)
-if(NOT COMPILER_SUPPORTS_CXX1Z)
-    message(FATAL_ERROR "Compiler does not support C++1z standard")
-endif()
-add_compile_options("-std=gnu++1z")
-------------------------------------------------------------------

But there are other issues on the road; I passed some with

cmake -DCMAKE_CXX_COMPILER=clang -DCMAKE_CXX_FLAGS="-std=gnu++1z
-I/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/
-I/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/" ../src

but the build stop here
--------------------------------------------------------------------------
/pub/temp/src/src/simple_use.cpp:146:16: fatal error: no member named 'chrono' in
namespace 'std'
     using std::chrono::duration_cast;
           ~~~~~^
15 warnings and 1 error generated.
make[2]: *** [CMakeFiles/qh.dir/build.make:66:
CMakeFiles/qh.dir/src/simple_use.cpp.o] Error 1
---------------------------------------------------------------------------

and I am out of my C++ knowledge

Regards
Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



Thanks you for the clarification.

I implemented your steps,

$ ls src/
CMakeLists.txt  include  README.md  src  test

$ mkdir build

$ cd build/

$ cmake -DCMAKE_CXX_COMPILER=clang  ../src

I get the following output, which is the same error output I was getting before. It is different then the errors you are specifying.

-- The C compiler identification is GNU 4.9.3
-- The CXX compiler identification is unknown
CMake Warning at /usr/share/cmake-3.3.2/Modules/Platform/CYGWIN.cmake:15 (message):
  CMake no longer defines WIN32 on Cygwin!

  (1) If you are just trying to build this project, ignore this warning or
  quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
  the CMake cache.  If later configuration or build errors occur then this
  project may have been written under the assumption that Cygwin is WIN32.
  In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.

  (2) If you are developing this project, add the line

    set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

  at the top of your top-level CMakeLists.txt file or set the minimum
  required version of CMake to 2.8.4 or higher.  Then teach your project to
  build on Cygwin without WIN32.
Call Stack (most recent call first):
  /usr/share/cmake-3.3.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
  CMakeLists.txt:1 (project)


-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang
-- Check for working CXX compiler: /usr/bin/clang -- broken
CMake Error at /usr/share/cmake-3.3.2/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "/usr/bin/clang" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/bin/make.exe" "cmTC_e1f3f/fast"

  /usr/bin/make -f CMakeFiles/cmTC_e1f3f.dir/build.make
  CMakeFiles/cmTC_e1f3f.dir/build

  make[1]: Entering directory
  '/cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeTmp'

  Building CXX object CMakeFiles/cmTC_e1f3f.dir/testCXXCompiler.cxx.o

  /usr/bin/clang -o CMakeFiles/cmTC_e1f3f.dir/testCXXCompiler.cxx.o -c

/cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


  CMakeFiles/cmTC_e1f3f.dir/build.make:65: recipe for target
  'CMakeFiles/cmTC_e1f3f.dir/testCXXCompiler.cxx.o' failed

  make[1]: Leaving directory
  '/cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeTmp'

  Makefile:126: recipe for target 'cmTC_e1f3f/fast' failed

  make[1]: *** [CMakeFiles/cmTC_e1f3f.dir/testCXXCompiler.cxx.o] Error 127

  make: *** [cmTC_e1f3f/fast] Error 2


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


-- Configuring incomplete, errors occurred!
See also "/cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeOutput.log". See also "/cygdrive/g/shared_data/SMD/ATomilov_quickhull/build/CMakeFiles/CMakeError.log".

It looks like it is still using gnu for the compiler and not clang. It looks like it can't identify the c++ compiler at all. I tried this,

cmake -DCMAKE_CXX_COMPILER=clang++ ../src

because I think that CXX is the c++ compiler, but this doesn't make any difference. I have attached the cmake error and output logs in case that is useful.

It just looks like there is something missing or misconfigured in my installation. The which clang and which clang++ commands return the expected values. If cmake isn't able to build a test app, then there is something wrong at that end I think.

LMH




Attachment: CMakeOutput.log
Description: Text document

Attachment: CMakeError.log
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]