JuliaOpt / CoinOptServices.jl

Julia interface to COIN-OR Optimization Services https://projects.coin-or.org/OS
Other
16 stars 4 forks source link

Pkg.add(CoinOptServices) fails: Xubuntu 12.04 #21

Open samiit opened 8 years ago

samiit commented 8 years ago

I tried to do

> Pkg.add("CoinOptServices")

and I get errors saying the build is not done. /usr/local/lib/libipopt.so: undefined reference todlopen' /usr/local/lib/libipopt.so: undefined reference to dlclose' /usr/local/lib/libipopt.so: undefined reference todlerror' /usr/local/lib/libipopt.so: undefined reference to dlsym' collect2: error: ld returned 1 exit status make[2]: *** [bonmin] Error 1 make[2]: Leaving directory/home/sam/.julia/v0.4/CoinOptServices/deps/src/OS-2.9.2/build/Bonmin/src/Apps' make[1]: * [all-recursive] Error 1 make[1]: Leaving directory `/home/sam/.julia/v0.4/CoinOptServices/deps/src/OS-2.9.2/build/Bonmin' make: * [all-recursive] Error 1 `

I think it is because of a pre-installed Ipopt.

From this link, I found that I should configure with LDFLAGS="-Wl,--no-as-needed" or with --enable-dependency-linking I checked the build.jl file in the folder ~/.julia/v0.4/CoinOptServices/deps/. I'm not sure if I understand correctly, but I found the --enable-dependency-linking already there in the setenv().

Any help?

Sam

tkelman commented 8 years ago

You're trying to use the system packages for ipopt which were certainly nonfunctional in 2012. Can you uninstall them? Otherwise I'll need to come up with a validation function that your library would not pass.

staticfloat commented 7 years ago

EDIT

My brain was fuzzled, ignore everything in this post, it assumes you're using Homebrew.jl on OSX.

You could attempt to force Homebrew.jl to override your system-wide ipopt installation by manually running the following:

using Homebrew
Homebrew.add("staticfloat/juliadeps/ipopt")
Pkg.build("CoinOptServices")

Then check the deps.jl file created by CointOptServices (Note that you type ; on an empty julia> command line to write shell commands with interpolation julia expressions):

shell> cat $(joinpath(Pkg.dir("Ipopt"),"deps","deps.jl"))
# This is an auto-generated file; do not edit

# Pre-hooks

# Macro to load a library
macro checked_lib(libname, path)
    ((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to load \n\n$libname ($path)\n\nPlease re-run Pkg.build(package), and restart Julia.")
    quote const $(esc(libname)) = $path end
end

# Load dependencies
@checked_lib libipopt "/Users/sabae/.julia/v0.4/Homebrew/deps/usr/lib/libipopt.dylib"

# Load-hooks

If the libipopt path is not pointing at your Homebrew.jl installation directory (which is usually $HOME/.julia/v0.4/Homebrew), then Homebrew.jl didn't get precedence and this won't work. You can try removing/renaming the /usr/local/lib/libipopt.dylib file as @tkelman suggested. If you need that file for something else, removing it, then re-running Pkg.build("Ipopt") should be enough; Julia will latch onto the Homebrew.jl-provided libipopt.dylib, and then you can put the old file back.

It would be nice to have a validation function that can do all this automatically though. It's hard to see from your report what exactly is failing, I'm not sure why we're trying to resolve dlopen() from within libipopt.

On a side note, where did that /usr/local/lib/libipopt.so file come from? It surprises me that it's called libipopt.so and not libipopt.dylib.

tkelman commented 7 years ago

@staticfloat this issue was xubuntu, not mac?

tkelman commented 7 years ago

libipopt uses dlopen if it's built with the linear solver loader functionality. I have no idea how debbuntu were building ipopt in 2012 but I do know their builds didn't actually work until several years later, so I'd be surprised if anything else needed the system wide ipopt install. Uninstalling it should be safe.