-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[GPU] CMakeLists Error during cmake process. #4820
Comments
I got the same problem!! |
@op-Valar-Morghulis go to official website to get the latest cmake. |
Thanks! It works on this problem! |
@lichuanxiang @op-Valar-Morghulis I'm struggling to understand what happened here, sorry. Could you help us understand, so that others finding this issue from search will be able to successfully install LightGBM? As I understand it, are you saying you experienced this error with CMake 3.17 and upgrading to 3.22 fixed it? |
@jameslamb Yes, and in my local environment, cmake 3.7.2 don't work either. |
Just to be clear, you mean 3.17.2, not 3.7.2, right? Since I see lines like |
@jameslamb For this issue, it is. |
@jameslamb In fact, 3.17.2 and 3.7.2 don't work, you can retry it in your local env. I guess cmake has version limit for lightgbm. |
I see, ok.
Yes, but both 3.17.2 and 3.7.2 are expected to work when using Lines 29 to 30 in f7e3938
|
Same issue for cmake 3.10 and got fixed by updating to cmake 3.22 |
I tried to compile LightGBM on the Cloud Server.
The pre-built environment already has NVDIA driver installed.
So I followed the install tutorial and failed again and again, which cost me nearly one day.
Procedure:
Step 1: Install the prerequisites
sudo apt-get install git cmake build-essential libboost-dev libboost-system-dev libboost-filesystem-dev
Step2: Time to download LightGBM
git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build
Step3: CMake step
Firstly, tried with:
cmake -DUSE_GPU=1 ..
Unfortunately, this does not work.
CMake Error at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message): Could NOT find OpenCL (missing: OpenCL_LIBRARY OpenCL_INCLUDE_DIR)
And the cmake order for GPU compile does not work...
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ ..
The errors about OpenCL are replaced with others related to Boost
CMake Error at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message): Could NOT find Boost (missing: Boost_INCLUDE_DIR filesystem system) (Required is at least version "1.56.0") Call Stack (most recent call first): /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.17/Modules/FindBoost.cmake:2145 (find_package_handle_standard_args) CMakeLists.txt:121 (find_package)
So I choose to :
sudo apt-get install libboost-all-dev
And I use the GPU compile again and got things like below:
Console Ouput
-- Found OpenMP_C: -fopenmp
-- Found OpenMP_CXX: -fopenmp
-- Found OpenMP: TRUE
-- OpenCL include directory: /usr/local/cuda/include
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- system
-- Using _mm_prefetch
-- Using _mm_malloc
CMake Error at CMakeLists.txt:380 (target_link_libraries):
Target "lightgbm_objs" of type OBJECT_LIBRARY may not be linked into
another target. One may link only to STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
You have called ADD_LIBRARY for library _lightgbm without any source files. This typically indicates a problem with your CMakeLists.txt file
CMake Error at CMakeLists.txt:398 (target_link_libraries):
Target "lightgbm_capi_objs" of type OBJECT_LIBRARY may not be linked into
another target. One may link only to STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
CMake Error at CMakeLists.txt:398 (target_link_libraries):
Target "lightgbm_objs" of type OBJECT_LIBRARY may not be linked into
another target. One may link only to STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
CMake Error at CMakeLists.txt:484 (target_link_libraries):
Object library target "lightgbm_objs" may not link to anything.
-- Configuring incomplete, errors occurred!
See also "/mnt/LightGBM/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/LightGBM/build/CMakeFiles/CMakeError.log".
The content of CMakeError.log:
Determining if the CL_VERSION_2_2 exist failed with the following output:
Change Dir: /mnt/LightGBM/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_83c96/fast"
/usr/bin/make -f CMakeFiles/cmTC_83c96.dir/build.make CMakeFiles/cmTC_83c96.dir/build
make[1]: Entering directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_83c96.dir/CheckSymbolExists.c.o
/usr/bin/cc -I/usr/local/cuda/include -o CMakeFiles/cmTC_83c96.dir/CheckSymbolExists.c.o -c /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘CL_VERSION_2_2’ undeclared (first use in this function); did you mean ‘CL_VERSION_1_2’?
return ((int*)(&CL_VERSION_2_2))[argc];
^~~~~~~~~~~~~~
CL_VERSION_1_2
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_83c96.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_83c96.dir/CheckSymbolExists.c.o' failed
make[1]: *** [CMakeFiles/cmTC_83c96.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_83c96/fast' failed
make: *** [cmTC_83c96/fast] Error 2
File /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </usr/local/cuda/include/CL/cl.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef CL_VERSION_2_2
return ((int*)(&CL_VERSION_2_2))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the CL_VERSION_2_1 exist failed with the following output:
Change Dir: /mnt/LightGBM/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5f196/fast"
/usr/bin/make -f CMakeFiles/cmTC_5f196.dir/build.make CMakeFiles/cmTC_5f196.dir/build
make[1]: Entering directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_5f196.dir/CheckSymbolExists.c.o
/usr/bin/cc -I/usr/local/cuda/include -o CMakeFiles/cmTC_5f196.dir/CheckSymbolExists.c.o -c /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘CL_VERSION_2_1’ undeclared (first use in this function); did you mean ‘CL_VERSION_1_1’?
return ((int*)(&CL_VERSION_2_1))[argc];
^~~~~~~~~~~~~~
CL_VERSION_1_1
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_5f196.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_5f196.dir/CheckSymbolExists.c.o' failed
make[1]: *** [CMakeFiles/cmTC_5f196.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5f196/fast' failed
make: *** [cmTC_5f196/fast] Error 2
File /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </usr/local/cuda/include/CL/cl.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef CL_VERSION_2_1
return ((int*)(&CL_VERSION_2_1))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the CL_VERSION_2_0 exist failed with the following output:
Change Dir: /mnt/LightGBM/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_08c2a/fast"
/usr/bin/make -f CMakeFiles/cmTC_08c2a.dir/build.make CMakeFiles/cmTC_08c2a.dir/build
make[1]: Entering directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_08c2a.dir/CheckSymbolExists.c.o
/usr/bin/cc -I/usr/local/cuda/include -o CMakeFiles/cmTC_08c2a.dir/CheckSymbolExists.c.o -c /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘CL_VERSION_2_0’ undeclared (first use in this function); did you mean ‘CL_VERSION_1_0’?
return ((int*)(&CL_VERSION_2_0))[argc];
^~~~~~~~~~~~~~
CL_VERSION_1_0
/mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_08c2a.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_08c2a.dir/CheckSymbolExists.c.o' failed
make[1]: *** [CMakeFiles/cmTC_08c2a.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/mnt/LightGBM/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_08c2a/fast' failed
make: *** [cmTC_08c2a/fast] Error 2
File /mnt/LightGBM/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </usr/local/cuda/include/CL/cl.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef CL_VERSION_2_0
return ((int*)(&CL_VERSION_2_0))[argc];
#else
(void)argc;
return 0;
#endif
}
The text was updated successfully, but these errors were encountered: