Opened 4 years ago

Closed 4 years ago

#57694 closed defect (fixed)

clang-6.0: build fails in compiler_rt on < SnowLeopard due to fatal error: 'dispatch/dispatch.h' file not found

Reported by: kencu (Ken) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version:
Keywords: tiger leopard Cc:
Port: clang-6.0

Description

libdispatch is available on SnowLeopard and newer:

:info:build [ 12%] Building C object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_x86_64_10.4.dir/os_version_check.c.o
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-6.0/clang-6.0/work/build/projects/compiler-rt/lib/builtins && /opt/local/bin/clang-mp-3.7 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -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-6.0/clang-6.0/work/build/projects/compiler-rt/lib/builtins -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-6.0/clang-6.0/work/llvm-6.0.1.src/projects/compiler-rt/lib/builtins -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-6.0/clang-6.0/work/build/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-6.0/clang-6.0/work/llvm-6.0.1.src/include  -DNDEBUG -arch x86_64    -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -arch x86_64 -o CMakeFiles/clang_rt.builtins_x86_64_10.4.dir/os_version_check.c.o   -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-6.0/clang-6.0/work/llvm-6.0.1.src/projects/compiler-rt/lib/builtins/os_version_check.c
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-6.0/clang-6.0/work/llvm-6.0.1.src/projects/compiler-rt/lib/builtins/os_version_check.c:19:10: fatal error: 'dispatch/dispatch.h' file not found
:info:build #include <dispatch/dispatch.h>
:info:build          ^
:info:build 1 error generated.

Attachments (2)

clang-6-fail-leopard-no-dispatch.log (2.6 MB) - added by kencu (Ken) 4 years ago.
ken_os_version_check_clang-6.c (7.3 KB) - added by kencu (Ken) 4 years ago.
my patched version of os_version_check.c with a small test prog added on the bottom

Change History (6)

Changed 4 years ago by kencu (Ken)

comment:1 Changed 4 years ago by kencu (Ken)

Keywords: tiger leopard added

comment:3 Changed 4 years ago by kencu (Ken)

I'll put up the patched version of compiler-rt/lib/builtins/os_version_check.c with a small test program attached to it to drive it.

It works for me on 10.4 and up, building it with:

clang -Wall -framework CoreFoundatation -o test_osversion ken_os_version_check_clang-6.c

or

gcc -Wall -framework CoreFoundatation -o test_osversion ken_os_version_check_clang-6.c

Interestingly, if you don't link in CoreFoundation the code does not error, but does not actually run the test or do anything either. Should probably return "-1" or something in that case, but have to ask the compiler_rt guys about that I guess :>

Changed 4 years ago by kencu (Ken)

my patched version of os_version_check.c with a small test prog added on the bottom

comment:4 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In c35b1701f54cb5a048f8821641d8ecdf524bf989/macports-ports (master):

clang-6.0: fix build on leopard Intel

work around compiler_rt build error due to
no libdispatch on Leopard

disables santizer_common which presently doesn't build on Leopard

add fallback to clang-3.7 and clang-3.9

closes: #55444
closes: #57694

Note: See TracTickets for help on using tickets.