Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

[xar] Fix CMake build #50

Closed
wants to merge 1 commit into from
Closed

Conversation

wrigby
Copy link
Contributor

@wrigby wrigby commented Apr 22, 2022

D31507009 moved the logging macros to a different header, but this header
wasn't added to CMakeLists. This diff fixes the CMake build.

Tested with:

mkdir build; cd build; cmake ..; make

Fixes #49

@facebook-github-bot
Copy link
Contributor

Hi @wrigby!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

D31507009 moved the logging macros to a different header, but this header
wasn't added to CMakeLists. This diff fixes the CMake build.

Tested with:

```
mkdir build; cd build; cmake ..; make
```
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@wrigby
Copy link
Contributor Author

wrigby commented Apr 22, 2022

Woops. I didn't even notice that this was already fixed by #48 . I guess I'll leave this up here and let @cooperlees decide which one to merge 🤪

Copy link
Contributor

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks. Lets try and get this merged.

@facebook-github-bot
Copy link
Contributor

@cooperlees has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@wrigby
Copy link
Contributor Author

wrigby commented Apr 22, 2022

@cooperlees Heads up - if you haven't landed this yet, I think this diff doesn't actually work for GCC builds. I only tested on macOS / Clang last night, but while trying to get the CircleCI config fixed today, linking the tests failed.

#48 builds cleanly, though.

Full failing build output (on an Ubuntu CircleCI image):

====>> Build
  #!/bin/bash -eo pipefail
cmake -DXAR_BUILD_TESTS=ON . && make VERBOSE=1

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found GTest: /usr/local/lib/libgtest.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/circleci/project
/usr/bin/cmake -S/home/circleci/project -B/home/circleci/project --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/circleci/project/CMakeFiles /home/circleci/project/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/circleci/project'
make -f CMakeFiles/Logging.dir/build.make CMakeFiles/Logging.dir/depend
make[2]: Entering directory '/home/circleci/project'
cd /home/circleci/project && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project/CMakeFiles/Logging.dir/DependInfo.cmake --color=
Dependee "/home/circleci/project/CMakeFiles/Logging.dir/DependInfo.cmake" is newer than depender "/home/circleci/project/CMakeFiles/Logging.dir/depend.internal".
Dependee "/home/circleci/project/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/circleci/project/CMakeFiles/Logging.dir/depend.internal".
Scanning dependencies of target Logging
make[2]: Leaving directory '/home/circleci/project'
make -f CMakeFiles/Logging.dir/build.make CMakeFiles/Logging.dir/build
make[2]: Entering directory '/home/circleci/project'
[ 11%] Building CXX object CMakeFiles/Logging.dir/xar/Logging.cpp.o
/usr/bin/c++    -std=gnu++17 -o CMakeFiles/Logging.dir/xar/Logging.cpp.o -c /home/circleci/project/xar/Logging.cpp
[ 22%] Linking CXX static library libLogging.a
/usr/bin/cmake -P CMakeFiles/Logging.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/Logging.dir/link.txt --verbose=1
/usr/bin/ar qc libLogging.a  CMakeFiles/Logging.dir/xar/Logging.cpp.o
/usr/bin/ranlib libLogging.a
make[2]: Leaving directory '/home/circleci/project'
[ 22%] Built target Logging
make -f CMakeFiles/XarHelperLib.dir/build.make CMakeFiles/XarHelperLib.dir/depend
make[2]: Entering directory '/home/circleci/project'
cd /home/circleci/project && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project/CMakeFiles/XarHelperLib.dir/DependInfo.cmake --color=
Dependee "/home/circleci/project/CMakeFiles/XarHelperLib.dir/DependInfo.cmake" is newer than depender "/home/circleci/project/CMakeFiles/XarHelperLib.dir/depend.internal".
Dependee "/home/circleci/project/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/circleci/project/CMakeFiles/XarHelperLib.dir/depend.internal".
Scanning dependencies of target XarHelperLib
make[2]: Leaving directory '/home/circleci/project'
make -f CMakeFiles/XarHelperLib.dir/build.make CMakeFiles/XarHelperLib.dir/build
make[2]: Entering directory '/home/circleci/project'
[ 33%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o
/usr/bin/c++   -I/home/circleci/project  -std=gnu++17 -o CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o -c /home/circleci/project/xar/XarHelpers.cpp
[ 44%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarLinux.cpp.o
/usr/bin/c++   -I/home/circleci/project  -std=gnu++17 -o CMakeFiles/XarHelperLib.dir/xar/XarLinux.cpp.o -c /home/circleci/project/xar/XarLinux.cpp
[ 55%] Linking CXX static library libXarHelperLib.a
/usr/bin/cmake -P CMakeFiles/XarHelperLib.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/XarHelperLib.dir/link.txt --verbose=1
/usr/bin/ar qc libXarHelperLib.a  CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o CMakeFiles/XarHelperLib.dir/xar/XarLinux.cpp.o
/usr/bin/ranlib libXarHelperLib.a
make[2]: Leaving directory '/home/circleci/project'
[ 55%] Built target XarHelperLib
make -f CMakeFiles/XarTests.dir/build.make CMakeFiles/XarTests.dir/depend
make[2]: Entering directory '/home/circleci/project'
cd /home/circleci/project && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project /home/circleci/project/CMakeFiles/XarTests.dir/DependInfo.cmake --color=
Dependee "/home/circleci/project/CMakeFiles/XarTests.dir/DependInfo.cmake" is newer than depender "/home/circleci/project/CMakeFiles/XarTests.dir/depend.internal".
Dependee "/home/circleci/project/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/circleci/project/CMakeFiles/XarTests.dir/depend.internal".
Scanning dependencies of target XarTests
make[2]: Leaving directory '/home/circleci/project'
make -f CMakeFiles/XarTests.dir/build.make CMakeFiles/XarTests.dir/build
make[2]: Entering directory '/home/circleci/project'
[ 66%] Building CXX object CMakeFiles/XarTests.dir/xar/XarHelpersTest.cpp.o
/usr/bin/c++   -I/home/circleci/project  -std=gnu++17 -o CMakeFiles/XarTests.dir/xar/XarHelpersTest.cpp.o -c /home/circleci/project/xar/XarHelpersTest.cpp
[ 77%] Linking CXX executable XarTests
/usr/bin/cmake -E cmake_link_script CMakeFiles/XarTests.dir/link.txt --verbose=1
/usr/bin/c++     CMakeFiles/XarTests.dir/xar/XarHelpersTest.cpp.o  -o XarTests  libLogging.a libXarHelperLib.a /usr/local/lib/libgtest.a /usr/local/lib/libgtest_main.a /usr/local/lib/libgtest.a -lpthread
/usr/bin/ld: libXarHelperLib.a(XarHelpers.cpp.o): in function `tools::xar::read_xar_header[abi:cxx11](char const*)':
XarHelpers.cpp:(.text+0x2a5): undefined reference to `tools::xar::detail::LogFatal::~LogFatal()'
/usr/bin/ld: XarHelpers.cpp:(.text+0x3e2): undefined reference to `tools::xar::detail::LogFatal::~LogFatal()'
/usr/bin/ld: XarHelpers.cpp:(.text+0x635): undefined reference to `tools::xar::detail::LogFatal::~LogFatal()'
/usr/bin/ld: XarHelpers.cpp:(.text+0x7a0): undefined reference to `tools::xar::detail::LogFatal::~LogFatal()'
/usr/bin/ld: XarHelpers.cpp:(.text+0xa98): undefined reference to `tools::xar::detail::LogFatal::~LogFatal()'
/usr/bin/ld: libXarHelperLib.a(XarHelpers.cpp.o):XarHelpers.cpp:(.text+0xbd7): more undefined references to `tools::xar::detail::LogFatal::~LogFatal()' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/XarTests.dir/build.make:89: XarTests] Error 1
make[2]: Leaving directory '/home/circleci/project'
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/XarTests.dir/all] Error 2
make[1]: Leaving directory '/home/circleci/project'
make: *** [Makefile:141: all] Error 2

@cooperlees
Copy link
Contributor

Yeah, sorry mate. This is the same as 48. Hopefully someone (internally) approves those today and we can merge. And then this can be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake build broken since D31507009
3 participants