dcarp / cmake-d

cmake for D2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails with ldc2

russel opened this issue · comments

Running CMake without options uses gdc. Running CMake with -DCMAKE_D_COMPILER=dmd works fine. However running with -DCMAKE_D_COMPILER=ldc2 leads to:

-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_D_COMPILER= ldc2

-- The D compiler identification is LDC
-- Check for working D compiler: /usr/bin/ldc2
-- Check for working D compiler: /usr/bin/ldc2 -- broken
-- To force a specific D compiler set the DC environment variable
--     ie - export DC="/usr/bin/dmd"
CMake Error at cmake-d/CMakeTestDCompiler.cmake:45 (message):
  The D compiler "/usr/bin/ldc2" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /home/users/russel/BuildArea/HelloWorld_D_CMake/CMakeFiles/CMakeTmp

  

  Run Build Command:"/usr/bin/ninja" "cmTC_89a73"

  [1/2] Building D object CMakeFiles/cmTC_89a73.dir/testDCompiler

  [2/2] Linking D executable cmTC_89a73

  FAILED: cmTC_89a73

  : && /usr/bin/ldc2 CMakeFiles/cmTC_89a73.dir/testDCompiler -ofcmTC_89a73 &&
  :

  Error: module testDCompiler is in file
  'CMakeFiles/cmTC_89a73.dir/testDCompiler.d' which cannot be read

  import path[0] = /usr/include/d

  import path[1] = /usr/lib/ldc/x86_64-linux-gnu/include/d/ldc

  import path[2] = /usr/lib/ldc/x86_64-linux-gnu/include/d

  ninja: build stopped: subcommand failed.

  

  

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


-- Configuring incomplete, errors occurred!

CMake does not allow to change the compiler after you selected one. Simply remove the directory or the cache and start again, or specify another build directory.
See: https://cmake.org/Wiki/CMake_FAQ#I_change_CMAKE_C_COMPILER_in_the_GUI_but_it_changes_back_on_the_next_configure_step._Why.3F

BTW also try to select the compiler using the DC shell environment variable. Example: DC=ldc2 cmake -D...