[Ubuntu 16.04] TVM building error : FOUNDATION_LIB are used in this project, but they are set to NOTFOUND

-- Building Relay in debug mode...
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FOUNDATION_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
METAL_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
MPS_CONTRIB_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
NNPACK_CLOG_CONTRIB_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
NNPACK_CONTRIB_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
NNPACK_CPUINFO_CONTRIB_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm
NNPACK_PTHREAD_CONTRIB_LIB
    linked by target "tvm_topi" in directory /home/lukuan/tvm
    linked by target "tvm" in directory /home/lukuan/tvm
    linked by target "tvm_runtime" in directory /home/lukuan/tvm

How do I fix this? thanks

Hi lk1983823,

can you see what happens if you add tvm to the CMAKE_LIBRARY_PATH :

`

export CMAKE_LIBRARY_PATH=$CMAKE_LIBRARY_PATH:$HOME/path/to/tvm

`

hope helps,

It doesn’t work. :pensive: Still the same outputs.

The log error is:
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_3995b/fast"
/usr/bin/make -f CMakeFiles/cmTC_3995b.dir/build.make CMakeFiles/cmTC_3995b.dir/build
make[1]: Entering directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3995b.dir/CheckSymbolExists.c.o
/usr/bin/cc    -fPIC    -o CMakeFiles/cmTC_3995b.dir/CheckSymbolExists.c.o   -c /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_3995b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3995b.dir/link.txt --verbose=1
/usr/bin/cc  -fPIC     CMakeFiles/cmTC_3995b.dir/CheckSymbolExists.c.o  -o cmTC_3995b -rdynamic 
CMakeFiles/cmTC_3995b.dir/CheckSymbolExists.c.o:在函数‘main’中:
CheckSymbolExists.c:(.text+0x1b):对‘pthread_create’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_3995b.dir/build.make:97: recipe for target 'cmTC_3995b' failed
make[1]: *** [cmTC_3995b] Error 1
make[1]: Leaving directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_3995b/fast' failed
make: *** [cmTC_3995b/fast] Error 2

File /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_e2117/fast"
/usr/bin/make -f CMakeFiles/cmTC_e2117.dir/build.make CMakeFiles/cmTC_e2117.dir/build
make[1]: Entering directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e2117.dir/CheckFunctionExists.c.o
/usr/bin/cc    -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_e2117.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_e2117
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e2117.dir/link.txt --verbose=1
/usr/bin/cc  -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_e2117.dir/CheckFunctionExists.c.o  -o cmTC_e2117 -rdynamic -lpthreads 
/usr/bin/ld: 找不到 -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_e2117.dir/build.make:97: recipe for target 'cmTC_e2117' failed
make[1]: *** [cmTC_e2117] Error 1
make[1]: Leaving directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_e2117/fast' failed
make: *** [cmTC_e2117/fast] Error 2


Determining if the CL_VERSION_2_0 exist failed with the following output:
Change Dir: /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_8e520/fast"
/usr/bin/make -f CMakeFiles/cmTC_8e520.dir/build.make CMakeFiles/cmTC_8e520.dir/build
make[1]: Entering directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_8e520.dir/CheckSymbolExists.c.o
/usr/bin/cc   -I/usr/local/cuda-10.0/include  -O2 -Wall -fPIC     -o CMakeFiles/cmTC_8e520.dir/CheckSymbolExists.c.o   -c /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘CL_VERSION_2_0’ undeclared (first use in this function)
   return ((int*)(&CL_VERSION_2_0))[argc];
                   ^
/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_8e520.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_8e520.dir/CheckSymbolExists.c.o' failed
make[1]: *** [CMakeFiles/cmTC_8e520.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_8e520/fast' failed
make: *** [cmTC_8e520/fast] Error 2

File /home/lukuan/lk_git/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </usr/local/cuda-10.0/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
}

Have you solved the problem? I catch the same error when compile TVM-v0.4 with cmake-3.11 and cuda-9.0,

    /tvm/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];


    File /cross_compile/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
      22 /* */
      23 #include </usr/local/cuda-9.0/include/CL/cl.h>
      24
      25 int main(int argc, char** argv)
      26 {
      27   (void)argv;
      28 #ifndef CL_VERSION_2_0
      29   return ((int*)(&CL_VERSION_2_0))[argc];
      30 #else
      31   (void)argc;
      32   return 0;
      33 #endif

And the file /usr/local/cuda-9.0/include/CL/cl.h does not have CL_VERSION_2_0 defined.

Set them off and it works. I only used CUDA & llvm.

I have set OPENCL OFF in CMakelists and cmake/config.camke,but also doesn’t work。It is strange that I’ve compiled it before with the latest TVM successfully but TVM-v0.4 failed ,now the latest version failed either:(
Could you please paste the config commands, thanks ~
Part of CmakeError.log
Determining if the CL_VERSION_1_0 exist failed with the following output:
167 Change Dir: /home1/marong/tvm/build/CMakeFiles/CMakeTmp
168
169 Run Build Command:"/usr/bin/make" “cmTC_88728/fast”
170 /usr/bin/make -f CMakeFiles/cmTC_88728.dir/build.make CMakeFiles/cmTC_88728.dir/build
171 make[1]: Entering directory ‘/home1/marong/tvm/build/CMakeFiles/CMakeTmp’
172 Building C object CMakeFiles/cmTC_88728.dir/CheckSymbolExists.c.o
173 /home1/marong/arm-toolchain/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -O2 -Wall -fPIC -o CMakeFiles/cmTC_88728.dir/ CheckSymbolExists.c.o -c /home1/marong/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
174 /home1/marong/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:10: fatal error: OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h: No such file or directory
175 #include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>
176 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177 compilation terminated.
178 CMakeFiles/cmTC_88728.dir/build.make:65: recipe for target ‘CMakeFiles/cmTC_88728.dir/CheckSymbolExists.c.o’ failed
179 make[1]: *** [CMakeFiles/cmTC_88728.dir/CheckSymbolExists.c.o] Error 1
180 make[1]: Leaving directory ‘/home1/marong/tvm/build/CMakeFiles/CMakeTmp’
181 Makefile:126: recipe for target ‘cmTC_88728/fast’ failed
182 make: *** [cmTC_88728/fast] Error 2
183
184 File /home1/marong/tvm/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
185 /* /
186 #include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>
187
188 int main(int argc, char
* argv)
189 {
190 (void)argv;
191 #ifndef CL_VERSION_1_0
192 return ((int*)(&CL_VERSION_1_0))[argc];
193 #else
194 (void)argc;
195 return 0;
196 #endif
197 }

have you solved the problem?

The issue is solved by set(USE_NNPACK OFF)