[Openmp-dev] Build error
Joachim Protze via Openmp-dev
openmp-dev at lists.llvm.org
Thu Jun 17 06:06:34 PDT 2021
Hi Itaru,
to avoid issues with libstdc++ on systems with environment modules and
all kind of software built with different compilers, I suggest to use
libc++ for C++ code compiled with clang. As long as you don't mix
gcc/clang with a binary or library and also don't pass C++ objects
across libraries, mixing libc++ and libstdc++ in an application should
be just fine.
On Claix we compile clang in two steps:
A minimal bootstrap build, compiled with system gcc.
A full final build, compiled with the bootstrapped clang.
mkdir -p "${BUILD_DIR_BOOTSTRAP}"
cd "${BUILD_DIR_BOOTSTRAP}"
cmake -DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD=Native \
"${SRC_DIR}/llvm" || exit 21
make -j8 || exit 22
export
LD_LIBRARY_PATH="${BUILD_DIR_BOOTSTRAP}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
export PATH="${BUILD_DIR_BOOTSTRAP}/bin${PATH:+:${PATH}}"
mkdir -p "${BUILD_DIR_FINAL}"
cd "${BUILD_DIR_FINAL}"
cmake -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DLLVM_LIBDIR_SUFFIX=64 \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_ENABLE_LIBCXX=ON \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_60 \
-DLIBOMP_TSAN_SUPPORT=ON \
-DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="35;60;70" \
-DLIBOMPTARGET_NVPTX_AUTODETECT_COMPUTE_CAPABILITY=OFF \
-DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=true \
-DLIBOMPTARGET_ENABLE_DEBUG=on \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_ENABLE_PROJECTS=${LLVM_PROJECTS} \
-DLLVM_ENABLE_RUNTIMES=${LLVM_RUNTIMES} \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DSPHINX_OUTPUT_HTML=OFF \
-DSPHINX_OUTPUT_MAN=ON \
"${SRC_DIR}/llvm" || exit 31
make -j8 || exit 32
make -j8 install || exit 33
Best
Joachim
Am 17.06.21 um 07:00 schrieb Itaru Kitayama via Openmp-dev:
> Following up on myself's post; as of today's main again fails to
> build; do you guys prefer the logs posted at bugzilla rather than the
> list?
>
> On Thu, Jun 17, 2021 at 12:04 PM Itaru Kitayama
> <itaru.kitayama at gmail.com> wrote:
>>
>> Hi Jon,
>> Thanks for taking a look at the logs. By adding the
>> `-DGCC_INSTALL_PREFIX=/p/software/jurecadc/stages/2020/software/GCCcore/9.3.0/`
>> ,
>> I was able to (CMake) configure and do a Ninja build using
>> `-DLLVM_ENABLE_RUNTIMES="openmp"`. And yes, while I'm on JSC's JURECA
>> I use
>> Environmental Modules.
>>
>> On Wed, Jun 16, 2021 at 9:14 PM Jon Chesterfield via Openmp-dev
>> <openmp-dev at lists.llvm.org> wrote:
>>>>
>>>> Hi,
>>>> I am configuring a openmp runtime build this way:
>>>>
>>>> cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
>>>> -DCMAKE_INSTALL_PREFIX=$PROJECT/kitayama1/dev/clang \
>>>> -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_80 \
>>>> -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=80 \
>>>> -DCMAKE_C_COMPILER=clang \
>>>> -DCMAKE_CXX_COMPILER=clang++ \
>>>> -DLLVM_ENABLE_RUNTIMES="openmp" \
>>>> $SCRATCH/kitayama1/projects/llvm-project/llvm
>>>>
>>>>
>>>>
>>>> ... however I see a build error:
>>>>
>>>> ... CCcore-9.3.0/bin/ld:
>>>> undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info
>>>> const&)
>>>
>>>
>>> Cmake invocation looks fine. It appears the static llvm libraries linked have been built with incompatible c++ flags to the other libraries found on your system.
>>>
>>> A few options come to mind. You could pass the flags to disable zlib et al, search for what compiler flag (or maybe libc++ version) corresponds to that symbol and pass the options to the llvm build, or look up how the other libraries were built and change that.
>>>
>>> Clang builds are probably tested against the libraries that ship with Linux distributions. The paths in your error message suggest you're using some other source for them. Maybe a HPC module system of some sort? Can't see how to debug that from the outside. Maybe contact whoever set up the zlib etc builds.
>>>
>>> Jon
>>>
>>> _______________________________________________
>>> Openmp-dev mailing list
>>> Openmp-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
More information about the Openmp-dev
mailing list