KataGo icon indicating copy to clipboard operation
KataGo copied to clipboard

Error compiling: clang: error: linker command failed with exit code 1 (use -v to see invocation)

Open trunterzx opened this issue 1 year ago • 2 comments

I tried to compile the latest version of KataGo on my M2 Mac and the below error happened:

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [katago] Error 1
make[1]: *** [CMakeFiles/katago.dir/all] Error 2
make: *** [all] Error 2

The make process went to 100% without any errors so I thought it was okay, but this was displayed at the last line. Does anybody know what this is and how to fix it?

trunterzx avatar Jan 14 '24 16:01 trunterzx

This is the entire line after the make process went to 100%

[100%] Linking CXX executable katago
ld: warning: ignoring file '/usr/local/Cellar/libzip/1.10.1/lib/libzip.5.5.dylib': found architecture 'x86_64', required architecture 'arm64'
ld: Undefined symbols:
  _zip_close, referenced from:
      ZipFile::close() in numpywrite.cpp.o
  _zip_discard, referenced from:
      ZipFile::~ZipFile() in numpywrite.cpp.o
      ZipFile::~ZipFile() in numpywrite.cpp.o
  _zip_error_fini, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_error_init, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_error_strerror, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_file_add, referenced from:
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_open_from_source, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
  _zip_source_buffer, referenced from:
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_source_file_create, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
  _zip_source_free, referenced from:
      ZipFile::ZipFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in numpywrite.cpp.o
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
  _zip_strerror, referenced from:
      ZipFile::writeBuffer(char const*, void*, unsigned long long) in numpywrite.cpp.o
      ZipFile::close() in numpywrite.cpp.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [katago] Error 1
make[1]: *** [CMakeFiles/katago.dir/all] Error 2
make: *** [all] Error 2

trunterzx avatar Jan 14 '24 16:01 trunterzx

Okay it seems like my libzip library had issues. It ended successfully after I uninstalled the libzip library.

But I wonder what the issue was.

trunterzx avatar Jan 14 '24 17:01 trunterzx