ecc-ld: attempted static link of dynamic object libexpat.so

Home Forums Forum ecc-ld: attempted static link of dynamic object libexpat.so

This topic contains 3 replies, has 2 voices, and was last updated by  Alex 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #77195 Reply

    Alex

    Hi,

    Attempting to build ELLCC from source on an Ubuntu Xenial x86_64 box and keep running into an error while building metalinkcat.
    The rported error is:
    /home/vagrant/ellcc/bin/ecc-ld: attempted static link of dynamic object/usr/lib/x86_64-linux-gnu/libexpat.so’`

    The output from the build process is:

    /home/vagrant/ellcc/libecc/../bin/ecc -target arm64v8-linux -DHAVE_CONFIG_H -I. -I../../../../src/libmetalink/doc/examples -I../..  -I../../../../src/libmetalink/lib/includes -I../../lib/includes -DHAVE_INTTYPES_H   -target arm64v8-linux -g -MT metalinkcat.o -MD -MP -MF .deps/metalinkcat.Tpo -c -o metalinkcat.o metalinkcat.c
    mv -f .deps/metalinkcat.Tpo .deps/metalinkcat.Po
    /bin/bash ../../libtool  --tag=CC   --mode=link /home/vagrant/ellcc/libecc/../bin/ecc -target arm64v8-linux  -target arm64v8-linux -g  -target arm64v8-linux -o metalinkcat metalinkcat.o ../../lib/libmetalink.la 
    libtool: link: /home/vagrant/ellcc/libecc/../bin/ecc -target arm64v8-linux -target arm64v8-linux -g -target arm64v8-linux -o metalinkcat metalinkcat.o  ../../lib/.libs/libmetalink.a /usr/lib/x86_64-linux-gnu/libexpat.so
    clang-4.0: warning: argument unused during compilation: '-g'
    /home/vagrant/ellcc/bin/ecc-ld: attempted static link of dynamic object 

    /usr/lib/x86_64-linux-gnu/libexpat.so’
    clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
    Makefile:359: recipe for target ‘metalinkcat’ failed
    make[6]: *** [metalinkcat] Error 1
    Makefile:365: recipe for target ‘all-recursive’ failed
    make[5]: *** [all-recursive] Error 1
    Makefile:415: recipe for target ‘all-recursive’ failed
    make[4]: *** [all-recursive] Error 1
    Makefile:345: recipe for target ‘all’ failed
    make[3]: *** [all] Error 2
    Makefile:432: recipe for target ‘arm64v8-linux.libmetalink.build’ failed
    make[2]: *** [arm64v8-linux.libmetalink.build] Error 2
    Makefile:404: recipe for target ‘arm64v8-linux’ failed
    make[1]: *** [arm64v8-linux] Error 2
    make[1]: Leaving directory ‘/home/vagrant/ellcc/libecc’
    Make failed for libecc
    Error: leaving module
    Makefile:16: recipe for target ‘me’ failed
    make: *** [me] Error 1`

    Can anyone provide any insight into this error?

    #77227 Reply

    Alex

    Does anyone have any ideas about this?
    Would really love to get ELLCC compiling completely so I can start using it.

    #77229 Reply

    rich
    Keymaster

    Hi Alex,

    Sorry it has taken so long to get back to you.
    I think the problem is that libtool is mistakenly giving the system libexpat.so to the linker when trying to build the metalinkcat utility,

    Originally I tried to build ELLCC from scratch on my Fedora system which has libexpat installed. Unfortunately the build went just fine: build with gcc worked, subsequent build with ecc worked. I’m not sure why Ubuntu would be different, unfortunately.

    The good news is that you have everything you need built. If you were to edit /home/vagrant/ellcc/libecc/Makefile to remove the libmetalink parts, I think the rest of your build would go OK. Comment this part out:

    $(Configs):: musl.install
            $(OUT)$(MAKE) $(MFLAGS) $@.libmetalink.configure && \
            $(MAKE) $(MFLAGS) $@.libmetalink.build && \
            $(MAKE) $(MFLAGS) $@.libmetalink.install
    

    -Rich

    #77284 Reply

    Alex

    Hi Rich,

    I went the other way around and figured out how to solve the problem. I believe that libtool found libexpat.la in /usr/lib/x86_64-linux-gnu which informs libtool to use /usr/lib/x86_64-linux-gnu/libexpat.so.

    The solution was to copy the generated libexpat.la to libecc/lib and then add libecc/lib to LDFLAGS. This allows libtool to find our libexpat.la which subsequently allows libtool to find our libexpat.a.

    Here is a patch that should fix this issue (it works on my system). The patch also includes a small fix to the build-setup script that was preventing the second make pass to not correctly detect that the first make pass had completed.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: ecc-ld: attempted static link of dynamic object libexpat.so
Your information: