Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move linker options after object so they are included as dependencies #148

Closed
wants to merge 1 commit into from

Conversation

rm-hull
Copy link

@rm-hull rm-hull commented Mar 4, 2015

Trying to use https://code.google.com/p/py-leveldb/ against this flavor of leveldb, and on importing, get errors as follows (on Ubuntu 12.04 LTS):

ImportError: /usr/local/lib/libleveldb.so.1: undefined symbol: clock_nanosleep

Looking at the source, clock_nanosleep should be part of librt, but its not listed as a dependency:

$ ldd libleveldb.so
    linux-vdso.so.1 =>  (0x00007fffd09b6000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb5b3490000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb5b3194000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb5b2f7d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb5b2d60000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb5b29a1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb5b3a26000)

even though -lrt is passed in the flags. The problem is that the linked libraries should be supplied after the -o libleveldb.so.1.9 flag, else they seem to be ignored

With the patched makefile, rebuilding and checking dependencies:

$ ldd libleveldb.so
    linux-vdso.so.1 =>  (0x00007fff18dce000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3c17585000)
    libsnappy.so.1 => /usr/local/lib/libsnappy.so.1 (0x00007f3c1737e000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3c1707d000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3c16d81000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3c16b6b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3c1694d000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3c1658e000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3c17a23000)

Note that librt and snappy are both now referenced correctly, and I can use it from python successfully

@matthewvon
Copy link
Contributor

Would you try building with new Makefile contained within this pull request:

#183

I attempted to incorporate your work with a general rewrite of the Makefile. The ldd test on my Debian box matches your expected example.

@rm-hull
Copy link
Author

rm-hull commented Jan 5, 2016

Hi @matthewvon, pulled from the mv-make-makeover branch and rebuilt and can confirm that the dependencies include librt.so

@matthewvon
Copy link
Contributor

Change merged into another PR and merged today. Thank you.

@matthewvon matthewvon closed this Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants