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

Cannot compile with Cmake 3.16.3 #223

Closed
jefersonjlima opened this issue Apr 10, 2022 · 10 comments
Closed

Cannot compile with Cmake 3.16.3 #223

jefersonjlima opened this issue Apr 10, 2022 · 10 comments

Comments

@jefersonjlima
Copy link

Hello,

I get some errors when I compile autodiff with Cmake - version 3.16.3. The CMakeLists.txt has the cmake_minimum_required(VERSION 3.0), but, I think it isn't right.

I compile with Cmake 3.23.0 and it works fine.

@allanleal
Copy link
Member

Hi @jefersonjlima . I was on vacation. Thanks for reporting this. Could you please let me know the exact error? With this info, I'll be able to identify the minimum cmake version (which is certainly not 3.0 indeed).

@jefersonjlima
Copy link
Author

jefersonjlima commented May 2, 2022

Hi @allanleal , I'm sorry about the delay.
I retest this issue in another machine and got the same error:

user:/tmp/autodiff/.build$ cmake --build . --target install
Scanning dependencies of target autodiff-cpptests
[  1%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/main.cpp.o
[  3%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/common/meta.test.cpp.o
[  4%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/dual/dual.test.cpp.o
[  6%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/dual/eigen.test.cpp.o
[  7%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/real/eigen.test.cpp.o
[  9%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/real/real.test.cpp.o
[ 10%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/utils/derivative.test.cpp.o
[ 12%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/utils/gradient.test.cpp.o
[ 13%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/utils/taylorseries.test.cpp.o
[ 15%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/reverse/var/eigen.test.cpp.o
[ 16%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/reverse/var/var.test.cpp.o
[ 18%] Linking CXX executable autodiff-cpptests
[ 18%] Built target autodiff-cpptests
Scanning dependencies of target autodiff4py
[ 19%] Building CXX object python/bindings/CMakeFiles/autodiff4py.dir/autodiff.py.cxx.o
[ 21%] Building CXX object python/bindings/CMakeFiles/autodiff4py.dir/dual.eigen.py.cxx.o
[ 22%] Building CXX object python/bindings/CMakeFiles/autodiff4py.dir/dual.py.cxx.o
[ 24%] Building CXX object python/bindings/CMakeFiles/autodiff4py.dir/real.eigen.py.cxx.o
[ 25%] Building CXX object python/bindings/CMakeFiles/autodiff4py.dir/real.py.cxx.o
[ 27%] Linking CXX shared module autodiff4py.cpython-38-x86_64-linux-gnu.so
[ 27%] Built target autodiff4py
Scanning dependencies of target autodiff-setuptools
CMake Error: cmake version 3.16.3
Usage: /usr/bin/cmake -E <command> [arguments...]
Available commands:
  capabilities              - Report capabilities built into cmake in JSON format
  chdir dir cmd [args...]   - run command in a given directory
  compare_files [--ignore-eol] file1 file2
                              - check if file1 is same as file2
  copy <file>... destination  - copy files to destination (either file or directory)
  copy_directory <dir>... destination   - copy content of <dir>... directories to 'destination' directory
  copy_if_different <file>... destination  - copy files if it has changed
  echo [<string>...]        - displays arguments as text
  echo_append [<string>...] - displays arguments as text but no new line
  env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
                            - run command in a modified environment
  environment               - display the current environment
  make_directory <dir>...   - create parent and <dir> directories
  md5sum <file>...          - create MD5 checksum of files
  sha1sum <file>...         - create SHA1 checksum of files
  sha224sum <file>...       - create SHA224 checksum of files
  sha256sum <file>...       - create SHA256 checksum of files
  sha384sum <file>...       - create SHA384 checksum of files
  sha512sum <file>...       - create SHA512 checksum of files
  remove [-f] <file>...     - remove the file(s), use -f to force it
  remove_directory <dir>... - remove directories and their contents
  rename oldname newname    - rename a file or directory (on one volume)
  server                    - start cmake in server mode
  sleep <number>...         - sleep for given number of seconds
  tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]
                            - create or extract a tar or zip archive
  time command [args...]    - run command and display elapsed time
  touch <file>...           - touch a <file>.
  touch_nocreate <file>...  - touch a <file> but do not create it.
  create_symlink old new    - create a symbolic link new -> old
  true                      - do nothing with an exit code of 0
  false                     - do nothing with an exit code of 1

make[2]: *** [python/package/CMakeFiles/autodiff-setuptools.dir/build.make:60: python/package/CMakeFiles/autodiff-setuptools] Error 1
make[1]: *** [CMakeFiles/Makefile2:382: python/package/CMakeFiles/autodiff-setuptools.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

It was fixed when I updated the cmake to version 3.23.1.

@allanleal
Copy link
Member

It should be possible now to compile with CMake 3.16. Thanks for reporting.

@rmslick
Copy link

rmslick commented Aug 8, 2022

@allanleal I am experiencing this issue and I cloned today. Any updates?

@allanleal
Copy link
Member

@rmslick what is the error message? What is your cmake version?

@rmslick
Copy link

rmslick commented Aug 8, 2022

@allanleal Version is 3.16.3. Error posted below. Thanks for the quick reply!

[ 41%] Built target autodiff4py
Scanning dependencies of target autodiff-setuptools
CMake Error: cmake version 3.16.3
Usage: /usr/bin/cmake -E [arguments...]
Available commands:
capabilities - Report capabilities built into cmake in JSON format
chdir dir cmd [args...] - run command in a given directory
compare_files [--ignore-eol] file1 file2
- check if file1 is same as file2
copy ... destination - copy files to destination (either file or directory)
copy_directory

... destination - copy content of ... directories to 'destination' directory
copy_if_different ... destination - copy files if it has changed
echo [...] - displays arguments as text
echo_append [...] - displays arguments as text but no new line
env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
- run command in a modified environment
environment - display the current environment
make_directory ... - create parent and directories
md5sum ... - create MD5 checksum of files
sha1sum ... - create SHA1 checksum of files
sha224sum ... - create SHA224 checksum of files
sha256sum ... - create SHA256 checksum of files
sha384sum ... - create SHA384 checksum of files
sha512sum ... - create SHA512 checksum of files
remove [-f] ... - remove the file(s), use -f to force it
remove_directory ... - remove directories and their contents
rename oldname newname - rename a file or directory (on one volume)
server - start cmake in server mode
sleep ... - sleep for given number of seconds
tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]
- create or extract a tar or zip archive
time command [args...] - run command and display elapsed time
touch ... - touch a .
touch_nocreate ... - touch a but do not create it.
create_symlink old new - create a symbolic link new -> old
true - do nothing with an exit code of 0
false - do nothing with an exit code of 1

make[2]: *** [python/package/CMakeFiles/autodiff-setuptools.dir/build.make:60: python/package/CMakeFiles/autodiff-setuptools] Error 1
make[1]: *** [CMakeFiles/Makefile2:384: python/package/CMakeFiles/autodiff-setuptools.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

@allanleal
Copy link
Member

allanleal commented Aug 8, 2022

OK, sounds like 3.16.3 is not the minimum required but some more recent version. Please update cmake or use a newer version.

Just tried here with CMake 3.16.3 (version installed in Ubuntu 20.04 with sudo apt install cmake) and the build operation fails
in the last step, when organizing the Python module because cmake -E rm is only available from CMake 3.17.

I have just pushed a commit to the main branch replacing rm by remove_directory and this fixes the issue.

@rmslick
Copy link

rmslick commented Aug 8, 2022

I wish I saw your edit before reading your advice that is now crossed out. I upgraded to 3.23 and got smashed with errors when running cmake --build . --target install. It gets to:
[ 3%] Building CXX object tests/CMakeFiles/autodiff-cpptests.dir/forward/dual/dual.test.cpp.o
then vomits.

The errors are too long to post in-full but here is the end:

843 | return std::forward(l) + ( -std::forward(r) );
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
autodiff/tests/forward/dual/dual.test.cpp: In instantiation of ‘C_A_T_C_H_T_E_S_T_0()::<lambda(const auto:15&, const auto:16&)> [with auto:15 = autodiff::detail::Dual<double, double>; auto:16 = autodiff::detail::Dual<double, double>]’:
autodiff/tests/forward/dual/dual.test.cpp:719:30: required from ‘C_A_T_C_H_T_E_S_T_0()::<lambda(const auto:17&, const auto:18&)> [with auto:17 = autodiff::detail::Dual<double, double>; auto:18 = autodiff::detail::Dual<double, double>; autodiff::dual = autodiff::detail::Dual<double, double>]’
autodiff/tests/forward/dual/dual.test.cpp:722:9: required from here
autodiff/tests/forward/dual/dual.test.cpp:714:48: error: invalid use of void expression
714 | return 100.0 * pow2(xx - y) + pow2(1.0 - x);
| ~~~~^~~~~~~~~
autodiff/tests/forward/dual/dual.test.cpp: In instantiation of ‘C_A_T_C_H_T_E_S_T_0()::<lambda(const auto:17&, const auto:18&)> [with auto:17 = autodiff::detail::Dual<double, double>; auto:18 = autodiff::detail::Dual<double, double>; autodiff::dual = autodiff::detail::Dual<double, double>]’:
autodiff/tests/forward/dual/dual.test.cpp:722:9: required from here
autodiff/tests/forward/dual/dual.test.cpp:719:30: error: could not convert ‘(& rosenbrock)->C_A_T_C_H_T_E_S_T_0()::<lambda(const auto:15&, const auto:16&)>((
& x), (* & y))’ from ‘void’ to ‘autodiff::dual’ {aka ‘autodiff::detail::Dual<double, double>’}
719 | return rosenbrock(x, y);
| ~~~~~~~~~~^~~~~~
| |
| void
make[2]: *** [tests/CMakeFiles/autodiff-cpptests.dir/build.make:104: tests/CMakeFiles/autodiff-cpptests.dir/forward/dual/dual.test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:283: tests/CMakeFiles/autodiff-cpptests.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@allanleal
Copy link
Member

allanleal commented Aug 9, 2022

What is the compiler and version you're using? As you can see in the past GitHub Actions, the build process is working correctly for Linux, Windows and macOS.

And below is my just performed local build using g++ 9.3.0.
image

@rmslick
Copy link

rmslick commented Aug 9, 2022

@allanleal I must have messed something up when I switched CMake versions. I uninstalled cmake and reinstalled 3.16.3 and rebuilt succesfuly. Thanks a lot!

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

No branches or pull requests

3 participants