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

GZip doesn't load on Mac OS X 10.9 #10

Closed
tfar opened this issue Nov 27, 2013 · 17 comments
Closed

GZip doesn't load on Mac OS X 10.9 #10

tfar opened this issue Nov 27, 2013 · 17 comments

Comments

@tfar
Copy link

tfar commented Nov 27, 2013

tobias@ruediger ~> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+168 (2013-11-26 04:24 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit db2c6ef* (0 days old master)
|__/                   |  x86_64-apple-darwin13.0.0

julia> Pkg.add("Gadfly")
INFO: Installing Codecs v0.1.0
INFO: Installing Compose v0.1.19
INFO: Installing Datetime v0.1.2
INFO: Installing Distance v0.2.4
INFO: Installing Distributions v0.2.11
INFO: Installing Gadfly v0.1.25
INFO: Installing Iterators v0.1.1
INFO: Installing Loess v0.0.1
INFO: Installing NumericExtensions v0.2.18
INFO: REQUIRE updated.

julia> using Gadfly
Warning: New definition 
    |(NAtype,Any) at /Users/tobias/.julia/DataArrays/src/operators.jl:502
is ambiguous with: 
    |(Any,SynchronousStepCollection) at /Users/tobias/.julia/BinDeps/src/BinDeps.jl:286.
To fix, define 
    |(NAtype,SynchronousStepCollection)
before the new definition.
Warning: New definition 
    |(Any,NAtype) at /Users/tobias/.julia/DataArrays/src/operators.jl:502
is ambiguous with: 
    |(SynchronousStepCollection,Any) at /Users/tobias/.julia/BinDeps/src/BinDeps.jl:283.
To fix, define 
    |(SynchronousStepCollection,NAtype)
before the new definition.
ERROR: error compiling anonymous: could not load module libz: dlopen(libz.dylib, 1): image not found
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:46
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:46
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:43
while loading /Users/tobias/.julia/GZip/src/zlib_h.jl, in expression starting on line 8
while loading /Users/tobias/.julia/GZip/src/GZip.jl, in expression starting on line 74
while loading /Users/tobias/.julia/DataFrames/src/DataFrames.jl, in expression starting on line 18
while loading /Users/tobias/.julia/Gadfly/src/Gadfly.jl, in expression starting on line 4

or just GZip:

julia> using GZip
ERROR: error compiling anonymous: could not load module libz: dlopen(libz.dylib, 1): image not found
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:43
while loading /Users/tobias/.julia/GZip/src/zlib_h.jl, in expression starting on line 8
while loading /Users/tobias/.julia/GZip/src/GZip.jl, in expression starting on line 74

However libz is surely there:

tobias@ruediger ~> otool -L /usr/lib/libz.dylib
/usr/lib/libz.dylib:
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
tobias@ruediger ~> otool -D /usr/lib/libz.dylib
/usr/lib/libz.dylib:
/usr/lib/libz.1.dylib
@kmsquire
Copy link
Contributor

Hi Tobias,

I haven't been able to reproduce the bug on my mac. I'm wondering if maybe julia is finding an old/broken version of libz. Can you run the following code (adapted from JuliaLang/julia#4925 ):

function shlib_list()
    dynamic_libraries = Array(String,0)

    numImages = ccall( cglobal("_dyld_image_count"), Cint, (), )

    # start at 1 instead of 0 to skip self
    for i in 1:numImages-1
        name = bytestring(ccall( cglobal("_dyld_get_image_name"), Ptr{Uint8}, (Uint32,), uint32(i)))
        push!(dynamic_libraries, name)
    end

    dynamic_libraries
end

shlib_list() |> x->filter(y->contains(y,"libz"), x)

This should give the location of the "libz" found by julia.

If that is the same as the one you found above, try

dlopen("/usr/lib/libz.dylib")

@tfar
Copy link
Author

tfar commented Nov 29, 2013

Ok. This results in:

tobias@ruediger ~> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+168 (2013-11-26 04:24 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit db2c6ef* (0 days old master)
|__/                   |  x86_64-apple-darwin13.0.0

julia> function shlib_list()
           dynamic_libraries = Array(String,0)

           numImages = ccall( cglobal("_dyld_image_count"), Cint, (), )

           # start at 1 instead of 0 to skip self
           for i in 1:numImages-1
               name = bytestring(ccall( cglobal("_dyld_get_image_name"), Ptr{Uint8}, (Uint32,), uint32(i)))
               push!(dynamic_libraries, name)
           end

           dynamic_libraries
       end
shlib_list (generic function with 1 method)

julia> shlib_list() |> x->filter(y->contains(y,"libz"), x)
1-element Array{String,1}:
 "/usr/lib/libz.1.dylib"

julia> dlopen("/usr/lib/libz.dylib")
Ptr{Void} @0x00007fb1ddf7d310

However this fails:

julia> dlopen("libz")
ERROR: could not load module libz: dlopen(libz.dylib, 1): image not found
 in dlopen at c.jl:19

Could it be that it wants the full path or something?

@kmsquire
Copy link
Contributor

julia> shlib_list() |> x->filter(y->contains(y,"libz"), x)
1-element Array{String,1}:
"/usr/lib/libz.1.dylib"

I think that when I ran this on a Mac, I got "/usr/lib/libz.dylib", although I was on 10.7 (and I have to double check). @staticfloat, do you have any thoughts by chance? You're running Mavericks, right?

Could it be that it wants the full path or something?

That shouldn't be the issue, /usr/lib is automatically searched for libraries (and it has worked for all other platforms until now). It could be that something has changed in OSX 10.9, although it's unclear to me what, as of now.

Can you try a few more things:

_zlib=dlopen("/usr/lib/libz.1.dylib")
bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))

_zlib=dlopen("libz.1.dylib")
bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))

_zlib=dlopen("libz.1")
bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))

I'm guessing that all of these will work, and I can check in a workaround, at least.

@tfar
Copy link
Author

tfar commented Nov 29, 2013

Just one of them seemed to work.

tobias@ruediger ~> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+168 (2013-11-26 04:24 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit db2c6ef* (0 days old master)
|__/                   |  x86_64-apple-darwin13.0.0

julia> _zlib=dlopen("/usr/lib/libz.1.dylib")
Ptr{Void} @0x00007fc445730060

julia> bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))
ERROR: type: anonymous: in ccall: first argument not a pointer or valid constant expression, expected DataType, got Type{(Any...,)}
 in anonymous at no file

julia> _zlib=dlopen("libz.1.dylib")
ERROR: could not load module libz.1.dylib: dlopen(libz.1.dylib.dylib, 1): image not found
 in dlopen at c.jl:19

julia> _zlib=dlopen("libz.1")
ERROR: could not load module libz.1: dlopen(libz.1.dylib, 1): image not found
 in dlopen at c.jl:19

@kmsquire
Copy link
Contributor

Okay, I forgot that _zlib needed to be const. Can you verify that

const _zlib=dlopen("/usr/lib/libz.1.dylib")
bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))

returns the zlib version number?

@kmsquire
Copy link
Contributor

No, ignore that. What I meant is

const _zlib="/usr/lib/libz.1.dylib"
bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))

@kmsquire
Copy link
Contributor

I've posted a message on julia-dev asking for some help:

https://groups.google.com/forum/#!topic/julia-dev/_VjU63VTTSo

@tfar
Copy link
Author

tfar commented Nov 29, 2013

Your last version outputs the version number.

julia> const _zlib="/usr/lib/libz.1.dylib"
"/usr/lib/libz.1.dylib"

julia> bytestring(ccall((:zlibVersion, _zlib), Ptr{Uint8}, ()))
"1.2.5"

@staticfloat
Copy link
Contributor

@tfar Where is your julia binary coming from? Is it a nightly build from us? Are you compiling it yourself? Are you compiling through Homebrew? What arguments are you passing to make in order to build Julia?

@tfar
Copy link
Author

tfar commented Dec 1, 2013

@staticfloat it's from homebrew.

@staticfloat
Copy link
Contributor

Please try brew update and reinstall Julia; I think I may have just pushed a fix today for this. Specifically, OSX Mavericks changed what standard C library it uses, which wreaks havoc when you have shared libraries built against different stdlib implementations than what your hosting executable uses. It's this line that will hopefully fix this for you.

@tfar
Copy link
Author

tfar commented Dec 1, 2013

Ok. Did the update and reinstalled it with brew install --HEAD --64bit julia. However I still get the error, and it appears julia is already linked to libz:

tobias@ruediger ~> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+273 (2013-12-01 06:20 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 5121cab* (0 days old master)
|__/                   |  x86_64-apple-darwin13.0.0

julia> using GZip
ERROR: error compiling anonymous: could not load module libz: dlopen(libz.dylib, 1): image not found
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:43
while loading /Users/tobias/.julia/GZip/src/zlib_h.jl, in expression starting on line 8
while loading /Users/tobias/.julia/GZip/src/GZip.jl, in expression starting on line 74

julia> 
tobias@ruediger ~> otool -L /usr/local/bin/julia
/usr/local/bin/julia:
    /usr/local/opt/readline/lib/libreadline.6.2.dylib (compatibility version 6.0.0, current version 6.2.0)
    /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
    @rpath/libjulia.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.11.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 59.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
tobias@ruediger ~> otool -L /usr/lib/libz.dylib
/usr/lib/libz.dylib:
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

@kmsquire
Copy link
Contributor

kmsquire commented Dec 1, 2013

@staticfloat, could llvm also be linking against libz, and could this be an issue? I think I saw something about that on a recent thread, though I don't remember the details.

@tfar, assuming you just want to get work done, a simple workaround is to edit zlib_h.jl and set _zlib = "/usr/lib/libz.1.dylib". I'll put out a similar workaround this afternoon (California time).

@staticfloat
Copy link
Contributor

@tfar your otool output is identical to mine, so that's not the difference between our two setups. The only other thing I can think of is that julia is finding some other libz when you do dlopen("libz"). The way to test this out (I dearly wish we could do this from julia code) is to do the following:

In terminal 1, start up julia:

$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+273 (2013-12-01 06:20 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 5121cab* (0 days old master)
|__/                   |  x86_64-apple-darwin13.0.1

In terminal 2, after julia is started up, start intercepting julia's syscalls:

$ dtruss -t stat64 -p `pgrep julia`
SYSCALL(args)            = return

In terminal 1 again, tell julia to dlopen libz:

julia> dlopen("libz")
Ptr{Void} @0x00007fac433a9770

In terminal 2 again, take a look at the output to see exactly what files julia is trying to open:

stat64("/usr/local/bin/../lib/julia/libz\0", 0x7FFF59E41748, 0x7FFF59E42630)    = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF59E416E8, 0x7FFF59E42630)           = -1 Err#2
stat64("@executable_path/../lib/julia/libz\0", 0x7FFF59E41788, 0x7FFF59E42630)  = -1 Err#2
stat64("/usr/local/bin/../lib/julia/libz.dylib\0", 0x7FFF59E41748, 0x7FFF59E42630)               = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF59E416E8, 0x7FFF59E42630)             = -1 Err#2
stat64("@executable_path/../lib/julia/libz.dylib\0", 0x7FFF59E41788, 0x7FFF59E42630)             = -1 Err#2
stat64("/usr/local/bin/../lib/libz\0", 0x7FFF59E41758, 0x7FFF59E42630)          = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF59E41708, 0x7FFF59E42630)                 = -1 Err#2
stat64("@executable_path/../lib/libz\0", 0x7FFF59E41788, 0x7FFF59E42630)        = -1 Err#2
stat64("/usr/local/bin/../lib/libz.dylib\0", 0x7FFF59E41748, 0x7FFF59E42630)    = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF59E416E8, 0x7FFF59E42630)           = -1 Err#2
stat64("@executable_path/../lib/libz.dylib\0", 0x7FFF59E41788, 0x7FFF59E42630)  = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF59E41758, 0x7FFF59E42630)                 = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF59E41748, 0x7FFF59E42630)           = -1 Err#2
stat64("/usr/local/opt/arpack-julia/lib/libz\0", 0x7FFF59E41758, 0x7FFF59E42630) = -1 Err#2
stat64("/usr/local/opt/suite-sparse-julia/lib/libz\0", 0x7FFF59E41758, 0x7FFF59E42630)           = -1 Err#2
stat64("/usr/local/opt/openblas-julia/lib/libz\0", 0x7FFF59E41758, 0x7FFF59E42630)               = -1 Err#2
stat64("/usr/local/lib/libz\0", 0x7FFF59E41768, 0x7FFF59E42630)          = -1 Err#2
stat64("libz\0", 0x7FFF59E41788, 0x7FFF59E42630)                 = -1 Err#2
stat64("/Users/sabae/lib/libz\0", 0x7FFF59E41F78, 0x7FFF59E42630)               = -1 Err#2
stat64("/usr/local/lib/libz\0", 0x7FFF59E41F78, 0x7FFF59E42630)          = -1 Err#2
stat64("/usr/lib/libz\0", 0x7FFF59E41F78, 0x7FFF59E42630)                = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF59E41748, 0x7FFF59E42630)           = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF59E41748, 0x7FFF59E42630)             = -1 Err#2
stat64("/usr/local/opt/arpack-julia/lib/libz.dylib\0", 0x7FFF59E41758, 0x7FFF59E42630)           = -1 Err#2
stat64("/usr/local/opt/suite-sparse-julia/lib/libz.dylib\0", 0x7FFF59E41748, 0x7FFF59E42630)             = -1 Err#2
stat64("/usr/local/opt/openblas-julia/lib/libz.dylib\0", 0x7FFF59E41758, 0x7FFF59E42630)                 = -1 Err#2
stat64("/usr/local/lib/libz.dylib\0", 0x7FFF59E41768, 0x7FFF59E42630)           = -1 Err#2
stat64("libz.dylib\0", 0x7FFF59E41788, 0x7FFF59E42630)           = -1 Err#2
stat64("/Users/sabae/lib/libz.dylib\0", 0x7FFF59E41F68, 0x7FFF59E42630)         = -1 Err#2
stat64("/usr/local/lib/libz.dylib\0", 0x7FFF59E41F78, 0x7FFF59E42630)           = -1 Err#2
stat64("/usr/lib/libz.dylib\0", 0x7FFF59E41F78, 0x7FFF59E42630)          = 0 0

As you can see, in my case, julia looks around quite a bit before finally settling on /usr/lib/libz.dylib. Where does your julia end up?

@tfar
Copy link
Author

tfar commented Dec 1, 2013

@staticfloat this is what i get:

SYSCALL(args)        = return
stat64("/usr/local/bin/../lib/julia/libz\0", 0x7FFF51306B48, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF51306AE8, 0x7FFF51307A30)       = -1 Err#2
stat64("@executable_path/../lib/julia/libz\0", 0x7FFF51306B88, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/bin/../lib/julia/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF51306AE8, 0x7FFF51307A30)         = -1 Err#2
stat64("@executable_path/../lib/julia/libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/bin/../lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF51306B08, 0x7FFF51307A30)         = -1 Err#2
stat64("@executable_path/../lib/libz\0", 0x7FFF51306B88, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/bin/../lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF51306AE8, 0x7FFF51307A30)       = -1 Err#2
stat64("@executable_path/../lib/libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF51306B48, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/opt/arpack64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/opt/suite-sparse64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/opt/openblas64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/lib/libz\0", 0x7FFF51306B68, 0x7FFF51307A30)      = -1 Err#2
stat64("libz\0", 0x7FFF51306B88, 0x7FFF51307A30)         = -1 Err#2
stat64("/Users/tobias/llvm/lib/clang/3.4/lib/darwin/libz\0", 0x7FFF51307358, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/opt/arpack64-julia/lib/libz.dylib\0", 0x7FFF51306B58, 0x7FFF51307A30)         = -1 Err#2
stat64("/usr/local/opt/suite-sparse64-julia/lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/opt/openblas64-julia/lib/libz.dylib\0", 0x7FFF51306B58, 0x7FFF51307A30)       = -1 Err#2
stat64("/usr/local/lib/libz.dylib\0", 0x7FFF51306B68, 0x7FFF51307A30)        = -1 Err#2
stat64("libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30)       = -1 Err#2
stat64("/Users/tobias/llvm/lib/clang/3.4/lib/darwin/libz.dylib\0", 0x7FFF51307358, 0x7FFF51307A30)       = -1 Err#2

The last one appears to be fallback path I've set up, so it digs up LLVM runtime needed for some debugging tools.

DYLD_FALLBACK_LIBRARY_PATH=/Users/tobias/llvm/lib/clang/3.4/lib/darwin

If I unset this variable it finds /usr/lib/libz.dylib. Same goes for when i add :/usr/lib to the fallback path. So it seems some internal default, being /usr/lib, gets overwritten by setting the environment variable.

Sorry for the inconvenience, and probably false bug report.

@staticfloat
Copy link
Contributor

That's really strange. I'm not sure why that would get rid of the defaults.
But I'm glad we've found the root cause!
On Dec 1, 2013 1:22 PM, "T Markmann" [email protected] wrote:

@staticfloat https://github.com/staticfloat this is what i get:

SYSCALL(args) = return
stat64("/usr/local/bin/../lib/julia/libz\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF51306AE8, 0x7FFF51307A30) = -1 Err#2
stat64("@executable_path/../lib/julia/libz\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/bin/../lib/julia/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF51306AE8, 0x7FFF51307A30) = -1 Err#2
stat64("@executable_path/../lib/julia/libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/bin/../lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF51306B08, 0x7FFF51307A30) = -1 Err#2
stat64("@executable_path/../lib/libz\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/bin/../lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF51306AE8, 0x7FFF51307A30) = -1 Err#2
stat64("@executable_path/../lib/libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/arpack64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/suite-sparse64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/openblas64-julia/lib/libz\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/lib/libz\0", 0x7FFF51306B68, 0x7FFF51307A30) = -1 Err#2
stat64("libz\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/Users/tobias/llvm/lib/clang/3.4/lib/darwin/libz\0", 0x7FFF51307358, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/Cellar/julia/HEAD/bin/../lib/julia/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/arpack64-julia/lib/libz.dylib\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/suite-sparse64-julia/lib/libz.dylib\0", 0x7FFF51306B48, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/opt/openblas64-julia/lib/libz.dylib\0", 0x7FFF51306B58, 0x7FFF51307A30) = -1 Err#2
stat64("/usr/local/lib/libz.dylib\0", 0x7FFF51306B68, 0x7FFF51307A30) = -1 Err#2
stat64("libz.dylib\0", 0x7FFF51306B88, 0x7FFF51307A30) = -1 Err#2
stat64("/Users/tobias/llvm/lib/clang/3.4/lib/darwin/libz.dylib\0", 0x7FFF51307358, 0x7FFF51307A30) = -1 Err#2

The last one appears to be fallback path I've set up, so it digs up LLVM
runtime needed for some debugging tools.

DYLD_FALLBACK_LIBRARY_PATH=/Users/tobias/llvm/lib/clang/3.4/lib/darwin

If I unset this variable it finds /usr/lib/libz.dylib. Same goes for when
i add :/usr/lib to the fallback path. So it seems some internal default,
being /usr/lib, gets overwritten by setting the environment variable.

Sorry for the inconvenience, and probably false bug report.


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-29583507
.

@kmsquire
Copy link
Contributor

kmsquire commented Dec 2, 2013

Some googling yielded http://stackoverflow.com/questions/3146274/is-it-ok-to-use-dyld-library-path-on-mac-os-x-and-whats-the-dynamic-library-s. The second comment under the accepted answer points to the Mac dlopen man page:

When path does not contain a slash character (i.e. it is just a leaf name), dlopen() searches the following until it finds a compatible Mach-O file: $LD_LIBRARY_PATH, $DYLD_LIBRARY_PATH, current working directory, $DYLD_FALLBACK_LIBRARY_PATH.
...
Note: If DYLD_FALLBACK_LIBRARY_PATH is not set, dlopen operates as if DYLD_FALLBACK_LIBRARY_PATH was set to $HOME/lib:/usr/local/lib:/usr/lib.

So it seems that when setting DYLD_FALLBACK_LIBRARY_PATH, you should include $HOME/lib:/usr/local/lib:/usr/lib, or these won't be searched.

Cheers! Closing...

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

No branches or pull requests

3 participants