facebookincubator / xar

executable archive format
Other
1.58k stars 56 forks source link

CMake build broken since D31507009 #49

Closed wrigby closed 2 years ago

wrigby commented 2 years ago

I'm guessing this diff updated the TARGETS file, but didn't keep CMakeLists up to date. I have very little CMake experience, but I'll try to put up a PR to fix this when I have a chance to dig in a little more.

Side question - are the CMakeLists generated by a tool from TARGETS files, or do people have to keep them up-to-date manually?

Current State

$ git checkout a4c59465d7550c0e26041114d213076bc9ad49ac
Previous HEAD position was 750f829 improve switch statement handling in XarParser.cpp
HEAD is now at a4c5946 Move logging macros to separate header and prefix with XAR_
$ mkdir build
$ cd build
$ cmake ..
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/wrigby/src/github.com/facebookincubator/xar/build
$ make
[ 20%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o
[ 40%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarMacOS.cpp.o
[ 60%] Linking CXX static library libXarHelperLib.a
[ 60%] Built target XarHelperLib
[ 80%] Building CXX object CMakeFiles/xarexec_fuse.dir/xar/XarExecFuse.cpp.o
[100%] Linking CXX executable xarexec_fuse
Undefined symbols for architecture arm64:
  "tools::xar::detail::LogFatal::~LogFatal()", referenced from:
      _main in XarExecFuse.cpp.o
      (anonymous namespace)::grab_lock(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in XarExecFuse.cpp.o
      (anonymous namespace)::is_squashfuse_mounted(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) in XarExecFuse.cpp.o
      (anonymous namespace)::check_file_sanity(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, (anonymous namespace)::Expectation, unsigned short) in XarExecFuse.cpp.o
      (anonymous namespace)::sanitize_file_descriptors() in XarExecFuse.cpp.o
      tools::xar::is_user_in_group(unsigned int) in libXarHelperLib.a(XarMacOS.cpp.o)
      tools::xar::close_non_std_fds() in libXarHelperLib.a(XarMacOS.cpp.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xarexec_fuse] Error 1
make[1]: *** [CMakeFiles/xarexec_fuse.dir/all] Error 2
make: *** [all] Error 2

Last working state

$ git checkout 750f829f71791b75ab051dd3a7edcb6bed5c980b
HEAD is now at 750f829 improve switch statement handling in XarParser.cpp
$ mkdir build
$ cd build
$ cmake ..
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/wrigby/src/github.com/facebookincubator/xar/build
$ make
[ 20%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o
[ 40%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarMacOS.cpp.o
[ 60%] Linking CXX static library libXarHelperLib.a
[ 60%] Built target XarHelperLib
[ 80%] Building CXX object CMakeFiles/xarexec_fuse.dir/xar/XarExecFuse.cpp.o
[100%] Linking CXX executable xarexec_fuse
[100%] Built target xarexec_fuse
wrigby commented 2 years ago

Merging #48 or #50 will fix this :)

cooperlees commented 2 years ago

Side question - are the CMakeLists generated by a tool from TARGETS files, or do people have to keep them up-to-date manually?

Manually - But there is usually CI building with CMake to catch this. Not sure if XAR has this internally.