[cfe-dev] Trouble building Clang on CentOS 6

Uri Moszkowicz via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 15 14:20:45 PDT 2017


I figured it out: "-DCMAKE_CXX_FLAGS=-static-libstdc++". The link flags
don't appear to be necessary. I think the CMake variable changed for it
too, now CMAKE_EXE_LINKER_FLAGS.

I'd happily update the documentation but I've not contributed to this
project before. Should I try or ask one of you to do it?

On Wed, Sep 13, 2017 at 12:14 PM, Uri Moszkowicz <uri at 4refs.com> wrote:

> Setting LD_LIBRARY_PATH seems to solve the problem but then leaves a
> runtime dependency. The variable needs to be set when the executable is
> called as well. The instructions provided a CMake variable that was
> supposed to solve this problem (CMAKE_CXX_LINK_FLAGS)... only it doesn't
> seem to work.
>
> On Thu, Sep 7, 2017 at 4:45 PM, Jeff Hammond <jeff.science at gmail.com>
> wrote:
>
>> /usr/lib64/libstdc++.so.6 indicates that you need to set LD_LIBRARY_PATH
>> to point to the toolchain you installed.
>>
>> Best,
>>
>> Jeff
>>
>>
>> On Wed, Sep 6, 2017 at 3:07 PM, Uri Moszkowicz <uri at 4refs.com> wrote:
>>
>>> I get the same error using your build script :(
>>>
>>>  46%] Copying clang's cuda_wrappers/algorithm...
>>> [ 46%] Copying clang's cuda_wrappers/new...
>>> [ 46%] Copying clang's cuda_wrappers/complex...
>>> [ 46%] Building arm_neon.h...
>>> ../../../../bin/clang-tblgen: /usr/lib64/libstdc++.so.6: version
>>> `GLIBCXX_3.4.20' not found (required by ../../../../bin/clang-tblgen)
>>> ../../../../bin/clang-tblgen: /usr/lib64/libstdc++.so.6: version
>>> `CXXABI_1.3.9' not found (required by ../../../../bin/clang-tblgen)
>>> ../../../../bin/clang-tblgen: /usr/lib64/libstdc++.so.6: version
>>> `GLIBCXX_3.4.14' not found (required by ../../../../bin/clang-tblgen)
>>> ../../../../bin/clang-tblgen: /usr/lib64/libstdc++.so.6: version
>>> `GLIBCXX_3.4.19' not found (required by ../../../../bin/clang-tblgen)
>>> ../../../../bin/clang-tblgen: /usr/lib64/libstdc++.so.6: version
>>> `GLIBCXX_3.4.21' not found (required by ../../../../bin/clang-tblgen)
>>> make[2]: *** [tools/clang/lib/Headers/arm_neon.h.tmp] Error 1
>>> make[2]: *** Waiting for unfinished jobs....
>>> make[1]: *** [tools/clang/lib/Headers/CMakeFiles/clang-headers.dir/all]
>>> Error 2
>>> [ 46%] Linking CXX executable ../../bin/not
>>> [ 46%] Built target not
>>> [ 46%] Linking CXX executable ../../bin/llvm-cxxfilt
>>> [ 46%] Linking CXX executable ../../bin/llvm-mcmarkup
>>> [ 46%] Built target llvm-cxxfilt
>>>
>>> My CMake, FCC, and Python builds were from source, not the package
>>> manager. I'm using CentOS 6.7 btw.
>>>
>>> I think there's a clue in the error message here, given the reference to
>>> /usr/lib64. I noticed that spaces in arguments were getting dropped by
>>> CMake in commands. You don't have the linker option CMAKE_CXX_LINK_FLAGS
>>> specified from the build instructions but even if you did, the latter half
>>> of the option is truncated.
>>>
>>> On Fri, Sep 1, 2017 at 10:33 PM, Jeff Hammond <jeff.science at gmail.com>
>>> wrote:
>>>
>>>> I built the latest Git on CentOS 6 two days ago, but I use upgraded
>>>> CMake, GCC, Python and other things.  So there is nothing fundamentally
>>>> wrong with CentOS other than the built-in packages it comes with are too
>>>> old.
>>>>
>>>> I recall CMake does something idiotic wherein it prefers
>>>> /usr/bin/python over `which python`, which you have to manually override
>>>> with -DPYTHON_EXECUTABLE=`which python`, or at least that is what I
>>>> archived in my successful build script.
>>>> https://github.com/jeffhammond/HPCInfo/blob/master/buildscri
>>>> pts/llvm-git.sh#L95
>>>>
>>>> Jeff
>>>>
>>>>
>>>> On Fri, Sep 1, 2017 at 3:18 PM, Uri Moszkowicz via cfe-dev <
>>>> cfe-dev at lists.llvm.org> wrote:
>>>> >
>>>> > Hi Csaba,
>>>> > I started with the instructions on the LLVM website. The problem is
>>>> that CentOS 6 does not meet the build requirements, shown here:
>>>> >
>>>> > http://llvm.org/docs/GettingStarted.html#requirements
>>>> >
>>>> > I built the required versions of software but the instructions don't
>>>> cover how to utilize them.
>>>> >
>>>> > Anyway, I compiled again with VERBOSE and discovered the problem is
>>>> missing LibraryDependencies.inc. I specified python27 with a CMake variable
>>>> and added it to my PATH but it still didn't solve the problem:
>>>> >
>>>> > make[2]: Nothing to be done for `projects/compiler-rt/lib/buil
>>>> tins/CMakeFiles/builtins.dir/build'.
>>>> > make[2]: Leaving directory `<clang-4.0.1>/src/build/llvm-
>>>> 4.0.1-redhat6'
>>>> > [ 36%] Built target builtins
>>>> > <llvm-4.0.1>/tools/llvm-config/llvm-config.cpp:47:35: fatal error:
>>>> LibraryDependencies.inc: No such file or directory
>>>> >  #include "LibraryDependencies.inc"
>>>> >                                    ^
>>>> > compilation terminated.
>>>> > make[2]: *** [tools/llvm-config/CMakeFiles/
>>>> llvm-config.dir/llvm-config.cpp.o] Error 1
>>>> > make[2]: Leaving directory `<clang-4.0.1>/src/build/llvm-
>>>> 4.0.1-redhat6'
>>>> > make[1]: *** [tools/llvm-config/CMakeFiles/llvm-config.dir/all]
>>>> Error 2
>>>> >
>>>> > How can I move past this error? Despite setting LD_LIBRARY_PATH and
>>>> CMAKE_CXX_LINK_FLAGS as indicated in the instructions above, I also still
>>>> seem to be getting GLIBC errors too :(
>>>> >
>>>> > Thanks,
>>>> > Uri
>>>> >
>>>> >
>>>> > On Thu, Aug 31, 2017 at 3:47 AM, Csaba Raduly <rcsaba at gmail.com>
>>>> wrote:
>>>> >>
>>>> >> Hi Uri,
>>>> >>
>>>> >> On Wed, Aug 30, 2017 at 11:35 PM, Uri Moszkowicz via cfe-dev
>>>> >> <cfe-dev at lists.llvm.org> wrote:
>>>> >> > Hi,
>>>> >> > I'm having trouble building Clang on CentOS 6 and am hoping
>>>> someone here can
>>>> >> > help. I followed the instructions on this website:
>>>> >> >
>>>> >> > http://btorpey.github.io/blog/2015/01/02/building-clang/
>>>> >>
>>>> >> Seems a bit old, why not  https://clang.llvm.org/get_started.html
>>>> >>
>>>> >> >
>>>> >> > I'm using GCC 6.3.0 and Python 2.7.13, both also built from source
>>>> using
>>>> >> > these options:
>>>> >> >
>>>> >> > -DCMAKE_C_COMPILER=<gcc-6.3.0>/redhat6/bin/gcc
>>>> >> > -DCMAKE_CXX_COMPILER=<gcc-6.3.0>/redhat6/bin/g++
>>>> >> > -DCMAKE_CXX_LINK_FLAGS='-L<gcc-6.3.0>/redhat6/lib64
>>>> >> > -Wl,-rpath,<gcc-6.3.0>/redhat6/lib64'
>>>> >> > -DLLVM_ENABLE_ASSERTIONS=ON
>>>> >> > -DCMAKE_BUILD_TYPE=Release
>>>> >> > -DLLVM_TARGETS_TO_BUILD=X86
>>>> >> > -DGCC_INSTALL_PREFIX=<gcc-6.3.0>/redhat6
>>>> >> > -DPYTHON_EXECUTABLE:FILEPATH=<python-2.7.13>/redhat6/bin/python
>>>> >> > -DCMAKE_INSTALL_PREFIX=<clang-4.0.1>/redhat6
>>>> >> >
>>>> >> > The errors I'm seeing look like this (I used -j32):
>>>> >> >
>>>> >> > [  4%] Building CXX object
>>>> >> > lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o
>>>> >> > [  4%] Building CXX object
>>>> >> > lib/Option/CMakeFiles/LLVMOption.dir/OptTable.cpp.o
>>>> >> > [  6%] Building C object
>>>> >> > projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builti
>>>> ns-x86_64.dir/absvdi2.c.o
>>>> >> > [  6%] Building CXX object
>>>> >> > projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanit
>>>> izerCommonLibc.x86_64.dir/sanitizer_coverage_mapping_libcdep.cc.o
>>>> >> > Scanning dependencies of target LLVMSupport
>>>> >> > g++: fatal error: no input files
>>>> >> > compilation terminated.
>>>> >> > make[2]: *** [bin/llvm-PerfectShuffle] Error 1
>>>> >> > make[1]: *** [utils/PerfectShuffle/CMakeFil
>>>> es/llvm-PerfectShuffle.dir/all]
>>>> >> > Error 2
>>>> >> (snip)
>>>> >> >
>>>> >> > Any thoughts about what else I need to do?
>>>> >>
>>>> >> For debugging purposes, build with
>>>> >>
>>>> >> make VERBOSE=1
>>>> >>
>>>> >> This would print the actual compiler invocation; the we'll have a
>>>> >> better chance figuring out what went wrong.
>>>> >>
>>>> >> Csaba
>>>> >> --
>>>> >> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
>>>> >> The Tao of math: The numbers you can count are not the real numbers.
>>>> >> Life is complex, with real and imaginary parts.
>>>> >> "Ok, it boots. Which means it must be bug-free and perfect. " --
>>>> Linus Torvalds
>>>> >> "People disagree with me. I just ignore them." -- Linus Torvalds
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > cfe-dev mailing list
>>>> > cfe-dev at lists.llvm.org
>>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Jeff Hammond
>>>> jeff.science at gmail.com
>>>> http://jeffhammond.github.io/
>>>>
>>>
>>>
>>
>>
>> --
>> Jeff Hammond
>> jeff.science at gmail.com
>> http://jeffhammond.github.io/
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170915/7ce6178d/attachment.html>


More information about the cfe-dev mailing list