CMake build error when using XNNPACK_USE_SYSTEM_LIBS=ON
- Dominant language
- C
- Stars
- 2.5k
- Forks
- 560
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 160
Description
I'm trying to write a [Spack](https://spack.io) package for XNNPACK. Specifically, I'm trying to allow the build to work using the `-DXNNPACK_USE_SYSTEM_LIBS=ON` flag. The exact command looks like:
```console
$ 'cmake' '-G' 'Ninja' '-DCMAKE_INSTALL_PREFIX:STRING=/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/xnnpack-master-weclozv2jr5am4c6ldp5gjemdvwweofg' '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF' '-DCMAKE_INSTALL_RPATH:STRING=/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/xnnpack-master-weclozv2jr5am4c6ldp5gjemdvwweofg/lib;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/xnnpack-master-weclozv2jr5am4c6ldp5gjemdvwweofg/lib64;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/cpuinfo-master-v7xymxuy5jo7i3vywztjwjorrrbd6jzo/lib;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/pthreadpool-master-wkwnldyirs6n6hf6jbwgicfvdcfsdh7p/lib' '-DCMAKE_PREFIX_PATH:STRING=/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/cmake-3.20.3-lpjhnv4pz77i3mysbgxysdnlevd237wg;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/cpuinfo-master-v7xymxuy5jo7i3vywztjwjorrrbd6jzo;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/fp16-master-2vag2hkk6cushbrfebtwclvxex6oqy5y;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/ninja-1.10.2-jjbyyjxkir52fgtfhdatowkjdbbwr6nm;/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/pthreadpool-master-wkwnldyirs6n6hf6jbwgicfvdcfsdh7p' '-DXNNPACK_USE_SYSTEM_LIBS:BOOL=ON' '/tmp/t-astewart/spack-stage/spack-stage-xnnpack-master-weclozv2jr5am4c6ldp5gjemdvwweofg/spack-src'
```
During CMake configuration, I get thousands of lines of error messages like:
```
CMake Error at CMakeLists.txt:3416 (ADD_LIBRARY):
ADD_LIBRARY cannot create target "XNNPACK" because another target with the
same name already exists. The existing target is a static library created
in source directory
"/tmp/t-astewart/spack-stage/spack-stage-xnnpack-master-weclozv2jr5am4c6ldp5gjemdvwweofg/spack-src".
See documentation for policy CMP0002 for more details.
```
See the following build log:
* [spack-build-out.txt](https://github.com/google/XNNPACK/files/6652496/spack-build-out.txt)
Any idea what could be causing this?
P.S. Would anyone be interested in being listed as the official maintainer of XNNPACK? You don't have to know anything about Spack, it just gives us someone to ping when a user reports build issues or wants to modify the build recipe.
Contributor guide
Assessment
This issue has not been assessed yet.