[llvm-dev] Build breakage on MacOS - one fixed, one not.

Mark R V Murray via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 4 01:13:50 PDT 2019


Hi

In getting my MC6809-targeting compiler to work, I've run into a couple of MacOS/Darwin snags.

This one I fixed a while back:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f424ed9ab0..e4173533697 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -882,6 +882,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
   link_directories("/usr/local/lib")
 endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")

+if(${CMAKE_SYSTEM_NAME} MATCHES "(Darwin)")
+  # On MacOS, /opt/local/* is not used by default. In order to build LLVM
+  # with libxml2, iconv.h, etc., we must add /opt/local paths.
+  include_directories(SYSTEM "/opt/local/include")
+  link_directories("/opt/local/lib")
+endif(${CMAKE_SYSTEM_NAME} MATCHES "(Darwin)")
+
 if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
    # special hack for Solaris to handle crazy system sys/regset.h
    include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")


The newest is this, and I'm not sure what to do about it. It seems to be a commit from 3rd April to the projects/openmp/... hierarchy.

$ cmake -DCMAKE_BUILD_TYPE:STRING="Debug" -G'Unix Makefiles' ../llvm/
:
:
:
-- OSX supported arches: x86_64;x86_64h
-- Using cached valid architectures for iossim.
-- ios Simulator supported builtin arches: i386;x86_64
-- Using cached valid architectures for ios.
-- ios supported builtin arches: armv6;armv7;armv7s;arm64;arm64e;armv7k
-- Builtin supported architectures: i386;x86_64;x86_64h;armv7;armv7k;armv7s;arm64
-- check-interception does nothing.
-- Generated Sanitizer SUPPORTED_TOOLS list on "Darwin" is "asan;lsan;tsan;ubsan"
-- sanitizer_common tests on "Darwin" will run against "asan;lsan;tsan;ubsan"
-- Performing Test OPENMP_HAVE_WERROR_FLAG
-- Performing Test OPENMP_HAVE_WERROR_FLAG - Success
-- Performing Test OPENMP_HAVE_STD_GNUPP11_FLAG
-- Performing Test OPENMP_HAVE_STD_GNUPP11_FLAG - Success
-- Performing Test OPENMP_HAVE_STD_CPP11_FLAG
-- Performing Test OPENMP_HAVE_STD_CPP11_FLAG - Success
CMake Error at projects/openmp/cmake/OpenMPTesting.cmake:126 (if):
  if given arguments:

    "STREQUAL" "-lpthread"

  Unknown arguments specified
Call Stack (most recent call first):
  projects/openmp/CMakeLists.txt:49 (include)


-- Configuring incomplete, errors occurred!
See also "/usr/local/src/llvm/build/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/llvm/build/CMakeFiles/CMakeError.log".

The relavant bits from /usr/local/src/llvm/build/CMakeFiles/CMakeError.log are:

Linking C executable cmTC_3d069
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3d069.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -fPIC -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  -arch armv7em  -stdlib=libc++ -lc++ -lc++abi -fapplication-extension -miphoneos-version-min=8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk  CMakeFiles/cmTC_3d069.dir/src.c.o  -o cmTC_3d069
clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
ld: warning: No version-min specified on command line
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/lib/macho_embedded/libclang_rt.hard_pic.a, missing required architecture armv7em in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/lib/macho_embedded/libclang_rt.hard_pic.a (3 slices)
Undefined symbols for architecture armv7em:
  "_printf", referenced from:
      _main in src.c.o
ld: symbol(s) not found for architecture armv7em
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_3d069] Error 1
make: *** [cmTC_3d069/fast] Error 2

Testing compiler for supporting FLAGS-fxray-instrument:
Command: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc;;;;-fPIC;-Werror=date-time;-Werror=unguarded-availability-new;-Wall;-Wextra;-Wno-unused-parameter;-Wwrite-strings;-Wmissing-field-initializers;-pedantic;-Wno-long-long;-Wimplicit-fallthrough;-Wcovered-switch-default;-Wdelete-non-virtual-dtor;-Wstring-conversion;-Wall;-Wno-unused-parameter;-fxray-instrument;-o;/usr/local/src/llvm/build/CMakeFiles/test.o;;;-c;/usr/local/src/llvm/build/CMakeFiles/src.c

clang: error: the clang compiler does not support '-fxray-instrument on x86_64-apple-darwin18.5.0'

1
-- 
Mark R V Murray



More information about the llvm-dev mailing list