This is an archive of the discontinued LLVM Phabricator instance.

[clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.
ClosedPublic

Authored by sunho on Jul 29 2022, 10:41 AM.

Details

Summary

We have seen random symbol not found "__cxa_throw" error in fuschia build bots and out-of-tree users. The understanding have been that they are built without exception support, but it turned out that these platforms have LLVM_STATIC_LINK_CXX_STDLIB ON so that they link libstdc++ to llvm statically. The reason why this is problematic for clang-repl is that by default clang-repl tries to find symbols from symbol table of executable and dynamic libraries loaded by current process. It needs to load another libstdc++, but the platform that had LLVM_STATIC_LINK_CXX_STDLIB turned on is usally those with missing or obsolate shared libstdc++ in the first place -- trying to load it again would be destined to fail eventually with a risk to introuduce mixed libstdc++ versions.

A proper solution that doesn't take a workaround is statically link the same libstdc++ by clang-repl side, but this is not possible with old JIT linker runtimedyld. New just-in-time linker JITLink handles this relatively well, but it's not availalbe in majority of platforms. For now, this patch just disables the building of clang-repl when LLVM_STATIC_LINK_CXX_STDLIB is ON and removes the "__cxa_throw" check in exception unittest as well as reverting previous exception check flag patch.

Diff Detail

Event Timeline

sunho created this revision.Jul 29 2022, 10:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 10:41 AM
Herald added a subscriber: mgorny. · View Herald Transcript
sunho requested review of this revision.Jul 29 2022, 10:41 AM

Let’s add more reviewers hopefully in a time zone to process that quicker as that’s appeasing failing bots.

v.g.vassilev accepted this revision.Jul 30 2022, 5:46 AM

This is a good cleanup and worth a shot. Let’s hope it does not break other configurations where we don’t support exceptions.

This revision is now accepted and ready to land.Jul 30 2022, 5:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2022, 1:43 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sunho added a comment.Jul 30 2022, 2:42 PM

https://lab.llvm.org/buildbot/#/builders/98/builds/22588 fuschia build bot is happy with this change and I don't see new build breakages so far!

dyung added a subscriber: dyung.Jul 31 2022, 10:33 AM

The test simple-exception.cpp is failing on the PS5 Windows bot after this change. Can you take a look?

I forced a build using the commit prior to yours which passed: https://lab.llvm.org/buildbot/#/builders/216/builds/7636
And then I forced a build using your commit, and the test failed: https://lab.llvm.org/buildbot/#/builders/216/builds/7637

******************** TEST 'Clang :: Interpreter/simple-exception.cpp' FAILED ********************
Script:
--
: 'RUN: at line 4';   cat Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp | z:\test\build\bin\clang-repl.exe | z:\test\build\bin\filecheck.exe Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
--
Exit Code: 1
Command Output (stdout):
--
$ ":" "RUN: at line 4"
$ "cat" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
$ "z:\test\build\bin\clang-repl.exe"
# command stderr:
JIT session error: Symbols not found: [ ??_7type_info@@6B@ ]
error: Failed to materialize symbols: { (main, { _CT??_R0PEAX@88, ?f@@YAHXZ, ?r1@@3HA, _CTA2PEAD, ??_C@_0BB@DPCIAKEG@Simple?5exception?$AA@, ??_C@_03OFAPEBGM@?$CFs?6?$AA@, $.incr_module_8.__inits.0, ?checkException@@YAHXZ, _TIC2PEAD, ??_R0PEAD@8, ??_R0PEAX@8, __orc_init_func.incr_module_8, ??_C@_0N@CKKDCGKM@Running?5f?$CI?$CJ?6?$AA@, _CT??_R0PEAD@88 }) }
error: Failed to materialize symbols: { (main, { __orc_init_func.incr_module_8 }) }
$ "z:\test\build\bin\filecheck.exe" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
# command stderr:
Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp:10:11: error: CHECK: expected string not found in input
// CHECK: Running f()
          ^
<stdin>:1:1: note: scanning from here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
^
<stdin>:1:11: note: possible intended match here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
          ^
Input file: <stdin>
Check file: Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
-dump-input=help explains the following input dump.
Input was:
<<<<<<
            1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl>  
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1               ?                                                                                                                                                   possible intended match
>>>>>>
error: command failed with exit status: 1
--
********************
sunho added a comment.Jul 31 2022, 1:53 PM

The test simple-exception.cpp is failing on the PS5 Windows bot after this change. Can you take a look?

I forced a build using the commit prior to yours which passed: https://lab.llvm.org/buildbot/#/builders/216/builds/7636
And then I forced a build using your commit, and the test failed: https://lab.llvm.org/buildbot/#/builders/216/builds/7637

******************** TEST 'Clang :: Interpreter/simple-exception.cpp' FAILED ********************
Script:
--
: 'RUN: at line 4';   cat Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp | z:\test\build\bin\clang-repl.exe | z:\test\build\bin\filecheck.exe Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
--
Exit Code: 1
Command Output (stdout):
--
$ ":" "RUN: at line 4"
$ "cat" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
$ "z:\test\build\bin\clang-repl.exe"
# command stderr:
JIT session error: Symbols not found: [ ??_7type_info@@6B@ ]
error: Failed to materialize symbols: { (main, { _CT??_R0PEAX@88, ?f@@YAHXZ, ?r1@@3HA, _CTA2PEAD, ??_C@_0BB@DPCIAKEG@Simple?5exception?$AA@, ??_C@_03OFAPEBGM@?$CFs?6?$AA@, $.incr_module_8.__inits.0, ?checkException@@YAHXZ, _TIC2PEAD, ??_R0PEAD@8, ??_R0PEAX@8, __orc_init_func.incr_module_8, ??_C@_0N@CKKDCGKM@Running?5f?$CI?$CJ?6?$AA@, _CT??_R0PEAD@88 }) }
error: Failed to materialize symbols: { (main, { __orc_init_func.incr_module_8 }) }
$ "z:\test\build\bin\filecheck.exe" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
# command stderr:
Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp:10:11: error: CHECK: expected string not found in input
// CHECK: Running f()
          ^
<stdin>:1:1: note: scanning from here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
^
<stdin>:1:11: note: possible intended match here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
          ^
Input file: <stdin>
Check file: Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
-dump-input=help explains the following input dump.
Input was:
<<<<<<
            1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl>  
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1               ?                                                                                                                                                   possible intended match
>>>>>>
error: command failed with exit status: 1
--
********************

The test isn't supposed to be ran on windows -- we don't support exception on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working out.

dyung added a comment.Jul 31 2022, 3:02 PM

The test isn't supposed to be ran on windows -- we don't support exception on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working out.

If you don't want the test run on Windows, I think what you want is probably system-windows rather than windows-msvc and windows-gnu. The former will mark as XFAIL when it is run on Windows, while the latter will mark as XFAIL when the target triple includes those strings.

sunho added a comment.Jul 31 2022, 5:07 PM

The test isn't supposed to be ran on windows -- we don't support exception on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working out.

If you don't want the test run on Windows, I think what you want is probably system-windows rather than windows-msvc and windows-gnu. The former will mark as XFAIL when it is run on Windows, while the latter will mark as XFAIL when the target triple includes those strings.

Should have been fixed in https://github.com/llvm/llvm-project/commit/773d51ce3bedd091539aa86a5e5fc15a9174ff7b. Can you check it out?

dyung added a comment.Jul 31 2022, 6:43 PM

The test isn't supposed to be ran on windows -- we don't support exception on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working out.

If you don't want the test run on Windows, I think what you want is probably system-windows rather than windows-msvc and windows-gnu. The former will mark as XFAIL when it is run on Windows, while the latter will mark as XFAIL when the target triple includes those strings.

Should have been fixed in https://github.com/llvm/llvm-project/commit/773d51ce3bedd091539aa86a5e5fc15a9174ff7b. Can you check it out?

https://lab.llvm.org/buildbot/#/builders/216/builds/7647

That seems to have worked. Thanks!

sbc100 added a subscriber: sbc100.Aug 17 2022, 4:23 PM

I'm not totally sure but I think the change is responsible for the emscripten integration bot failing InterpreterTest.CatchException: https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8807160007692150337/+/u/LLVM_regression/stdout

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from InterpreterTest
[ RUN      ] InterpreterTest.CatchException
JIT session error: Symbols not found: [ __gxx_personality_v0, _ZSt9terminatev, _ZTVN10__cxxabiv117__class_type_infoE, __cxa_allocate_exception, __cxa_begin_catch, __cxa_end_catch, __cxa_free_exception, __cxa_throw ]
Failure value returned from cantFail wrapped call
Failed to materialize symbols: { (main, { _ZN16custom_exceptionC2EPKc, __clang_call_terminate, _ZTI16custom_exception, _ZTS16custom_exception, throw_exception }) }
UNREACHABLE executed at /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/include/llvm/Support/Error.h:786!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x2464413)[0x55cb14660413]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246236c)[0x55cb1465e36c]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x24648df)[0x55cb146608df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fad2fab1980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fad2eb0de87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fad2eb0f7f1]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x23f798f)[0x55cb145f398f]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9de35)[0x55cb14099e35]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9d597)[0x55cb14099597]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246d6be)[0x55cb146696be]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246e659)[0x55cb1466a659]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246ee40)[0x55cb1466ae40]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247b2c3)[0x55cb146772c3]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247ab42)[0x55cb14676b42]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246559c)[0x55cb1466159c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fad2eaf0c87]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9ceda)[0x55cb14098eda]

This started happening consistently after this change https://chromium.googlesource.com/emscripten-releases/+/584b2f531314d1e70cd5ebadcce7e015a6215c9a. The only CL in that list that looks related seems to be this one.

I'm not totally sure but I think the change is responsible for the emscripten integration bot failing InterpreterTest.CatchException: https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8807160007692150337/+/u/LLVM_regression/stdout

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from InterpreterTest
[ RUN      ] InterpreterTest.CatchException
JIT session error: Symbols not found: [ __gxx_personality_v0, _ZSt9terminatev, _ZTVN10__cxxabiv117__class_type_infoE, __cxa_allocate_exception, __cxa_begin_catch, __cxa_end_catch, __cxa_free_exception, __cxa_throw ]
Failure value returned from cantFail wrapped call
Failed to materialize symbols: { (main, { _ZN16custom_exceptionC2EPKc, __clang_call_terminate, _ZTI16custom_exception, _ZTS16custom_exception, throw_exception }) }
UNREACHABLE executed at /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/include/llvm/Support/Error.h:786!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x2464413)[0x55cb14660413]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246236c)[0x55cb1465e36c]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x24648df)[0x55cb146608df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fad2fab1980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fad2eb0de87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fad2eb0f7f1]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x23f798f)[0x55cb145f398f]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9de35)[0x55cb14099e35]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9d597)[0x55cb14099597]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246d6be)[0x55cb146696be]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246e659)[0x55cb1466a659]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246ee40)[0x55cb1466ae40]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247b2c3)[0x55cb146772c3]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247ab42)[0x55cb14676b42]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246559c)[0x55cb1466159c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fad2eaf0c87]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9ceda)[0x55cb14098eda]

This started happening consistently after this change https://chromium.googlesource.com/emscripten-releases/+/584b2f531314d1e70cd5ebadcce7e015a6215c9a. The only CL in that list that looks related seems to be this one.

Could you share the detailed build configuration of those bots?

I'm not totally sure but I think the change is responsible for the emscripten integration bot failing InterpreterTest.CatchException: https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8807160007692150337/+/u/LLVM_regression/stdout

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from InterpreterTest
[ RUN      ] InterpreterTest.CatchException
JIT session error: Symbols not found: [ __gxx_personality_v0, _ZSt9terminatev, _ZTVN10__cxxabiv117__class_type_infoE, __cxa_allocate_exception, __cxa_begin_catch, __cxa_end_catch, __cxa_free_exception, __cxa_throw ]
Failure value returned from cantFail wrapped call
Failed to materialize symbols: { (main, { _ZN16custom_exceptionC2EPKc, __clang_call_terminate, _ZTI16custom_exception, _ZTS16custom_exception, throw_exception }) }
UNREACHABLE executed at /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/include/llvm/Support/Error.h:786!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x2464413)[0x55cb14660413]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246236c)[0x55cb1465e36c]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x24648df)[0x55cb146608df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fad2fab1980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fad2eb0de87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fad2eb0f7f1]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x23f798f)[0x55cb145f398f]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9de35)[0x55cb14099e35]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9d597)[0x55cb14099597]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246d6be)[0x55cb146696be]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246e659)[0x55cb1466a659]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246ee40)[0x55cb1466ae40]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247b2c3)[0x55cb146772c3]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247ab42)[0x55cb14676b42]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246559c)[0x55cb1466159c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fad2eaf0c87]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9ceda)[0x55cb14098eda]

This started happening consistently after this change https://chromium.googlesource.com/emscripten-releases/+/584b2f531314d1e70cd5ebadcce7e015a6215c9a. The only CL in that list that looks related seems to be this one.

Could you share the detailed build configuration of those bots?

All the step should be visible here: https://ci.chromium.org/ui/p/emscripten-releases/builders/ci/linux-test-suites/b8805531315340503553/steps

The most relevant one I guess would be:

https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8805531315340503553/+/u/Build_LLVM/stdout

Here you can see LLVM being configured with:

subprocess.check_call(`/b/s/w/ir/cache/builder/emscripten-releases/cmake-3.21.3-linux-x86_64/bin/cmake -G Ninja -DPython3_EXECUTABLE=/b/s/w/ir/cache/vpython/68bda9/bin/python -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/b/s/w/ir/x/w/install -DCMAKE_CXX_FLAGS=-stdlib++-isystem/b/s/w/ir/x/w/install/include/c++/v1 "-DCMAKE_EXE_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" "-DCMAKE_SHARED_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" "-DCMAKE_MODULE_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" -DCMAKE_SYSROOT=/b/s/w/ir/cache/builder/emscripten-releases/sysroot_debian_stretch_amd64 -DCMAKE_C_COMPILER=/b/s/w/ir/cache/builder/v8/third_party/llvm-build/Release+Asserts/bin/clang -DCMAKE_CXX_COMPILER=/b/s/w/ir/cache/builder/v8/third_party/llvm-build/Release+Asserts/bin/clang++ -DCMAKE_C_COMPILER_LAUNCHER=/b/s/w/ir/cache/goma/client/gomacc -DCMAKE_CXX_COMPILER_LAUNCHER=/b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_LINK_LLVM_DYLIB=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_TOOL_LTO_BUILD=OFF -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DLLVM_TARGETS_TO_BUILD=host;WebAssembly -DLLVM_ENABLE_PROJECTS=lld;clang -DLLVM_ENABLE_TERMINFO=0 -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_CRT_DEBUG=MTd -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_REPOSITORY_STRING=https://github.com/llvm/llvm-project -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_ASSERTIONS=ON`, cwd=`/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out`)

The code the drives the build is here: https://chromium.googlesource.com/emscripten-releases/+/12ac1c00143f5a8a6722bdb8cca9e4515c2654d0/src/build.py#690

Note that we do use out own libc++ build (which is static I believe) but we don't set LLVM_STATIC_LINK_CXX_STDLIB.. we inject it via generic cmake flags: -DCMAKE_CXX_FLAGS=-stdlib++-isystem=.. -DCMAKE_EXE_LINKER_FLAGS=-L... -stdlib=libc++ (this works for the other cmake projects that we also build, as well as llvm). Perhaps we should use be passing LLVM_STATIC_LINK_CXX_STDLIB.

I'm curious through because things were working prior to this change.. and stopped working after this change.. even though this change is apparently targeted at fixing the exact issue that it seems to have caused for us. Rather odd.

sunho added a comment.Aug 19 2022, 6:14 AM

I'm not totally sure but I think the change is responsible for the emscripten integration bot failing InterpreterTest.CatchException: https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8807160007692150337/+/u/LLVM_regression/stdout

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from InterpreterTest
[ RUN      ] InterpreterTest.CatchException
JIT session error: Symbols not found: [ __gxx_personality_v0, _ZSt9terminatev, _ZTVN10__cxxabiv117__class_type_infoE, __cxa_allocate_exception, __cxa_begin_catch, __cxa_end_catch, __cxa_free_exception, __cxa_throw ]
Failure value returned from cantFail wrapped call
Failed to materialize symbols: { (main, { _ZN16custom_exceptionC2EPKc, __clang_call_terminate, _ZTI16custom_exception, _ZTS16custom_exception, throw_exception }) }
UNREACHABLE executed at /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/include/llvm/Support/Error.h:786!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x2464413)[0x55cb14660413]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246236c)[0x55cb1465e36c]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x24648df)[0x55cb146608df]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fad2fab1980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fad2eb0de87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fad2eb0f7f1]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x23f798f)[0x55cb145f398f]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9de35)[0x55cb14099e35]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9d597)[0x55cb14099597]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246d6be)[0x55cb146696be]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246e659)[0x55cb1466a659]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246ee40)[0x55cb1466ae40]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247b2c3)[0x55cb146772c3]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x247ab42)[0x55cb14676b42]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x246559c)[0x55cb1466159c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fad2eaf0c87]
/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out/tools/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests(+0x1e9ceda)[0x55cb14098eda]

This started happening consistently after this change https://chromium.googlesource.com/emscripten-releases/+/584b2f531314d1e70cd5ebadcce7e015a6215c9a. The only CL in that list that looks related seems to be this one.

Could you share the detailed build configuration of those bots?

All the step should be visible here: https://ci.chromium.org/ui/p/emscripten-releases/builders/ci/linux-test-suites/b8805531315340503553/steps

The most relevant one I guess would be:

https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8805531315340503553/+/u/Build_LLVM/stdout

Here you can see LLVM being configured with:

subprocess.check_call(`/b/s/w/ir/cache/builder/emscripten-releases/cmake-3.21.3-linux-x86_64/bin/cmake -G Ninja -DPython3_EXECUTABLE=/b/s/w/ir/cache/vpython/68bda9/bin/python -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/b/s/w/ir/x/w/install -DCMAKE_CXX_FLAGS=-stdlib++-isystem/b/s/w/ir/x/w/install/include/c++/v1 "-DCMAKE_EXE_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" "-DCMAKE_SHARED_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" "-DCMAKE_MODULE_LINKER_FLAGS=-L/b/s/w/ir/x/w/install/lib -stdlib=libc++" -DCMAKE_SYSROOT=/b/s/w/ir/cache/builder/emscripten-releases/sysroot_debian_stretch_amd64 -DCMAKE_C_COMPILER=/b/s/w/ir/cache/builder/v8/third_party/llvm-build/Release+Asserts/bin/clang -DCMAKE_CXX_COMPILER=/b/s/w/ir/cache/builder/v8/third_party/llvm-build/Release+Asserts/bin/clang++ -DCMAKE_C_COMPILER_LAUNCHER=/b/s/w/ir/cache/goma/client/gomacc -DCMAKE_CXX_COMPILER_LAUNCHER=/b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_LINK_LLVM_DYLIB=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_TOOL_LTO_BUILD=OFF -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DLLVM_TARGETS_TO_BUILD=host;WebAssembly -DLLVM_ENABLE_PROJECTS=lld;clang -DLLVM_ENABLE_TERMINFO=0 -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_CRT_DEBUG=MTd -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_REPOSITORY_STRING=https://github.com/llvm/llvm-project -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_ASSERTIONS=ON`, cwd=`/b/s/w/ir/cache/builder/emscripten-releases/build/llvm-out`)

The code the drives the build is here: https://chromium.googlesource.com/emscripten-releases/+/12ac1c00143f5a8a6722bdb8cca9e4515c2654d0/src/build.py#690

Note that we do use out own libc++ build (which is static I believe) but we don't set LLVM_STATIC_LINK_CXX_STDLIB.. we inject it via generic cmake flags: -DCMAKE_CXX_FLAGS=-stdlib++-isystem=.. -DCMAKE_EXE_LINKER_FLAGS=-L... -stdlib=libc++ (this works for the other cmake projects that we also build, as well as llvm). Perhaps we should use be passing LLVM_STATIC_LINK_CXX_STDLIB.

Aha. If you are specifying static build like that, it wouldn't disable clang-repl build, thus it's destined to fail. You could try setting LLVM_STATIC_LINK_CXX_STDLIB. If that is not acceptable for some reason, we could make HAVE_CLANG_REPL_SUPPORT an option so that it can be disabled manually.

I'm curious through because things were working prior to this change.. and stopped working after this change.. even though this change is apparently targeted at fixing the exact issue that it seems to have caused for us. Rather odd.

It's actually an intended behaviour. I eliminated an existing workaround to circumvent the same failure which turned out to be not working in some out-of-tree system.

https://chromium-review.googlesource.com/c/emscripten-releases/+/3842345 ... I suppose the alternative would be to keep the backup method that was previously working in our case (but not in yours)?

clang/test/Interpreter/execute-weak.cpp