libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Libtool does not detect statically linked internal compiler libraries


From: Manoj Gupta
Subject: Libtool does not detect statically linked internal compiler libraries
Date: Wed, 26 Jul 2017 19:41:01 -0700

Hi,

We are trying to use clang with address sanitizer in one of the projects. However, there are build issues because libtool's internal compiler library detection part does not work with static libraries. 

e.g. clang++ main.cpp -fsanitize=address -v shows the use of static library /usr/lib64/clang/5.0.0/lib/linux/libclang_rt.asan-x86_64.a

Looking at the source code at http://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4#n7556 , libtool does not handle use of static libraries.


dnl Parse the compiler output and extract the necessary
dnl objects, libraries and library flags.
if AC_TRY_EVAL(ac_compile); then
  # Parse the compiler output and extract the necessary
  # objects, libraries and library flags.

  # Sentinel used to keep track of whether or not we are before
  # the conftest object file.
  pre_test_object_deps_done=no

  for p in `eval "$output_verbose_link_cmd"`; do
    case $prev$p in
  for p in `eval "$output_verbose_link_cmd"`; do
    case $prev$p in

    -L* | -R* | -l*) // Adding *.a here should handle static library

Is it possible for libtool to handle this case?

Linker command line (from the above clang invocation):

/usr/bin/x86_64-pc-linux-gnu-ld" --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crt1.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crti.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/crtbegin.o -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../x86_64-pc-linux-gnu/lib -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/lib64/clang/5.0.0/lib/linux/libclang_rt.asan-x86_64.a -no-whole-archive --dynamic-list=/usr/lib64/clang/5.0.0/lib/linux/libclang_rt.asan-x86_64.a.syms -whole-archive /usr/lib64/clang/5.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a -no-whole-archive --dynamic-list=/usr/lib64/clang/5.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms /tmp/main-0d221f.o -lc++ -lm --no-as-needed -lpthread -lrt -lm -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/crtend.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/../../../../lib64/crtn.o

Thanks,
Manoj


reply via email to

[Prev in Thread] Current Thread [Next in Thread]