[cfe-dev] Link error while trying to build

Alexey Samsonov samsonov at google.com
Thu Oct 25 04:01:53 PDT 2012


On Thu, Oct 25, 2012 at 2:37 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:

> Alexey,
>
>   - What is command line in linking? You may see command line with
> "make c-index-test VERBOSE=1".
>

cd /usr/local/google/llvm_cmake_clang/tools/clang/tools/c-index-test &&
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/c-index-test.dir/link.txt --verbose=1
/usr/local/google/llvm_cmake/bin/clang++   -Werror -fPIC
-fvisibility-inlines-hidden -fno-common -Woverloaded-virtual -Wcast-qual
-fno-strict-aliasing -pedantic -Wno-long-long -Wall -W
-Wno-unused-parameter -Wwrite-strings -fno-rtti -O3 -DNDEBUG
 CMakeFiles/c-index-test.dir/c-index-test.c.o  -o
../../../../bin/c-index-test -rdynamic ../../../../lib/libLLVMMC.a
../../../../lib/libLLVMObject.a ../../../../lib/libLLVMSupport.a -ldl
-lpthread ../../../../lib/libclang.so.3.2 -lxml2
../../../../lib/libclangARCMigrate.a ../../../../lib/libclangTooling.a
../../../../lib/libclangRewriteCore.a
../../../../lib/libclangRewriteFrontend.a
../../../../lib/libclangFrontend.a ../../../../lib/libclangDriver.a
../../../../lib/libclangSerialization.a ../../../../lib/libclangParse.a
../../../../lib/libclangSema.a ../../../../lib/libLLVMX86CodeGen.a
../../../../lib/libLLVMX86AsmParser.a
../../../../lib/libLLVMX86Disassembler.a
../../../../lib/libLLVMARMCodeGen.a ../../../../lib/libLLVMARMAsmParser.a
../../../../lib/libLLVMARMDisassembler.a ../../../../lib/libLLVMAsmParser.a
../../../../lib/libLLVMX86Desc.a ../../../../lib/libLLVMAsmPrinter.a
../../../../lib/libLLVMSelectionDAG.a ../../../../lib/libLLVMARMDesc.a
../../../../lib/libLLVMX86AsmPrinter.a ../../../../lib/libLLVMX86Info.a
../../../../lib/libLLVMMCParser.a ../../../../lib/libLLVMCodeGen.a
../../../../lib/libLLVMARMAsmPrinter.a ../../../../lib/libLLVMARMInfo.a
../../../../lib/libLLVMX86Utils.a ../../../../lib/libLLVMScalarOpts.a
../../../../lib/libLLVMInstCombine.a
../../../../lib/libLLVMTransformUtils.a ../../../../lib/libLLVMipa.a
../../../../lib/libLLVMAnalysis.a ../../../../lib/libLLVMTarget.a
../../../../lib/libLLVMCore.a ../../../../lib/libclangEdit.a
../../../../lib/libclangAnalysis.a ../../../../lib/libclangAST.a
../../../../lib/libclangLex.a ../../../../lib/libclangASTMatchers.a
../../../../lib/libclangBasic.a ../../../../lib/libLLVMMC.a
../../../../lib/libLLVMObject.a ../../../../lib/libLLVMSupport.a -ldl
-lpthread -Wl,-rpath,/usr/local/google/llvm_cmake_clang/lib
/usr/bin/ld: warning: libz.so.1, needed by
/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so, not found
(try using -rpath or -rpath-link)

If I manually add "-lz" to this command, link succeeds.


>
>   - Which distro are you using?


What data do you need? I use libxml2 from "apt-get install libxml2".
$ dpkg -S /usr/lib/libz.so
zlib1g-dev: /usr/lib/libz.so


> ...Takumi
>
> 2012/10/25 Alexey Samsonov <samsonov at google.com>:
> > I've recently started to see this error while linking c-index-test in
> CMake
> > build:
> > [ 95%] Linking CXX executable ../../../../bin/c-index-test
> > /usr/bin/ld: warning: libz.so.1, needed by
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so, not found
> > (try using -rpath or -rpath-link)
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `deflateInit2_'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `deflate'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `deflateEnd'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `crc32'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `inflate'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `inflateInit2_'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `inflateEnd'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzrewind'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzopen64'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzwrite'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzclose'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzdopen'
> > /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../lib64/libxml2.so: undefined
> > reference to `gzread'
> >
> > I think that I have libz installed:
> > $ ls -l /usr/lib64/libz.*
> > -rw-r--r-- 1 root root 118210 2009-11-09 18:53 /usr/lib64/libz.a
> > lrwxrwxrwx 1 root root     20 2011-12-15 16:50 /usr/lib64/libz.so ->
> > /lib/libz.so.1.2.3.3
> > lrwxrwxrwx 1 root root     20 2012-10-25 13:20 /usr/lib64/libz.so.1 ->
> > /lib/libz.so.1.2.3.3
> >
> > Should tools/c-index-test/CMakeLists.txt explicitly link c-index-test
> with
> > libz library as well, or there is some other problem?
> >
> > --
> > Alexey Samsonov, MSK
> >
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121025/4d9769ad/attachment.html>


More information about the cfe-dev mailing list