bbopt / nomad

NOMAD - A blackbox optimization software
https://nomad-4-user-guide.readthedocs.io/
GNU Lesser General Public License v3.0
114 stars 24 forks source link

cmake error during Configuration step #78

Closed p-staub closed 2 years ago

p-staub commented 2 years ago

I am on windows server 2019. The command cmake -S . -B build/release returns an error.

CMake Error at CMakeLists.txt:9 (project):
  Running
    'nmake' '-?'
  failed with:
     The system cannot find the file specified

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Nomad/nomad-4.1.0/build/release/CMakeFiles/CmakeOutput.log".

Any ideas?

ctribes commented 2 years ago

It seems nmake is part of VisualStudio. Our tests on windows are always with VisualStudio. What is you compiler ?

Also, you may want to download nomad 4.2. The cmake script has been modified. https://github.com/bbopt/nomad/releases/tag/v.4.2.0

p-staub commented 2 years ago

I was using the command prompt. I have installed VisualStudio. How should I proceed now?

ctribes commented 2 years ago

You can start a VisualStudio command prompt and run the command cmake -S. -B build/release See the user guide for details https://nomad-4-user-guide.readthedocs.io/en/latest/Installation.html

p-staub commented 2 years ago

I have another problem when I run cmake --build build/release --config Release

C:\Nomad\nomad4.2.0_binaries_windows\examples> cmake --build build/release --config Release
Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

    utils.cpp
C:\Nomad\nomad4.2.0_binaries_windows\examples\advanced\batch\SuggestAndObserve\utils.hpp(49,10): fata error c1083: Cannot open include file: 'Nomad/nomad.hpp' : No such file or directory [C:\Nomad\nomad4.2.0_binaries_windows\examples\build\release\advanced\batch\SuggestAndObserve\utils.vcxproj]
ctribes commented 2 years ago

The command cmake --build build/release --config Release is usually done in nomad root directory. In your case, I guess it is C:\Nomad\nomad4.2.0_binaries_windows Does it work ?

p-staub commented 2 years ago

I get the same error

ctribes commented 2 years ago

Could your share the output of the command cmake -S . -B build/release with the build/release directory removed ?

p-staub commented 2 years ago
PS C:\Nomad\nomad4.2.0_binaries_windows\examples> cmake -S . -B build/release
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as
    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.17763.
--     Add example library #1
--     Add example library #2
--     Add example library #3
--     Add example library single_obj_parallel
--     Add example library tests using Suggest And Observe
--     Add example batch #1
--     Add example batch #2
--     Add example batch single_obj
--     Add example batch surrogate sort
CMake Warning (dev) at CMakeLists.txt:37 (FILE):
  Syntax error in cmake code at

    C:/Nomad/nomad4.2.0_binaries_windows/examples/CMakeLists.txt:38

  when parsing string

    #!/bin/bash

      executable=$1
      param_file=\"empty\"
      if [ \$# == 2 ]
      then
          param_file =$2
      fi
      echo \"Running Example test $executable\"
      $executable $param_file | tee runTestLog.txt
      if [ $? != 0 ]
      then
          exit 1
      else
          test_passed=`grep termination runTestLog.txt`
          test_failed=`grep -e exception -e Exception -e Error -e abort -e terminate runTestLog.txt`
          if [ \"$test_passed\" != \"\" ] \&\& [ \"$test_failed\" == \"\" ]
          then
              exit 0
          else
              exit 1
          fi
      fi
      \n

  Invalid escape sequence \&

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.24)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Nomad/nomad4.2.0_binaries_windows/examples/build/release
ctribes commented 2 years ago

The command cmake -S . -B build/release MUST be run in C:\Nomad\nomad4.2.0_binaries_windows. I suggest to clean build/release directory and repeat the sequence. There should be no error when running cmake -S . -B build/release, otherwise the build will most likely fail.

p-staub commented 2 years ago

It does not work

C:\Nomad\nomad4.2.0>cmake -S . -B build/release
CMake Error: The source directory "C:/Nomad/nomad4.2.0" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
ctribes commented 2 years ago

I don't know what is your root nomad directory name.

But the directory should contain the CMakeList.txt file. The nomad root directory content is:


CMakeLists.txt  CONTRIBUTORS    README.txt  bin     doc     ext     src
CONTRIBUTING.md LICENSE     ROADMAP.md examples interfaces