compiling tests with clang 1[89] issues

22 views
Skip to first unread message

Liviu Ionescu

unread,
Feb 10, 2025, 6:39:11 AMFeb 10
to isl Development
Hi,

I'm compiling isl from sources for the xPack binary distribution of gcc and I noticed that with the latest clang, on arm64 macOS, I get link errors in isl_test_cpp-checked.cc:

libtool: link: /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/xpacks/.bin/clang++ -std=c++11 -std=gnu++17 -ffunction-sections -fdata-sections -pipe -O2 -mmacosx-version-min=11.0 -w -O2 -v -Wl,-v -Wl,-t -Wl,-macosx_version_min -Wl,11.0 -Wl,-headerpad_max_install_names -Wl,-rpath -Wl,/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath -Wl,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib -Wl,-rpath -Wl,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin -o .libs/isl_test_cpp-checked isl_test_cpp-checked.o  -L/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib ./.libs/libisl.dylib /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libgmp.dylib
xPack arm64 clang version 19.1.7 (https://github.com/xpack-dev-tools/clang-xpack 49a26e74a7d5109a4f8e2819f649d492c89bdf77)
Target: aarch64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/bin
 "/usr/bin/ld" -demangle -lto_library /Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/libLTO.dylib -dynamic -arch arm64 -platform_version macos 11.0.0 11.0.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -w -mllvm -enable-linkonceodr-outlining -o .libs/isl_test_cpp-checked -L/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -v -t -macosx_version_min 11.0 -headerpad_max_install_names -rpath /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -rpath /Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib -rpath /Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin isl_test_cpp-checked.o ./.libs/libisl.dylib /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libgmp.dylib -lc++ -lSystem /Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld  PROJECT:ld64-711
BUILD 21:57:24 Nov 17 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
  "std::__1::bad_function_call::~bad_function_call()", referenced from:
      std::__1::__throw_bad_function_call[abi:ne190107]() in isl_test_cpp-checked.o
  "typeinfo for std::__1::bad_function_call", referenced from:
      std::__1::__throw_bad_function_call[abi:ne190107]() in isl_test_cpp-checked.o
  "vtable for std::__1::bad_function_call", referenced from:
      std::__1::__throw_bad_function_call[abi:ne190107]() in isl_test_cpp-checked.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [isl_test_cpp-checked] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I identified the tests that trigger the error and commented them out:

[diff /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc.bak /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc]
368,370c368,370
< test_foreach(ctx);
< test_foreach_scc(ctx);
< test_every(ctx);
---
> // test_foreach(ctx);
> // test_foreach_scc(ctx);
> // test_every(ctx);
373,374c373,374
< test_schedule_tree(ctx);
< test_ast_build(ctx);
---
> // test_schedule_tree(ctx);
> // test_ast_build(ctx);


The link passed, but two tests failed:

/Library/Developer/CommandLineTools/usr/bin/make  check-TESTS
PASS: isl_test
PASS: codegen_test.sh
PASS: pip_test.sh
PASS: bound_test.sh
PASS: isl_test_int
PASS: flow_test.sh
PASS: schedule_test.sh
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/test-driver: line 112: 82526 Abort trap: 6           "$@" >> "$log_file" 2>&1
FAIL: isl_test2
PASS: isl_test_cpp
PASS: isl_test_cpp_failed.sh
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/test-driver: line 112: 82575 Abort trap: 6           "$@" >> "$log_file" 2>&1
FAIL: isl_test_cpp17
PASS: isl_test_cpp17-checked
============================================================================

I updated the build script to ignore the result, and the final build passed.

However I'm not very happy with this kludge, perhaps the issue must be investigated thoroughly and fixed properly.

 The machine is a mac Mini M1, running macOS 11.6.

Sven Verdoolaege

unread,
Feb 10, 2025, 4:41:45 PMFeb 10
to Liviu Ionescu, isl Development
On Mon, Feb 10, 2025 at 03:39:11AM -0800, Liviu Ionescu wrote:
> Hi,
>
> I'm compiling *isl* from sources for the xPack binary distribution of *gcc*
> and I noticed that with the latest clang, on arm64 macOS, I get link errors
> in isl_test_cpp-checked.cc:
>
> libtool: link:
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/xpacks/.bin/clang++
> -std=c++11 -std=gnu++17 -ffunction-sections -fdata-sections -pipe -O2
> -mmacosx-version-min=11.0 -w -O2 -v -Wl,-v -Wl,-t -Wl,-macosx_version_min
> -Wl,11.0 -Wl,-headerpad_max_install_names -Wl,-rpath
> -Wl,/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib
> -Wl,-rpath
> -Wl,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib
> -Wl,-rpath
> -Wl,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin
> -o .libs/isl_test_cpp-checked isl_test_cpp-checked.o

[..]

> I identified the tests that trigger the error and commented them out:
>
> [diff
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc.bak
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc]
> 368,370c368,370
> < test_foreach(ctx);
> < test_foreach_scc(ctx);
> < test_every(ctx);
> ---
> > // test_foreach(ctx);
> > // test_foreach_scc(ctx);
> > // test_every(ctx);
> 373,374c373,374
> < test_schedule_tree(ctx);
> < test_ast_build(ctx);
> ---
> > // test_schedule_tree(ctx);
> > // test_ast_build(ctx);

How did you manage to fix isl_test_cpp-checked compilation issues
by modifying isl_test_cpp.cc?

> The link passed, but two tests failed:
>
> /Library/Developer/CommandLineTools/usr/bin/make check-TESTS
> PASS: isl_test
> PASS: codegen_test.sh
> PASS: pip_test.sh
> PASS: bound_test.sh
> PASS: isl_test_int
> PASS: flow_test.sh
> PASS: schedule_test.sh
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/test-driver:
> line 112: 82526 Abort trap: 6 "$@" >> "$log_file" 2>&1
> FAIL: isl_test2
> PASS: isl_test_cpp
> PASS: isl_test_cpp_failed.sh
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/test-driver:
> line 112: 82575 Abort trap: 6 "$@" >> "$log_file" 2>&1
> FAIL: isl_test_cpp17
> PASS: isl_test_cpp17-checked

How does isl_test2 fail?
What does "isl_test2.log" contain?

How did you configure isl (send config.log)?
How did you build isl?
(I vaguely remember the gcc build overriding some configure options)

Since you are apparently trying to compile gcc,
have you tried compiling gcc without isl first and then compiling isl with gcc?

skimo

Liviu Ionescu

unread,
Feb 10, 2025, 5:16:52 PMFeb 10
to sven.ver...@gmail.com, isl Development


> On 10 Feb 2025, at 23:41, Sven Verdoolaege <sven.ver...@telenet.be> wrote:
>
>> I identified the tests that trigger the error and commented them out:
>>
>> [diff
>> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc.bak
>> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/sources/isl-0.26/isl_test_cpp.cc]
>> 368,370c368,370
>> < test_foreach(ctx);
>> < test_foreach_scc(ctx);
>> < test_every(ctx);
>> ---
>>> // test_foreach(ctx);
>>> // test_foreach_scc(ctx);
>>> // test_every(ctx);
>> 373,374c373,374
>> < test_schedule_tree(ctx);
>> < test_ast_build(ctx);
>> ---
>>> // test_schedule_tree(ctx);
>>> // test_ast_build(ctx);
>
> How did you manage to fix isl_test_cpp-checked compilation issues
> by modifying isl_test_cpp.cc?

I'm not sure I understand the question, all I did to make pass the build was to patch isl_test_cpp.cc via sed, to comment out those 5 lines.

Probably due to parallel build, the console log was messy and the error came from a different file.
isl_test2.log
isl_test_cpp17.log
config.log
make-output-20250210-112424.txt

Liviu Ionescu

unread,
Feb 10, 2025, 5:29:41 PMFeb 10
to sven.ver...@gmail.com, isl Development


> On 10 Feb 2025, at 23:41, Sven Verdoolaege <sven.ver...@telenet.be> wrote:
>
> have you tried compiling gcc without isl first and then compiling isl with gcc?

No, but have you tried to compile isl on an Apple Silicon Mac with the latest homebrew clang?

Liviu


Sven Verdoolaege

unread,
Feb 10, 2025, 5:43:03 PMFeb 10
to Liviu Ionescu, isl Development
I don't have access to such a system.

skimo

Sven Verdoolaege

unread,
Feb 11, 2025, 3:01:38 PMFeb 11
to Liviu Ionescu, isl Development
On Tue, Feb 11, 2025 at 12:16:35AM +0200, Liviu Ionescu wrote:
>
>
> I could not find the location where these tests are build, so I cannot tell for sure, but apparently the link options were not passed correctly, since the log refers the system libc++ instead of the library that came with the clang 19 used to compile the project.

Where do you see that the system libc++ is being used?

> If you check the make log, you'll see that the link must use explicit -L and -Wl,-rpath specific to the toolchain. The same options must also be used when compiling the tests.

The "make-output-20250210-112424.txt" file you attached
only shows how one of the tests gets compiled,
so I'm not sure what I'm supposed to compare it with.

In any case, the flags

'-O2 -v -Wl,-v -Wl,-t -Wl,-macosx_version_min,11.0 -Wl,-headerpad_max_install_names -L/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath,/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib -Wl,-rpath,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin'

that you specified in LDFLAGS when configuring
do appear to be used to link the test.

What exactly is missing?

skimo

Liviu Ionescu

unread,
Feb 11, 2025, 3:27:29 PMFeb 11
to sven.ver...@gmail.com, isl Development


> On 11 Feb 2025, at 22:01, Sven Verdoolaege <sven.ver...@telenet.be> wrote:
>
> ... Where do you see that the system libc++ is being used?

In the test logs, for example:

dyld: Symbol not found: __ZTTNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
Referenced from: /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2
Expected in: /usr/lib/libc++.1.dylib
in /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2
FAIL isl_test2 (exit status: 134)

This is confirmed by otool:

% otool -L /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2:
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libisl.23.dylib (compatibility version 27.0.0, current version 27.0.0)
/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libgmp.10.dylib (compatibility version 16.0.0, current version 16.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

For an unknown yet reason, the test binary refers to the system libc++ library, instead of the toolchain library.

> In any case, the flags
>
> '-O2 -v -Wl,-v -Wl,-t -Wl,-macosx_version_min,11.0 -Wl,-headerpad_max_install_names -L/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath,/Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib -Wl,-rpath,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib -Wl,-rpath,/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib/clang/19/lib/darwin'
>
> that you specified in LDFLAGS when configuring
> do appear to be used to link the test.
>
> What exactly is missing?

Hmmm... that's weird, the toolchain library is in '/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/19.1.7-1.1/.content/lib' and the rpath to it is present, but the -L is not.

I'll try to further investigate and come back when I have more data.

Thank you for your patience.


Liviu


Sven Verdoolaege

unread,
Feb 11, 2025, 4:02:55 PMFeb 11
to Liviu Ionescu, isl Development
On Tue, Feb 11, 2025 at 10:27:12PM +0200, Liviu Ionescu wrote:
> > On 11 Feb 2025, at 22:01, Sven Verdoolaege <sven.ver...@telenet.be> wrote:
> This is confirmed by otool:
>
> % otool -L /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2

For the record, you probably want to do

libtool --mode=execute otool -L /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/isl_test2

instead. (It may be called glibtool on a Mac)

> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/build/isl-0.26/.libs/isl_test2:
> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libisl.23.dylib (compatibility version 27.0.0, current version 27.0.0)

That should pick the right library here...

> /Users/ilg/Work/xpack-dev-tools/gcc-xpack.git/build-assets/build/darwin-arm64/aarch64-apple-darwin20.6.0/install/lib/libgmp.10.dylib (compatibility version 16.0.0, current version 16.0.0)
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)

... but it's not likely to change this one,
so it probably wouldn't really help you with the issue you're running into.

skimo
Reply all
Reply to author
Forward
0 new messages