Opened 4 years ago

Closed 3 years ago

#16236 closed bug (fixed)

Build error on MacOS Catalina (gcc/clang detection)

Reported by: eml Owned by: waddlesplash
Priority: normal Milestone: R1/beta3
Component: Build System Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

website ticket reference: https://github.com/haiku/website/pull/380

This is possibly happening because the gcc command is available on Catalina, but it's just an alias for clang. The buildtools are compiling fine. Here is a portion of the output from running jam:

clang: error: '-I-' not supported, please use -iquote instead

gcc -c "../src/kits/storage/sniffer/Rule.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar -fPIC -include ../headers/build/BeOSBuildCompatibility.h -DARCH_x86_64 -D_NO_INLINE_ASM -D__NO_INLINE__ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAIKU_HOST_USE_XATTR -DHAIKU_HOST_PLATFORM_DARWIN -DHAIKU_HOST_PLATFORM_64_BIT -DHAIKU_PACKAGING_ARCH=\"x86_64\" -I../build/user_config_headers -I../build/config_headers -I../src/build/libbe/storage -Iobjects/common/build/libbe/storage -Iobjects/darwin/x86_64/common/build/libbe/storage -Iobjects/haiku/x86_64/common/build/libbe/storage -I../src/kits/storage -I../src/kits/storage/mime -I../src/kits/storage/sniffer -I- -I../headers/build/private/app -I../headers/build/private/kernel -I../headers/build/private/shared -I../headers/build/private/storage -I../headers/build/host/darwin -I../src/build/libgnuregex -I/opt/local/include -I/usr/local/include -I../headers/build -I../headers/build/os -I../headers/build/os/add-ons/registrar -I../headers/build/os/app -I../headers/build/os/bluetooth -I../headers/build/os/drivers -I../headers/build/os/kernel -I../headers/build/os/interface -I../headers/build/os/locale -I../headers/build/os/storage -I../headers/build/os/support -I../headers/build/private -o "objects/darwin/x86_64/release/build/libbe/storage/Rule.o"

...failed C++ objects/darwin/x86_64/release/build/libbe/storage/Rule.o ...

I'm not familiar with jam but I would volunteer to try and fix it, provided I get some pointers in the right direction (i.e. which file is doing the detection of gcc/clang.)

Attachments (1)

BuildConfig (2.9 KB ) - added by eml 4 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by waddlesplash, 4 years ago

Please attach the "build/BuildConfig" file from your "generated" directory; this will show what your host CC is being detected as.

by eml, 4 years ago

Attachment: BuildConfig added

comment:2 by eml, 4 years ago

Done. I think this is relevant too:

mull$generated.x86_64[master ?] gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

comment:3 by waddlesplash, 4 years ago

HOST_CC                     ?= gcc ;
HOST_GCC_RAW_VERSION        ?= 11.0.3 ;

I am willing to bet that Jam somewhere is doing a string comparison of the HOST_GCC_RAW_VERSION instead of an integer conversion, and then this "11" is actually treated as "< 2".

comment:4 by waddlesplash, 4 years ago

RAW_VERSION is parsed here using FAnalyzeGCCVersion, which uses a regular-expression match, so that should be fine at least.

Aha, and indeed, SetIncludePropertiesVariables just gets the first character of the version string. So that is the place to fix, at least for this bug.

comment:5 by kallisti5, 4 years ago

Similar issue on gcc 10

It isn't the "first character" but Jam is doing a string compare.

  • "10" < "3"
  • "10" > "03"

We could work around it by changing GCC version checks to be two digits.

comment:6 by waddlesplash, 4 years ago

Owner: changed from bonefish to waddlesplash
Status: newassigned

The correct solution is to drop the version checks entirely at this point and just check for "legacy" vs "non-legacy" GCC, and let configure do the rest.

comment:7 by kallisti5, 4 years ago

This issue also exists in SetIncludePropertiesVariables at ../build/jam/HelperRules causing the "-I-/-iquote" issues on gcc 10+

SetIncludePropertiesVariables is checking for gcc < 4, so we might need to check for more than GCC2 / !GCC2

I put a "quick" fix here: https://review.haiku-os.org/c/haiku/+/2901 , but given SetIncludePropertiesVariables's usage of non-binary GCC2/!GCC2 it isn't even a complete workaround.

Last edited 4 years ago by kallisti5 (previous) (diff)

comment:8 by kallisti5, 4 years ago

For others running into this. Until a fix is in master, (in your generated directory) just edit your:

build/BuildConfig

Change:

HOST_GCC_RAW_VERSION ?= 10 ; or HOST_GCC_RAW_VERSION ?= 11.0.3 ;

to

HOST_GCC_RAW_VERSION ?= 9 ;

Last edited 4 years ago by kallisti5 (previous) (diff)

comment:9 by korli, 3 years ago

Could this be fixed by hrev54625?

comment:10 by pulkomandy, 3 years ago

Milestone: UnscheduledR1/beta3
Resolution: fixed
Status: assignedclosed

It looks like it, yes.

Note: See TracTickets for help on using tickets.