Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building llvm 9 fails on macOS 10.15 #17

Open
mrArkwright opened this issue Jan 2, 2021 · 1 comment
Open

Building llvm 9 fails on macOS 10.15 #17

mrArkwright opened this issue Jan 2, 2021 · 1 comment

Comments

@mrArkwright
Copy link

Building llvm 9 with brew install --build-from-source llvm-hs/llvm/llvm-9 fails on macOS 10.15 on my machine.

The macports community already found a fix for this: https://trac.macports.org/ticket/61477. The ticket concerns macOS 11.0 but as far as I understand this also applies to 10.15 if MacOSX11.0.sdk is present (macports/macports-ports@eabdb0e). The error I'm getting is the exact same as in that ticket:

:info:build [ 27%] Building C object lib/Support/CMakeFiles/LLVMSupport.dir/regexec.c.o
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/build/lib/Support && /usr/bin/clang -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/build/lib/Support -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/lib/Support -I/opt/local/include/libxml2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/build/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/include -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -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 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -mmacosx-version-min=11.0 -o CMakeFiles/LLVMSupport.dir/regexec.c.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/lib/Support/regexec.c
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:169:31: error: invalid application of 'sizeof' to an incomplete type 'struct stat64'
:info:build   unsigned struct_stat64_sz = sizeof(struct stat64);
:info:build                               ^     ~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:169:45: note: forward declaration of '__sanitizer::stat64'
:info:build   unsigned struct_stat64_sz = sizeof(struct stat64);
:info:build                                             ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:195:33: error: invalid application of 'sizeof' to an incomplete type 'struct statfs64'
:info:build   unsigned struct_statfs64_sz = sizeof(struct statfs64);
:info:build                                 ^     ~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-9.0/clang-9.0/work/llvm-9.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:195:47: note: forward declaration of '__sanitizer::statfs64'
:info:build   unsigned struct_statfs64_sz = sizeof(struct statfs64);
:info:build                                               ^
:info:build 2 errors generated.
:info:build make[2]: *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoHooks.osx.dir/sanitizer_platform_limits_posix.cc.o] Error 1

Setting -DDARWIN_osx_ARCHS="x86_64;x86_64h" seems to resolve the issue. However when -DLLVM_BUILD_EXTERNAL_COMPILER_RT is used that setting doesn't seem to be taken into account. Finally to make the build work without -DLLVM_BUILD_EXTERNAL_COMPILER_RT again I also had to specify -DCMAKE_OSX_ARCHITECTURES="x86_64".

Is removing -DLLVM_BUILD_EXTERNAL_COMPILER_RT a problem? To be honest I'm not sure why it was turned on and what the implications of turning it off are. For my compiler project with llvm-hs the build works fine.

@tmcdonell
Copy link
Member

tmcdonell commented Jan 6, 2021

I'm still on 10.14 but I'll see if I can find a 10.15 box to try it on.

The -DLLVM_BUILD_EXTERNAL_COMPILER_RT flag was required to fix some other problem a long time ago, but maybe it's not necessary anymore (maybe when building for aarch64?) so perhaps we can remove it.

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

No branches or pull requests

2 participants