ios – ExternalProject_Add LOG_BUILD and make, results in truncated/incorrect build output

[ad_1]

When building on MacOS Monterey 12.2.1 and using cmake (version 3.23.0-rc4) I am running into the following issue. I use ExternalProject_Add to build an in source version of openssl for my project. Here is the cmake statements that do that:

  ExternalProject_Add(openssl
    LOG_MERGED_STDOUTERR ON
    LOG_DOWNLOAD ON
    LOG_CONFIGURE ON
    LOG_BUILD ON
    LOG_INSTALL ON
    DOWNLOAD_COMMAND /bin/sh
      ${CMAKE_CURRENT_SOURCE_DIR}/scripts/clone.openssl.sh
      ${CMAKE_BINARY_DIR}
      ${OPENSSL_REPO}
    SOURCE_DIR "${CMAKE_BINARY_DIR}/openssl-src"
    BINARY_DIR "${CMAKE_BINARY_DIR}/openssl-build"
    CONFIGURE_COMMAND /bin/sh
      ${CMAKE_CURRENT_SOURCE_DIR}/scripts/configure.openssl.sh
      ${CMAKE_BINARY_DIR}
    BUILD_COMMAND /bin/sh
      ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build.openssl.sh
      ${CMAKE_BINARY_DIR}
    INSTALL_COMMAND /bin/sh
      ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build.openssl.sh
      ${CMAKE_BINARY_DIR}
    TEST_COMMAND "")

I am running into a situation where I need to look at the commands being invoked while building and linking openssl. However, when I go to look at the logs generated from ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build.openssl.sh the all I see is:

Going to build openssl in /Users/matthew.hoggan/Devel/build/gitlab/mehoggan/dag_scheduler with /usr/bin/make...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-async_null.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-async_win.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-cms_cd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-dso_dl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-dso_openssl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-dso_vms.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-dso_win32.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-f_impl32.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-e_rc5.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(libcrypto-lib-ebcdic.o) has no symbols
...

When I just invoke the script from the command prompt (not from cmake) I actually see what I am expect. That is the line by line compilation commands generated by openssl’s makefile. What is cmake doing to prevent the build commands from going to the log file displayed above?

The contents of ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build.openssl.sh is:

BUILD_DIR=${1}

MAKE_CMD=$(which make)
echo "Going to build openssl in ${BUILD_DIR} with ${MAKE_CMD}..."

cd ${BUILD_DIR}/openssl-src && \
  export CC="/usr/bin/clang" && \
  export CXX="/usr/bin/clang++" && \
  export AR="/usr/bin/ar" && \
  export RANLIB="/usr/bin/ranlib" && \
  export LD="/usr/bin/ld" && \
  export LIBTOOL="/usr/bin/libtool" && \
  /usr/bin/make clean all # I set MAKE_CMD and print it to ensure I am using what I expect.

[ad_2]

Source link

Leave a Reply

Your email address will not be published.