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

Error initializing module LinAlg on Ubuntu 15.04 #11913

Closed
xiaoweiz opened this issue Jun 28, 2015 · 19 comments
Closed

Error initializing module LinAlg on Ubuntu 15.04 #11913

xiaoweiz opened this issue Jun 28, 2015 · 19 comments

Comments

@xiaoweiz
Copy link

I upgraded Ubuntu from 14.04 to 15.04 today. Julia was runinng fine before but after the upgrading, I got the warning when staring Julia.

Warning: error initializing module LinAlg:
ErrorException("error compiling __init__: error compiling check_blas: error compiling openblas_get_config: could not load module libblas.so.3: /usr/lib/libblas.so.3: undefined symbol: gotoblas")

Any idea what's going on? Reinstallation doesn't solve the problem

@nalimilan
Copy link
Member

Is that with the PPA package, or a build from source? Looks like it's using the reference BLAS, yet expecting it corresponds to OpenBLAS.

@xiaoweiz
Copy link
Author

@nalimilan
Copy link
Member

CC: @staticfloat

@staticfloat
Copy link
Sponsor Member

What does this show for you:

$ dpkg -l | grep -i blas
ii  libcublas5.5:amd64                                    5.5.22-3ubuntu1                                     amd64        NVIDIA CUDA BLAS runtime library
ii  liblastfm1:amd64                                      1.0.8-2                                             amd64        Last.fm web services library
ii  libopenblas-base                                      0.2.10.1-trusty2                                    amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
ii  libopenblas-dev                                       0.2.10.1-trusty2                                    amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2

@xiaoweiz
Copy link
Author

ii  libblas-common                                        1.2.20110419-10                            amd64        Dependency package for all BLAS implementations
ii  libblas-dev                                           1.2.20110419-10                            amd64        Basic Linear Algebra Subroutines 3, static library
ii  libblas3                                              1.2.20110419-10                            amd64        Basic Linear Algebra Reference implementations, shared library
ii  libopenblas-base                                      0.2.12-1ubuntu1                            amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2

@staticfloat
Copy link
Sponsor Member

Alright, I've got a 15.04 VM up and running right now. What does the following say for you:

$ update-alternatives --display libblas.so.3
libblas.so.3 - auto mode
  link currently points to /usr/lib/openblas-base/libblas.so.3
/usr/lib/libblas/libblas.so.3 - priority 10
  slave libblas.so.3gf: /usr/lib/libblas/libblas.so.3
/usr/lib/openblas-base/libblas.so.3 - priority 40
  slave libblas.so.3gf: /usr/lib/openblas-base/libblas.so.3
Current 'best' version is '/usr/lib/openblas-base/libblas.so.3'.

@xiaoweiz
Copy link
Author

libblas.so.3 - auto mode
  link currently points to /usr/lib/openblas-base/libblas.so.3
/usr/lib/libblas/libblas.so.3 - priority 10
  slave libblas.so.3gf: /usr/lib/libblas/libblas.so.3
/usr/lib/openblas-base/libblas.so.3 - priority 40
  slave libblas.so.3gf: /usr/lib/openblas-base/libblas.so.3
Current 'best' version is '/usr/lib/openblas-base/libblas.so.3'.

@staticfloat
Copy link
Sponsor Member

And in julia, what does this say:

julia> filter( x -> contains(x, "blas"), Sys.dllist())
2-element Array{String,1}:
 "/usr/lib/libblas.so.3"    
 "/usr/lib/libopenblas.so.0"

Potentially followed by this:

julia> for file in filter( x -> contains(x, "blas"), Sys.dllist())
           println(realpath(file))
       end
/usr/lib/openblas-base/libblas.so.3
/usr/lib/libopenblasp-r0.2.12.so

@xiaoweiz
Copy link
Author

julia> filter( x -> contains(x, "blas"), Sys.dllist())
0-element Array{String,1}

julia> for file in filter( x -> contains(x, "blas"), Sys.dllist())
                 println(realpath(file))
             end

julia> 

Note the second produces nothing. BTW, the installed Julia is 0.3.8 by default.

@staticfloat
Copy link
Sponsor Member

I.....uhh..... huh. That's interesting. :) I'm assuming this is Julia version 0.3.8? (0.3.10 is building for 15.04 as we speak, but that shouldn't affect anything in this issue)

What happens if you do:

julia> dlopen("/usr/lib/openblas-base/libblas.so.3")
Ptr{Void} @0x00000000077697b0

@xiaoweiz
Copy link
Author

julia> dlopen("/usr/lib/openblas-base/libblas.so.3")
ERROR: could not load module /usr/lib/openblas-base/libblas.so.3: /usr/lib/openblas-base/libblas.so.3: undefined symbol: gotoblas
 in dlopen at c.jl:19

@staticfloat
Copy link
Sponsor Member

Good! Okay, so on my machine, look at what happens; I ask "what does /usr/lib/openblas-base/libblas.so.3 know about a symbol called gotoblas?":

$ readelf -Ws /usr/lib/openblas-base/libblas.so.3 | grep gotoblas
   246: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND gotoblas

The response says "this library wants to use a symbol called gotoblas, but it's undefined which means the symbol doesn't actually exist inside of this library. Hence, it must exist inside of a library which is going to get loaded by this one. So let's ask dynamic libraries /usr/lib/openblas-base/libblas.so.3 is going to try and load:

$ ldd /usr/lib/openblas-base/libblas.so.3
        linux-vdso.so.1 =>  (0x00007ffe837b9000)
        libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007fb160e27000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb160b1f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb160754000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb160536000)
        libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007fb16020d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb162f18000)
        libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fb15ffce000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb15fdb8000)

I checked them all out, but the one we're interested in is /usr/lib/libopenblas.so.0; what does it know about gotoblas:

$ readelf -Ws /usr/lib/libopenblas.so.0 | grep gotoblas
   288: 0000000001e73140  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_PENRYN
   569: 0000000001e76c40  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_OPTERON_SSE3
   694: 00000000002e49a0   294 FUNC    GLOBAL DEFAULT   11 gotoblas_pthread
   869: 0000000001e7c4c0  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_BULLDOZER
  2221: 0000000001e79880  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_ATOM
  2675: 0000000001e85280  3768 OBJECT  GLOBAL DEFAULT   24 gotoblas_ATHLON
  4561: 00000000002e5640    15 FUNC    GLOBAL DEFAULT   11 gotoblas_dynamic_quit
  4783: 0000000001e75d80  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_OPTERON
  5063: 00000000002e5100  1336 FUNC    GLOBAL DEFAULT   11 gotoblas_dynamic_init
  5344: 0000000001e88d80  3768 OBJECT  GLOBAL DEFAULT   24 gotoblas_COPPERMINE
  5345: 00000000002e4eb0   584 FUNC    GLOBAL DEFAULT   11 gotoblas_corename
  5375: 0000000001e80150     8 OBJECT  GLOBAL DEFAULT   24 gotoblas
  5931: 0000000001e74000  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_DUNNINGTON
  6112: 0000000001e87000  3768 OBJECT  GLOBAL DEFAULT   24 gotoblas_BANIAS
  6173: 0000000001e7a740  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_NANO
  6470: 0000000001e86140  3768 OBJECT  GLOBAL DEFAULT   24 gotoblas_NORTHWOOD
  6691: 0000000001e77b00  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_BARCELONA
  6872: 0000000001e713c0  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_PRESCOTT
  6934: 0000000001e72280  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_CORE2
  7988: 0000000001e87ec0  3768 OBJECT  GLOBAL DEFAULT   24 gotoblas_KATMAI
  8021: 0000000001e7b600  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_SANDYBRIDGE
  8107: 0000000001e789c0  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_BOBCAT
  8551: 00000000000b8000    33 FUNC    GLOBAL DEFAULT   11 gotoblas_quit
  8748: 0000000001e7d380  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_PILEDRIVER
  9015: 00000000000b8030    74 FUNC    GLOBAL DEFAULT   11 gotoblas_init
  9850: 0000000001e74ec0  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_NEHALEM
  9914: 0000000001e7e240  3768 OBJECT  GLOBAL DEFAULT   23 gotoblas_HASWELL

It's got quite a few things that match our grep pattern, but the critical line above is the one with just gotoblas, showing that it is defined and ready to be loaded. So on my machine, when Julia tries to load /usr/lib/openblas-base/libblas.so.3, it will then also load /usr/lib/libopenblas.so.0, which will define gotoblas and make everything happy. Can you go through the same process and see where the chain of dependency breaks down?

@xiaoweiz
Copy link
Author

OK. First,

$ readelf -Ws /usr/lib/openblas-base/libblas.so.3 | grep gotoblas
246: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND gotoblas

Then,

$  ldd /usr/lib/openblas-base/libblas.so.3 
linux-vdso.so.1 =>  (0x00007fff34dfa000)
    libopenblas.so.0 => /usr/local/lib/libopenblas.so.0 (0x00007f5597c7b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5597973000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f55975a9000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f559738b000)
    libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f5597062000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5598d86000)
    libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f5596e24000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5596c0e000)

and finally

$ readelf -Ws /usr/local/lib/libopenblas.so.0 | grep gotoblas   
 988: 000000000027a7c0   256 FUNC    GLOBAL DEFAULT   11 gotoblas_pthread
  2466: 000000000007a000    26 FUNC    GLOBAL DEFAULT   11 gotoblas_quit
  2486: 000000000007a020    71 FUNC    GLOBAL DEFAULT   11 gotoblas_init
    46: 0000000000d9d730     4 OBJECT  LOCAL  DEFAULT   24 gotoblas_initialized
  9577: 000000000027a7c0   256 FUNC    GLOBAL DEFAULT   11 gotoblas_pthread
 10496: 000000000007a020    71 FUNC    GLOBAL DEFAULT   11 gotoblas_init
 12863: 000000000007a000    26 FUNC    GLOBAL DEFAULT   11 gotoblas_quit

The last step breaks down.

@staticfloat
Copy link
Sponsor Member

Interesting! You've got libopenblas.so.0 in a different place than I do. Mine is in /usr/lib, but yours is in /usr/local/lib. Did you install openblas manually somehow in the past? Can you check to see if there is a libopenblas.so.0 sitting inside /usr/lib/?

@xiaoweiz
Copy link
Author

Yes. I do have /usr/lib/libopenblas.so.0.

You reminded me. I installed OpenBLAS manually before but it didn't cause the problem until I upgraded Ubuntu to 15.04. Now that I've deleted the one in /usr/local, the problem is solved!

@staticfloat
Copy link
Sponsor Member

Great! Yes, likely when you upgraded packages once you got onto 15.04 these problems surfaced. Glad you got it working. :)

@xiaoweiz
Copy link
Author

Thanks a lot! Looking forward to 0.3.10 built in the PPA channel.

@colinfang
Copy link
Contributor

Thank you both, this thread is very educational and helpful.

@adonese
Copy link

adonese commented Mar 6, 2017

That helps me a lot! Thanks @staticfloat a lot.

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

5 participants