obfuscator-llvm / obfuscator

3.96k stars 1.18k forks source link

CMake Error at cmake/modules/AddLLVM.cmake:1163 (add_custom_target) #77

Open CT-LU opened 7 years ago

CT-LU commented 7 years ago

cmake version 3.5.1 ubuntu 16.04LTS

I used the instructions below. However i got the unexpected result. Could anyone help me to fix it? Thank you in advance!!

$ git clone -b llvm-4.0 https://github.com/obfuscator-llvm/obfuscator.git

$ mkdir build

$ cd build

$ cmake -DCMAKE_BUILD_TYPE=Release ..

-- Targeting X86 -- Targeting XCore -- Looking for sys/resource.h -- Looking for sys/resource.h - found -- Clang version: 4.0.1 -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed CMake Error at cmake/modules/AddLLVM.cmake:1163 (add_custom_target): add_custom_target cannot create target "check-llvm-bindings-ocaml" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/ludan/disk/projects/0720/Tool/obfuscator/test". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): cmake/modules/AddLLVM.cmake:1226 (add_lit_target) test/CMakeLists.txt:150 (add_lit_testsuites)

-- Configuring incomplete, errors occurred!

kwang1971 commented 7 years ago

I use the following command: cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../myobfuscator/

it seems pass the configuring

skyel1u commented 6 years ago

On ubuntu 16.04 x86_64, Cmake version 3.5.1, clang version 4.0.0-1ubuntu1~16.04.2 (tags/RELEASE_400/rc1). I have the same error when use cmake:

➜  build cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TEST=OFF ../obfuscator
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx disabled.
-- Go bindings disabled.
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting RISCV
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting X86
-- Targeting XCore
-- Clang version: 4.0.1
CMake Error at cmake/modules/AddLLVM.cmake:1163 (add_custom_target):
  add_custom_target cannot create target "check-llvm-bindings-ocaml" because
  another target with the same name already exists.  The existing target is a
  custom target created in source directory "/root/obs/obfuscator/test".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:1226 (add_lit_target)
  test/CMakeLists.txt:150 (add_lit_testsuites)

-- Configuring incomplete, errors occurred!
See also "/root/obs/build/CMakeFiles/CMakeOutput.log".
See also "/root/obs/build/CMakeFiles/CMakeError.log".

It didn't work when I use:cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../obfuscator/


I solved this error, try this: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../obfuscator

Pingmin commented 5 years ago

On Ubuntu 18.04, I got this error too:

...
-- Clang version: 4.0.1
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
CMake Error at cmake/modules/AddLLVM.cmake:1163 (add_custom_target):
  add_custom_target cannot create target "check-llvm-bindings-ocaml" because
  another target with the same name already exists.  The existing target is a
  custom target created in source directory
  "/ddisk/source/obfuscator-git/test".  See documentation for policy CMP0002
  for more details.
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:1226 (add_lit_target)
  test/CMakeLists.txt:150 (add_lit_testsuites)
...

And It works for me by using

$ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ..

Thanks @kwang1971 !