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

find_library always misses on first try #7947

Closed
rickhg12hs opened this issue Aug 10, 2014 · 13 comments
Closed

find_library always misses on first try #7947

rickhg12hs opened this issue Aug 10, 2014 · 13 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@rickhg12hs
Copy link
Contributor

$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-rc3+6 (2014-08-10 22:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit fa7edd8 (0 days old master)
|__/                   |  i686-redhat-linux

julia> find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
""

julia> find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue"

julia> versioninfo()
Julia Version 0.3.0-rc3+6
Commit fa7edd8 (2014-08-10 22:08 UTC)
Platform Info:
  System: Linux (i686-redhat-linux)
  CPU: Genuine Intel(R) CPU           T2250  @ 1.73GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Banias)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia> 
@staticfloat
Copy link
Member

@Keno

@Keno
Copy link
Member

Keno commented Aug 12, 2014

I'm having trouble reproducing this. Does this happen with other libraries as well or just with that one?

@rickhg12hs
Copy link
Contributor Author

So far it seems to be just that one (of the dozen or so that I've tried).

Here's something else that's curious. find_library finds cardsvalue.so straight away.

$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-pre+63 (2014-08-12 05:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 6a8039a (0 days old master)
|__/                   |  i686-redhat-linux

julia> find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue.so"

julia> find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue"

julia> 

$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-pre+63 (2014-08-12 05:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 6a8039a (0 days old master)
|__/                   |  i686-redhat-linux

julia> find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
""

julia> find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue"

julia> 

@ihnorton
Copy link
Member

@rickhg12hs is this still an issue? If so, before running Julia can you please try setting export LD_DEBUG=libs? (other options to try include: symbols, all, or help). This will print debugging output from the dynamic linker and hopefully give some idea what is failing.

(you might also want to set LD_DEBUG_OUTPUT=/some/file if you don't want to spam your terminal too much)

@rickhg12hs
Copy link
Contributor Author

@ihnorton Yes, unfortunately it is still an issue.

The behavior is slightly different in that the .so file is not found on first try now either.

$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5700 (2015-06-29 20:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 147fa0b (0 days old master)
|__/                   |  i686-redhat-linux

julia> Libdl.find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
""

julia> Libdl.find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue"

julia> 
[Rick@steelers julia]$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5700 (2015-06-29 20:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 147fa0b (0 days old master)
|__/                   |  i686-redhat-linux

julia> Libdl.find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
""

julia> Libdl.find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue.so"

I'm not sure if there is useful info in this mega-dump, or not. Maybe because all symbols are not defined?

$ export LD_DEBUG=libs
$ ./julia 
     19199: find library=libjulia.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/i686/sse2:/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/i686:/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/sse2:/usr/local/src/julia/julia/usr/bin/../lib/julia/tls:/usr/local/src/julia/julia/usr/bin/../lib/julia/i686/sse2:/usr/local/src/julia/julia/usr/bin/../lib/julia/i686:/usr/local/src/julia/julia/usr/bin/../lib/julia/sse2:/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib/tls/i686/sse2:/usr/local/src/julia/julia/usr/bin/../lib/tls/i686:/usr/local/src/julia/julia/usr/bin/../lib/tls/sse2:/usr/local/src/julia/julia/usr/bin/../lib/tls:/usr/local/src/julia/julia/usr/bin/../lib/i686/sse2:/usr/local/src/julia/julia/usr/bin/../lib/i686:/usr/local/src/julia/julia/usr/bin/../lib/sse2:/usr/local/src/julia/julia/usr/bin/../lib        (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/i686/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/i686/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/tls/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/i686/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/i686/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/tls/i686/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/tls/i686/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/tls/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/tls/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/i686/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/i686/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/sse2/libjulia.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libjulia.so
     19199: 
     19199: find library=libdl.so.2 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libdl.so.2
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libdl.so.2
     19199:  search path=/usr/lib/mpich/lib/tls/i686/sse2:/usr/lib/mpich/lib/tls/i686:/usr/lib/mpich/lib/tls/sse2:/usr/lib/mpich/lib/tls:/usr/lib/mpich/lib/i686/sse2:/usr/lib/mpich/lib/i686:/usr/lib/mpich/lib/sse2:/usr/lib/mpich/lib:/usr/lib/alliance/lib/tls/i686/sse2:/usr/lib/alliance/lib/tls/i686:/usr/lib/alliance/lib/tls/sse2:/usr/lib/alliance/lib/tls:/usr/lib/alliance/lib/i686/sse2:/usr/lib/alliance/lib/i686:/usr/lib/alliance/lib/sse2:/usr/lib/alliance/lib        (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/tls/i686/sse2/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/tls/i686/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/tls/sse2/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/tls/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/i686/sse2/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/i686/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/sse2/libdl.so.2
     19199:   trying file=/usr/lib/mpich/lib/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/tls/i686/sse2/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/tls/i686/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/tls/sse2/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/tls/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/i686/sse2/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/i686/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/sse2/libdl.so.2
     19199:   trying file=/usr/lib/alliance/lib/libdl.so.2
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libdl.so.2
     19199: 
     19199: find library=librt.so.1 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/librt.so.1
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/librt.so.1
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/librt.so.1
     19199:   trying file=/usr/lib/alliance/lib/librt.so.1
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/librt.so.1
     19199: 
     19199: find library=libpthread.so.0 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libpthread.so.0
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libpthread.so.0
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libpthread.so.0
     19199:   trying file=/usr/lib/alliance/lib/libpthread.so.0
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libpthread.so.0
     19199: 
     19199: find library=libstdc++.so.6 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libstdc++.so.6
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libstdc++.so.6
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libstdc++.so.6
     19199:   trying file=/usr/lib/alliance/lib/libstdc++.so.6
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libstdc++.so.6
     19199: 
     19199: find library=libm.so.6 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libm.so.6
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libm.so.6
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libm.so.6
     19199:   trying file=/usr/lib/alliance/lib/libm.so.6
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libm.so.6
     19199: 
     19199: find library=libgcc_s.so.1 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libgcc_s.so.1
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libgcc_s.so.1
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libgcc_s.so.1
     19199:   trying file=/usr/lib/alliance/lib/libgcc_s.so.1
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libgcc_s.so.1
     19199: 
     19199: find library=libc.so.6 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libc.so.6
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libc.so.6
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libc.so.6
     19199:   trying file=/usr/lib/alliance/lib/libc.so.6
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libc.so.6
     19199: 
     19199: find library=libz.so.1 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libz.so.1
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libz.so.1
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libz.so.1
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libz.so.1
     19199:   trying file=/usr/lib/alliance/lib/libz.so.1
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libz.so.1
     19199: 
     19199: 
     19199: calling init: /lib/libpthread.so.0
     19199: 
     19199: 
     19199: calling init: /lib/libc.so.6
     19199: 
     19199: 
     19199: calling init: /lib/libz.so.1
     19199: 
     19199: 
     19199: calling init: /lib/libgcc_s.so.1
     19199: 
     19199: 
     19199: calling init: /lib/libm.so.6
     19199: 
     19199: 
     19199: calling init: /lib/libstdc++.so.6
     19199: 
     19199: 
     19199: calling init: /lib/librt.so.1
     19199: 
     19199: 
     19199: calling init: /lib/libdl.so.2
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libjulia.so
     19199: 
     19199: 
     19199: initialize program: ./julia
     19199: 
     19199: 
     19199: transferring control: ./julia
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/lib/julia/sys.so
     19199: 
     19199: find library=libpcre2-8.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libpcre2-8.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libpcre2-8.so
     19199: 
     19199: find library=libgmp.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libgmp.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libgmp.so
     19199: 
     19199: find library=libmpfr.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libmpfr.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libmpfr.so
     19199: 
     19199: find library=libdSFMT.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libdSFMT.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libdSFMT.so
     19199: 
     19199: find library=libopenblas.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libopenblas.so
     19199: 
     19199: find library=libgfortran.so.3 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libgfortran.so.3
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libgfortran.so.3
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libgfortran.so.3
     19199:   trying file=/usr/lib/alliance/lib/libgfortran.so.3
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libgfortran.so.3
     19199: 
     19199: find library=libquadmath.so.0 [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/libquadmath.so.0
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libquadmath.so.0
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/libquadmath.so.0
     19199:   trying file=/usr/lib/alliance/lib/libquadmath.so.0
     19199:  search cache=/etc/ld.so.cache
     19199:   trying file=/lib/libquadmath.so.0
     19199: 
     19199: 
     19199: calling init: /lib/libquadmath.so.0
     19199: 
     19199: 
     19199: calling init: /lib/libgfortran.so.3
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libopenblas.so
     19199: 
     19199: find library=libcholmod.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libcholmod.so
     19199: 
     19199: find library=libcolamd.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libcolamd.so
     19199: 
     19199: find library=libamd.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libamd.so
     19199: 
     19199: find library=libcamd.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libcamd.so
     19199: 
     19199: find library=libccolamd.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libccolamd.so
     19199: 
     19199: find library=libsuitesparseconfig.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libsuitesparseconfig.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libsuitesparseconfig.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libccolamd.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libcamd.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libamd.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libcolamd.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libcholmod.so
     19199: 
     19199: find library=libsuitesparse_wrapper.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libsuitesparse_wrapper.so
     19199: 
     19199: find library=libumfpack.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libumfpack.so
     19199: 
     19199: find library=libspqr.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/libspqr.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libspqr.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libumfpack.so
     19199: 
     19199: 
     19199: calling init: /usr/local/src/julia/julia/usr/bin/../lib/libsuitesparse_wrapper.so
     19199: 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5700 (2015-06-29 20:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 147fa0b (0 days old master)
|__/                   |  i686-redhat-linux

julia> Libdl.find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
     19199: 
     19199: calling init: /home/rick/Julia/pokerth/cardsvalue.so
     19199: 
     19199: /home/rick/Julia/pokerth/cardsvalue.so: error: symbol lookup error: undefined symbol: _ZN5boost6system16generic_categoryEv (fatal)
     19199: find library=cardsvalue.so.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/cardsvalue.so.so
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/cardsvalue.so.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/cardsvalue.so.so
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/cardsvalue.so.so
     19199:   trying file=/usr/lib/alliance/lib/cardsvalue.so.so
     19199:  search cache=/etc/ld.so.cache
     19199:  search path=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib        (system search path)
     19199:   trying file=/lib/tls/i686/sse2/cardsvalue.so.so
     19199:   trying file=/lib/tls/i686/cardsvalue.so.so
     19199:   trying file=/lib/tls/sse2/cardsvalue.so.so
     19199:   trying file=/lib/tls/cardsvalue.so.so
     19199:   trying file=/lib/i686/sse2/cardsvalue.so.so
     19199:   trying file=/lib/i686/cardsvalue.so.so
     19199:   trying file=/lib/sse2/cardsvalue.so.so
     19199:   trying file=/lib/cardsvalue.so.so
     19199:   trying file=/usr/lib/tls/i686/sse2/cardsvalue.so.so
     19199:   trying file=/usr/lib/tls/i686/cardsvalue.so.so
     19199:   trying file=/usr/lib/tls/sse2/cardsvalue.so.so
     19199:   trying file=/usr/lib/tls/cardsvalue.so.so
     19199:   trying file=/usr/lib/i686/sse2/cardsvalue.so.so
     19199:   trying file=/usr/lib/i686/cardsvalue.so.so
     19199:   trying file=/usr/lib/sse2/cardsvalue.so.so
     19199:   trying file=/usr/lib/cardsvalue.so.so
     19199: 
     19199: find library=cardsvalue.so [0]; searching
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/cardsvalue.so
     19199:  search path=/usr/local/src/julia/julia/usr/bin/../lib/julia:/usr/local/src/julia/julia/usr/bin/../lib      (RPATH from file ./julia)
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/julia/cardsvalue.so
     19199:   trying file=/usr/local/src/julia/julia/usr/bin/../lib/cardsvalue.so
     19199:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19199:   trying file=/usr/lib/mpich/lib/cardsvalue.so
     19199:   trying file=/usr/lib/alliance/lib/cardsvalue.so
     19199:  search cache=/etc/ld.so.cache
     19199:  search path=/lib/tls:/lib/i686:/lib/sse2:/lib:/usr/lib/tls:/usr/lib/i686:/usr/lib/sse2:/usr/lib        (system search path)
     19199:   trying file=/lib/tls/cardsvalue.so
     19199:   trying file=/lib/i686/cardsvalue.so
     19199:   trying file=/lib/sse2/cardsvalue.so
     19199:   trying file=/lib/cardsvalue.so
     19199:   trying file=/usr/lib/tls/cardsvalue.so
     19199:   trying file=/usr/lib/i686/cardsvalue.so
     19199:   trying file=/usr/lib/sse2/cardsvalue.so
     19199:   trying file=/usr/lib/cardsvalue.so
     19199: 
     19205: find library=libtinfo.so.5 [0]; searching
     19205:  search path=/usr/lib/mpich/lib/tls/i686/sse2:/usr/lib/mpich/lib/tls/i686:/usr/lib/mpich/lib/tls/sse2:/usr/lib/mpich/lib/tls:/usr/lib/mpich/lib/i686/sse2:/usr/lib/mpich/lib/i686:/usr/lib/mpich/lib/sse2:/usr/lib/mpich/lib:/usr/lib/alliance/lib/tls/i686/sse2:/usr/lib/alliance/lib/tls/i686:/usr/lib/alliance/lib/tls/sse2:/usr/lib/alliance/lib/tls:/usr/lib/alliance/lib/i686/sse2:/usr/lib/alliance/lib/i686:/usr/lib/alliance/lib/sse2:/usr/lib/alliance/lib        (LD_LIBRARY_PATH)
     19205:   trying file=/usr/lib/mpich/lib/tls/i686/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/tls/i686/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/tls/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/tls/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/i686/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/i686/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/mpich/lib/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/tls/i686/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/tls/i686/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/tls/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/tls/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/i686/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/i686/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/sse2/libtinfo.so.5
     19205:   trying file=/usr/lib/alliance/lib/libtinfo.so.5
     19205:  search cache=/etc/ld.so.cache
     19205:   trying file=/lib/libtinfo.so.5
     19205: 
     19205: find library=libdl.so.2 [0]; searching
     19205:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19205:   trying file=/usr/lib/mpich/lib/libdl.so.2
     19205:   trying file=/usr/lib/alliance/lib/libdl.so.2
     19205:  search cache=/etc/ld.so.cache
     19205:   trying file=/lib/libdl.so.2
     19205: 
     19205: find library=libc.so.6 [0]; searching
     19205:  search path=/usr/lib/mpich/lib:/usr/lib/alliance/lib       (LD_LIBRARY_PATH)
     19205:   trying file=/usr/lib/mpich/lib/libc.so.6
     19205:   trying file=/usr/lib/alliance/lib/libc.so.6
     19205:  search cache=/etc/ld.so.cache
     19205:   trying file=/lib/libc.so.6
     19205: 
     19205: 
     19205: prelink checking: ok
     19205: 
     19205: calling init: /lib/libc.so.6
     19205: 
     19205: 
     19205: calling init: /lib/libdl.so.2
     19205: 
     19205: 
     19205: calling init: /lib/libtinfo.so.5
     19205: 
     19205: 
     19205: initialize program: sh
     19205: 
     19205: 
     19205: transferring control: sh
     19205: 
""

julia> Libdl.find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue.so"

julia> Libdl.find_library(["cardsvalue.so"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue.so"

julia> Libdl.find_library(["cardsvalue"],["/home/rick/Julia/pokerth"])
"/home/rick/Julia/pokerth/cardsvalue"

@rickhg12hs
Copy link
Contributor Author

Not "finding" the library seems to be related to whether all the symbols are resolved or not.

Here's another example using libpari.so that has some symbols defined in libgmp.so. This is much worse in that libpari.so is never found until libgmp.so is opened.

$ ./julia 
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+5700 (2015-06-29 20:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 147fa0b (0 days old master)
|__/                   |  i686-redhat-linux

julia> Libdl.find_library(["libpari"],["/usr/local/src/sage/sage-6.7/local/lib"])
""

julia> Libdl.find_library(["libpari"],["/usr/local/src/sage/sage-6.7/local/lib"])
""

julia> Libdl.find_library(["libpari"],["/usr/local/src/sage/sage-6.7/local/lib"])
""

julia> Libdl.find_library(["libgmp"],["/usr/local/src/sage/sage-6.7/local/lib"])

"/usr/local/src/sage/sage-6.7/local/lib/libgmp"

julia> Libdl.dlopen("/usr/local/src/sage/sage-6.7/local/lib/libgmp")
Ptr{Void} @0x0a7cf278

julia> Libdl.find_library(["libpari"],["/usr/local/src/sage/sage-6.7/local/lib"])
"/usr/local/src/sage/sage-6.7/local/lib/libpari"

@ihnorton
Copy link
Member

Not "finding" the library seems to be related to whether all the symbols are resolved or not.

Right, find_library is using dlopen underneath, which will fail if some symbol is missing. But find_library is suppressing the error messages (see also #7940 #11488). You should try to dlopen the absolute path too and see if you get an error.

You could also add paths to Libdl.DL_LOAD_PATH and then call dlopen.

This is the relevant error in the cardsvalue comment. Something wrong with the linking probably.

19199: /home/rick/Julia/pokerth/cardsvalue.so: error: symbol lookup error: undefined symbol: _ZN5boost6system16generic_categoryEv (fatal)

@rickhg12hs
Copy link
Contributor Author

@ihnorton I suppose it's not clear to me what the intended use/behavior of find_library is if it requires all symbols to be defined (through recursive search).

Even though not all symbols in cardsvalue were defined, I could still ccall the functions I was interested in and the correct results were returned.

In the other example, should libpari not be found because some symbols are defined in libgmp?

@tkelman
Copy link
Contributor

tkelman commented Jul 1, 2015

Can you check these libraries in ldd? It sounds like this might be a case of underlinking, if you were to add -Wl,--no-undefined to LDFLAGS these might fail to build. Similarly debian or fedora's package-linters would give you warnings for this.

@rickhg12hs
Copy link
Contributor Author

Should find_library be renamed to find_library_only_if_all_symbols_can_be_resolved?

@pao
Copy link
Member

pao commented Jul 1, 2015

It's not a restriction imposed by Julia, but by operating systems' dynamic linkers. Every C FFI I'm aware of has this limitation.

@ihnorton
Copy link
Member

ihnorton commented Jul 2, 2015

Right, RTLD_LAZY only goes so far: if a symbol is actually referenced then it must be resolvable.

I can't fully explain some of the behavior you've described @rickhg12hs -- specifically: being able to ccall something in a library for which find_library fails -- but without a reproducible example we're sort of flailing in the dark here. If you can share a reproducible example, or tell me how to reproduce this from something I can apt-get, then I'll try to debug further (I don't think I want to install sage though, unfortunately).

Barring that, it would be helpful to at least know if you can dlopen the library by absolute path.

@ihnorton
Copy link
Member

If this is still an issue, please comment with more information and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants