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

Build fails with CMake 3.12 #167

Closed
dubek opened this issue May 10, 2020 · 9 comments
Closed

Build fails with CMake 3.12 #167

dubek opened this issue May 10, 2020 · 9 comments

Comments

@dubek
Copy link

dubek commented May 10, 2020

The README documentation and CMakeLists.txt both state that the minimal version for CMake is 3.12. However, building SEAL 3.5.1 with CMake 3.12 fails during library linking:

...
[ 91%] Building CXX object CMakeFiles/seal_obj.dir/native/src/seal/util/uintarith.cpp.o
[ 92%] Building CXX object CMakeFiles/seal_obj.dir/native/src/seal/util/uintarithmod.cpp.o
[ 94%] Building CXX object CMakeFiles/seal_obj.dir/native/src/seal/util/uintarithsmallmod.cpp.o
[ 96%] Building CXX object CMakeFiles/seal_obj.dir/native/src/seal/util/uintcore.cpp.o
[ 98%] Building CXX object CMakeFiles/seal_obj.dir/native/src/seal/util/ztools.cpp.o
[ 98%] Built target seal_obj
Scanning dependencies of target seal
[100%] Linking CXX static library lib/libseal-3.5.a
/bin/sh: 1: cd: can't cd to /data/SEAL/$<TARGET_FILE_DIR:seal>
CMakeFiles/seal.dir/build.make:148: recipe for target 'lib/libseal-3.5.a' failed
make[2]: *** [lib/libseal-3.5.a] Error 2
make[2]: *** Deleting file 'lib/libseal-3.5.a'
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/seal.dir/all' failed
make[1]: *** [CMakeFiles/seal.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Upgrading to latest CMake (3.17) on my dev machine solved the issue. Not sure what's the real minimal version of CMake required.

@WeiDaiWD
Copy link
Contributor

I cannot reproduce this issue. I have just built SEAL 3.5.1 (a fresh clone) with CMake 3.12.4 in Linux. Could you please confirm that you were working on a fresh clone of SEAL? Also which version of CMake were you using, including the patch number? Thank you.

@WeiDaiWD
Copy link
Contributor

$<TARGET_FILE_DIR:seal> is evaluated during build system generation. A possible reason is that CMake did not generate build system after configuration. Therefore, cmake-generator-expression $<TARGET_FILE_DIR:seal> appeared literally in your output, which should have been lib if it had been evaluated correctly.

That is to say, if you modified CMake arguments/options, executed CMake's configuration step, and skipped CMake's generation step, you probably can get this issue. The reason why generation is skipped is not clear to me yet. I'll leave this issue open until I figure this out. At least the minimum requirement is still 3.12.

@zaczanussi
Copy link

I have the same problem, with CMake 3.12.4. Haven't tried upgrading CMake to 3.17 yet. Can confirm I'm using a fresh clone.

@WeiDaiWD
Copy link
Contributor

@zaczanussi Could you please elaborate on how you built SEAL, e.g. the list of command lines? Were you using a GUI or ccmake?

@zaczanussi
Copy link

zaczanussi commented May 13, 2020

git pull https://github.com/microsoft/SEAL.git

cmake .

make

@WeiDaiWD
Copy link
Contributor

I have just reproduced this error. Thank you both for reporting this. Here are three solutions (choose the latter two if you have to use CMake 3.12):

  1. use CMake 3.15 or above (I've just tested 3.15.5);
  2. if 3.12, modify this line: replace $<TARGET_FILE_DIR:seal> with ${CMAKE_LIBRARY_OUTPUT_DIRECTORY};
  3. if 3.12, use a GUI or CMake Curses Interface and make sure that generation is executed (manually).

I've tested all three solutions above. I'm going to check CMake releases to see the reason behind this issue, and release a quick patch with a reasonable fix.

@zaczanussi
Copy link

Number 2 worked for me, thanks so much!

@WeiDaiWD
Copy link
Contributor

WORKING_DIRECTORY cannot be a generator-expression in CMake 3.12, and was supported in 3.13. This is the reason of this issue. Solution 2 is preferred. Minimum CMake version will remain the same. A fix is implemented internally and will appear in 3.5.2 soon. Much appreciated for your reports.

@Abhijeet241093
Copy link

Hello Sir,

I am getting error at make command /home/god/SEALDemo/seal/seal.h: no such file or directory found

include "/home/god/SEALDemo/seal/seal.h"

Compilation terminated

How to solve it?

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

4 participants