Can you please share the full cmake command line? On Wed, 21 Oct 2020 at 11:28, Kostya Serebryany <kcc at google.com> wrote:> +Vitaly Buka <vitalybuka at google.com> to help with the links to build > bots. > Not sure if any of those cover OpenMP. > > On Wed, Oct 21, 2020 at 5:50 AM Bryan Chan <bryanpkc at gmail.com> wrote: > >> Thanks Kostya, using Clang to build itself with ASan enabled, and running >> my >> build container in privileged mode, helped solve a lot of the problems. >> But I >> now encounter a lot of link errors while testing my stage-2 build: >> >> FAIL: libomp :: api/has_openmp.c (52345 of 54886) >> ******************** TEST 'libomp :: api/has_openmp.c' FAILED >> ******************** >> Script: >> -- >> : 'RUN': at line 1'; /home/bryanpkc/llvm-project/build/./bin/clang >> -fopenmp -pthread -fno-experimental-isel -I >> /home/bryanpkc/llvm-project/openmp/runtime/test -I >> /home/bryanpkc/llvm-project/build/projects/openmp/runtime/src -L >> /home/bryanpkc/llvm-project/build/lib -I /h >> ome/bryanpkc/llvm-project/openmp/runtime/test/ompt >> /home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c -o >> /home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp >> -lm -latomic && >> /home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp >> -- >> Exit Code: 1 >> >> Command Output (stdout): >> -- >> $ ":" "RUN: at line 1" >> $ "/home/bryanpkc/llvm-project/build/./bin/clang" "-fopenmp" "-pthread" >> "-fno-experimental-isel" "-I" >> "/home/bryanpkc/llvm-project/openmp/runtime/test" "-I" >> "/home/bryanpkc/llvm-project/build/projects/openmp/runtime/src" "-L" >> "/home/bryanpkc/llvm-project/build/lib" "-I" >> "/home/bryanpkc/llvm-project/openmp/runtime/test/ompt" >> "/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c" "-o" >> "/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp" >> "-lm" "-latomic" >> # command stderr: >> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined >> reference to `__asan_load_cxx_array_cookie' >> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined >> reference to `__asan_set_shadow_f8' >> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined >> reference to `__asan_stack_malloc_8' >> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined >> reference to `__asan_stack_malloc_2' >> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined >> reference to `__asan_unregister_globals' >> >> This type of failures are affecting multiple groups of tests: >> >> Builtins-aarch64-linux :: * >> LLVM :: tools/gold/X86/* >> libomp :: * >> libomptarget :: * >> >> Any ideas? Could you point me to the build bot that has a good >> Clang/LLVM/OpenMP >> configuration with ASan enabled? Unfortunately the documentation at >> https://llvm.org/docs/CMake.html is not clear on how to get this working. >> >> -- >> Bryan >> >> >> On Tue, Oct 20, 2020 at 12:33 PM Kostya Serebryany <kcc at google.com> >> wrote: >> >>> Hi Bryan, >>> >>> Yes, building LLVM with GCC+ASAN is a warranty void zone. >>> It can probably be made to work with some effort, but unless someone is >>> willing to >>> maintain a public bot with this build, it will remain unsupported. >>> >>> Building LLVM with LLVM+ASAN is fully supported, and the bots are >>> maintained. >>> >>> thanks! >>> >>> --kcc >>> >>> >>> On Tue, Oct 20, 2020 at 7:39 AM Bryan Chan via cfe-dev < >>> cfe-dev at lists.llvm.org> wrote: >>> >>>> Hi lists, >>>> >>>> I am encountering a large number of check-clang failures after building >>>> Clang/LLVM with -DLLVM_USE_SANITIZER=Address. I have reported the >>>> issue on Bugzilla (https://bugs.llvm.org/show_bug.cgi?id=47678). I >>>> cannot even compile helloworld.c with the resulting clang tool without a >>>> lot of false positives from ASan. Is it because I am not supposed to use >>>> GCC's AddressSanitizer when building Clang? >>>> >>>> -- >>>> Bryan >>>> _______________________________________________ >>>> cfe-dev mailing list >>>> cfe-dev at lists.llvm.org >>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev >>>> >>>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201021/59798abb/attachment.html>
Hi Vitaly,
This is the CMake command line I used:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=$HOME/stage2 \
-DCMAKE_C_COMPILER=$HOME/stage1/bin/clang \
-DCMAKE_CXX_COMPILER=$HOME/stage1/bin/clang++ \
-DCOMPILER_RT_BUILD_BUILTINS=off -DCOMPILER_RT_BUILD_PROFILE=on \
-DCOMPILER_RT_BUILD_SANITIZERS=on -DCOMPILER_RT_BUILD_XRAY=off \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld;openmp" \
-DLLVM_ENABLE_ASSERTIONS=on -DLLVM_OPTIMIZED_TABLEGEN=on \
-DLLVM_STATIC_LINK_CXX_STDLIB=on
-DLLVM_TARGETS_TO_BUILD="AArch64;X86" \
-DLLVM_USE_LINKER=gold -DLLVM_USE_SANITIZER=Address ../llvm
Stage 1 was built from the same source using the same CMake command, without
-DLLVM_USE_SANITIZER. CMAKE_C_FLAGS and CMAKE_CXX_FLAGS contained some
hardening options like "-fstack-protector-strong -D_FORTIFY_SOURCE=2"
which
I omitted for brevity. I am building on an AArch64 CentOS system.
The Builtins-aarch64-linux test failures have disappeared after I set the
PATH and LD_LIBRARY_PATH environment variables to point to $HOME/stage1/bin
and $HOME/stage1/lib. But I still see the tools/gold/X86 and OpenMP test
failures.
Thanks,
--
Bryan
On Wed, Oct 21, 2020 at 3:03 PM Vitaly Buka <vitalybuka at google.com>
wrote:
> Can you please share the full cmake command line?
>
> On Wed, 21 Oct 2020 at 11:28, Kostya Serebryany <kcc at google.com>
wrote:
>
>> +Vitaly Buka <vitalybuka at google.com> to help with the links to
build
>> bots.
>> Not sure if any of those cover OpenMP.
>>
>> On Wed, Oct 21, 2020 at 5:50 AM Bryan Chan <bryanpkc at
gmail.com> wrote:
>>
>>> Thanks Kostya, using Clang to build itself with ASan enabled, and
>>> running my
>>> build container in privileged mode, helped solve a lot of the
problems.
>>> But I
>>> now encounter a lot of link errors while testing my stage-2 build:
>>>
>>> FAIL: libomp :: api/has_openmp.c (52345 of 54886)
>>> ******************** TEST 'libomp :: api/has_openmp.c'
FAILED
>>> ********************
>>> Script:
>>> --
>>> : 'RUN': at line 1';
/home/bryanpkc/llvm-project/build/./bin/clang
>>> -fopenmp -pthread -fno-experimental-isel -I
>>> /home/bryanpkc/llvm-project/openmp/runtime/test -I
>>> /home/bryanpkc/llvm-project/build/projects/openmp/runtime/src -L
>>> /home/bryanpkc/llvm-project/build/lib -I /h
>>> ome/bryanpkc/llvm-project/openmp/runtime/test/ompt
>>> /home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c -o
>>>
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
>>> -lm -latomic &&
>>>
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
>>> --
>>> Exit Code: 1
>>>
>>> Command Output (stdout):
>>> --
>>> $ ":" "RUN: at line 1"
>>> $ "/home/bryanpkc/llvm-project/build/./bin/clang"
"-fopenmp" "-pthread"
>>> "-fno-experimental-isel" "-I"
>>> "/home/bryanpkc/llvm-project/openmp/runtime/test"
"-I"
>>>
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/src"
"-L"
>>> "/home/bryanpkc/llvm-project/build/lib" "-I"
>>> "/home/bryanpkc/llvm-project/openmp/runtime/test/ompt"
>>>
"/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c"
"-o"
>>>
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp"
>>> "-lm" "-latomic"
>>> # command stderr:
>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>> reference to `__asan_load_cxx_array_cookie'
>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>> reference to `__asan_set_shadow_f8'
>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>> reference to `__asan_stack_malloc_8'
>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>> reference to `__asan_stack_malloc_2'
>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>> reference to `__asan_unregister_globals'
>>>
>>> This type of failures are affecting multiple groups of tests:
>>>
>>> Builtins-aarch64-linux :: *
>>> LLVM :: tools/gold/X86/*
>>> libomp :: *
>>> libomptarget :: *
>>>
>>> Any ideas? Could you point me to the build bot that has a good
>>> Clang/LLVM/OpenMP
>>> configuration with ASan enabled? Unfortunately the documentation at
>>> https://llvm.org/docs/CMake.html is not clear on how to get this
>>> working.
>>>
>>> --
>>> Bryan
>>>
>>>
>>> On Tue, Oct 20, 2020 at 12:33 PM Kostya Serebryany <kcc at
google.com>
>>> wrote:
>>>
>>>> Hi Bryan,
>>>>
>>>> Yes, building LLVM with GCC+ASAN is a warranty void zone.
>>>> It can probably be made to work with some effort, but unless
someone is
>>>> willing to
>>>> maintain a public bot with this build, it will remain
unsupported.
>>>>
>>>> Building LLVM with LLVM+ASAN is fully supported, and the bots
are
>>>> maintained.
>>>>
>>>> thanks!
>>>>
>>>> --kcc
>>>>
>>>>
>>>> On Tue, Oct 20, 2020 at 7:39 AM Bryan Chan via cfe-dev <
>>>> cfe-dev at lists.llvm.org> wrote:
>>>>
>>>>> Hi lists,
>>>>>
>>>>> I am encountering a large number of check-clang failures
after
>>>>> building Clang/LLVM with -DLLVM_USE_SANITIZER=Address. I
have
>>>>> reported the issue on Bugzilla (
>>>>> https://bugs.llvm.org/show_bug.cgi?id=47678). I cannot even
>>>>> compile helloworld.c with the resulting clang tool without
a lot of false
>>>>> positives from ASan. Is it because I am not supposed to use
GCC's
>>>>> AddressSanitizer when building Clang?
>>>>>
>>>>> --
>>>>> Bryan
>>>>> _______________________________________________
>>>>> cfe-dev mailing list
>>>>> cfe-dev at lists.llvm.org
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20201022/750f014f/attachment.html>
I guess the problem is the following:
Stage2 builds libomp.so instrumented with AddressSanitizer. Then omp tests
are compiled without -fsanitize=address and load instrumented libomp.so
which fails on missing symbols.
You can try to solve this in two ways:
1. Disable sanitizers on libomp.so even -DLLVM_USE_SANITIZER= is set. That
can be hard if it uses some part of llvm as dependency. If so, you can try
to build non-instrumented libomp.so using ExternalProject_Add.
Should work but sanitizer will cover only the compiler binary not libomp.so.
2. Use asan in all tests e.g. with -DOPENMP_TEST_FLAGS=-fsanitize=address
(better to do so in cmake file). Problem here is that stage2 does not build
asan because it uses LLVM_USE_SANITIZER. We can just use stage1 compiler
which contains asan libs. With a hack like this:
if(LLVM_USE_SANITIZER)
set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER})
set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER})
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(saved_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
unset(CMAKE_C_FLAGS)
append_common_sanitizer_flags()
set(OPENMP_TEST_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address
${OPENMP_TEST_FLAGS}")
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
set(CMAKE_CXX_FLAGS ${saved_CMAKE_CXX_FLAGS})
endif()
I can run most of the test:
Unsupported : 39
Passed : 241
Expectedly Failed: 2
Failed : 33 (it was 270+ before)
then you can fix or disable failing tests
On Thu, 22 Oct 2020 at 05:31, Bryan Chan <bryanpkc at gmail.com> wrote:
> Hi Vitaly,
>
> This is the CMake command line I used:
>
> cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
> -DCMAKE_INSTALL_PREFIX=$HOME/stage2 \
> -DCMAKE_C_COMPILER=$HOME/stage1/bin/clang \
> -DCMAKE_CXX_COMPILER=$HOME/stage1/bin/clang++ \
> -DCOMPILER_RT_BUILD_BUILTINS=off -DCOMPILER_RT_BUILD_PROFILE=on \
> -DCOMPILER_RT_BUILD_SANITIZERS=on -DCOMPILER_RT_BUILD_XRAY=off \
> -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld;openmp" \
> -DLLVM_ENABLE_ASSERTIONS=on -DLLVM_OPTIMIZED_TABLEGEN=on \
> -DLLVM_STATIC_LINK_CXX_STDLIB=on
> -DLLVM_TARGETS_TO_BUILD="AArch64;X86" \
> -DLLVM_USE_LINKER=gold -DLLVM_USE_SANITIZER=Address ../llvm
>
> Stage 1 was built from the same source using the same CMake command,
> without
> -DLLVM_USE_SANITIZER. CMAKE_C_FLAGS and CMAKE_CXX_FLAGS contained some
> hardening options like "-fstack-protector-strong
-D_FORTIFY_SOURCE=2" which
> I omitted for brevity. I am building on an AArch64 CentOS system.
>
> The Builtins-aarch64-linux test failures have disappeared after I set the
> PATH and LD_LIBRARY_PATH environment variables to point to $HOME/stage1/bin
> and $HOME/stage1/lib. But I still see the tools/gold/X86 and OpenMP test
> failures.
>
> Thanks,
> --
> Bryan
>
>
> On Wed, Oct 21, 2020 at 3:03 PM Vitaly Buka <vitalybuka at
google.com> wrote:
>
>> Can you please share the full cmake command line?
>>
>> On Wed, 21 Oct 2020 at 11:28, Kostya Serebryany <kcc at
google.com> wrote:
>>
>>> +Vitaly Buka <vitalybuka at google.com> to help with the
links to build
>>> bots.
>>> Not sure if any of those cover OpenMP.
>>>
>>> On Wed, Oct 21, 2020 at 5:50 AM Bryan Chan <bryanpkc at
gmail.com> wrote:
>>>
>>>> Thanks Kostya, using Clang to build itself with ASan enabled,
and
>>>> running my
>>>> build container in privileged mode, helped solve a lot of the
problems.
>>>> But I
>>>> now encounter a lot of link errors while testing my stage-2
build:
>>>>
>>>> FAIL: libomp :: api/has_openmp.c (52345 of 54886)
>>>> ******************** TEST 'libomp :: api/has_openmp.c'
FAILED
>>>> ********************
>>>> Script:
>>>> --
>>>> : 'RUN': at line 1';
/home/bryanpkc/llvm-project/build/./bin/clang
>>>> -fopenmp -pthread -fno-experimental-isel -I
>>>> /home/bryanpkc/llvm-project/openmp/runtime/test -I
>>>> /home/bryanpkc/llvm-project/build/projects/openmp/runtime/src
-L
>>>> /home/bryanpkc/llvm-project/build/lib -I /h
>>>> ome/bryanpkc/llvm-project/openmp/runtime/test/ompt
>>>>
/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c -o
>>>>
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
>>>> -lm -latomic &&
>>>>
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
>>>> --
>>>> Exit Code: 1
>>>>
>>>> Command Output (stdout):
>>>> --
>>>> $ ":" "RUN: at line 1"
>>>> $ "/home/bryanpkc/llvm-project/build/./bin/clang"
"-fopenmp" "-pthread"
>>>> "-fno-experimental-isel" "-I"
>>>> "/home/bryanpkc/llvm-project/openmp/runtime/test"
"-I"
>>>>
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/src"
"-L"
>>>> "/home/bryanpkc/llvm-project/build/lib"
"-I"
>>>>
"/home/bryanpkc/llvm-project/openmp/runtime/test/ompt"
>>>>
"/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c"
"-o"
>>>>
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp"
>>>> "-lm" "-latomic"
>>>> # command stderr:
>>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>>> reference to `__asan_load_cxx_array_cookie'
>>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>>> reference to `__asan_set_shadow_f8'
>>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>>> reference to `__asan_stack_malloc_8'
>>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>>> reference to `__asan_stack_malloc_2'
>>>> /usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so:
undefined
>>>> reference to `__asan_unregister_globals'
>>>>
>>>> This type of failures are affecting multiple groups of tests:
>>>>
>>>> Builtins-aarch64-linux :: *
>>>> LLVM :: tools/gold/X86/*
>>>> libomp :: *
>>>> libomptarget :: *
>>>>
>>>> Any ideas? Could you point me to the build bot that has a good
>>>> Clang/LLVM/OpenMP
>>>> configuration with ASan enabled? Unfortunately the
documentation at
>>>> https://llvm.org/docs/CMake.html is not clear on how to get
this
>>>> working.
>>>>
>>>> --
>>>> Bryan
>>>>
>>>>
>>>> On Tue, Oct 20, 2020 at 12:33 PM Kostya Serebryany <kcc at
google.com>
>>>> wrote:
>>>>
>>>>> Hi Bryan,
>>>>>
>>>>> Yes, building LLVM with GCC+ASAN is a warranty void zone.
>>>>> It can probably be made to work with some effort, but
unless someone
>>>>> is willing to
>>>>> maintain a public bot with this build, it will remain
unsupported.
>>>>>
>>>>> Building LLVM with LLVM+ASAN is fully supported, and the
bots are
>>>>> maintained.
>>>>>
>>>>> thanks!
>>>>>
>>>>> --kcc
>>>>>
>>>>>
>>>>> On Tue, Oct 20, 2020 at 7:39 AM Bryan Chan via cfe-dev <
>>>>> cfe-dev at lists.llvm.org> wrote:
>>>>>
>>>>>> Hi lists,
>>>>>>
>>>>>> I am encountering a large number of check-clang
failures after
>>>>>> building Clang/LLVM with -DLLVM_USE_SANITIZER=Address.
I have
>>>>>> reported the issue on Bugzilla (
>>>>>> https://bugs.llvm.org/show_bug.cgi?id=47678). I cannot
even
>>>>>> compile helloworld.c with the resulting clang tool
without a lot of false
>>>>>> positives from ASan. Is it because I am not supposed to
use GCC's
>>>>>> AddressSanitizer when building Clang?
>>>>>>
>>>>>> --
>>>>>> Bryan
>>>>>> _______________________________________________
>>>>>> cfe-dev mailing list
>>>>>> cfe-dev at lists.llvm.org
>>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20201119/8ef5fc9d/attachment.html>