[LLVMdev] r204593 breaks Asan tests on FreeBSD

Alexey Samsonov samsonov at google.com
Fri Apr 4 04:07:15 PDT 2014


Hi Ivan,

On Thu, Apr 3, 2014 at 11:56 PM, Ivan A. Kosarev <ivan at ivan-labs.com> wrote:

> Hello Alexey,
>
> I just worked out the config for the FreeBSD 9.2 buildbot (follows below).
> One important thing about this config is that the C++11 headers are set up
> at the /usr/include/c++/v1 directory--it's where clang expects them to be
> on FreeBSD, so no need for the "-I" options in the CMAKE_CXX_FLAGS
> variable. Unfortunately, clang (both v3.3 used to be the default compiler
> on FreeBSD 9.2 and recent revisions) do not add the libcxxrt run-time lib
> to ld options what means we have to ask cmake to add it for us (see the
> cmake invocation at the end of the config list). This approach let us build
> and run the common sanitizers tests with no unexpected failures. The only
> issue is that the HAVE_UNIT64_T & Co. tests fail to link due to omitted
> reference to libcxxrt. The quick fix is trivial:
>
> ---
> Index: cmake/config-ix.cmake
> ===================================================================
> --- cmake/config-ix.cmake    (revision 205543)
> +++ cmake/config-ix.cmake    (working copy)
> @@ -17,6 +17,7 @@
>    # Used by check_symbol_exists:
>    set(CMAKE_REQUIRED_LIBRARIES m)
>  endif()
> +list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_CONFIG_TEST_LIBRARIES})
>
>  # Helper macros and functions
>  macro(add_cxx_include result files)
> ---
>
> Do you think this fix would make sense for building llvm on other
> platforms? I mean, do you think it looks acceptable to be sent for review
> and commit? Please let me know.
>

Personally, I think it's fine to just add "cxxrt" to
CMAKE_REQUIRED_LIBRARIES in config-ix.cmake on the platforms that require
it (FreeBSD 9.2?).


>
> Also, I believe I should prepare a patch that adds the -lcxxrt option for
> a linker on FreeBSD so one day we can build llvm on FreeBSD without all
> these tricky things.
>

Yes, please!


>
> The config is this:
> ---
> # The proposed buildbot config for FreeBSD 9.2
>
> # we have to install these from ports as the packages versions are too old
> cd /usr/ports/devel/subversion
> sudo make BATCH=1 install clean
>
> cd /usr/ports/devel/libc++
> sudo make BATCH=1
> sudo make PREFIX=/usr install clean
>
> cd /usr/src/lib/libcxxrt
> sudo make
> sudo make install clean
>
> cd /usr/ports/shells/bash
> sudo make BATCH=1 install clean
>
> cd /usr/ports/textproc/gnugrep
> sudo make BATCH=1 install clean
>
> wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.gz
> ./configure --prefix=/usr --enable-language=c,c++
> gmake
> sudo gmake install
>
> # these are necessary to pass LLVM :: BugPoint/compile-custom.ll
> sudo pkg install gcc
> sudo pkg install python
>
> CC=clang CXX=clang++ cmake \
>     -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" \
>     -DCMAKE_CXX_COMPILER_WORKS=1 \
>

^^^
Why do you need this line?



>     -DCMAKE_EXE_LINKER_FLAGS="-lcxxrt" \
>     -DLLVM_CONFIG_TEST_LIBRARIES="cxxrt" \
>     ../llvm
> ---
>
> Thanks!
>
> --
>
>


-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140404/02d6ed6a/attachment.html>


More information about the llvm-dev mailing list