SebWouters / CheMPS2

CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
GNU General Public License v2.0
70 stars 34 forks source link

dyld: lazy symbol binding failed. Strange linking #74

Closed dithillobothrium closed 3 years ago

dithillobothrium commented 4 years ago

I compiled the library on MacOS. But when I run tests I've got the message

... some initial program output

dyld: lazy symbol binding failed: Symbol not found: dgeqrf Referenced from: /Users/someuser/Projects/DMRG/chemps2/build/CheMPS2/libchemps2.3.dylib Expected in: flat namespace

Another strange thing is that during linking I get the message

ld: warning: directory not found for option '-L/...here all the libraries paths, that are in my ${DYLD_LIBRARY_PATH}'

SebWouters commented 4 years ago

Do you have BLAS and LAPACK installed?

Can you please provide full (verbose)

  1. build (make VERBOSE=1);
  2. link (https://discussions.apple.com/thread/309193); and
  3. program output?

I'm on ubuntu, so I have little experience with mac unfortunately, but let's see where we get.

dithillobothrium commented 4 years ago

I have MKL installed and the libraries are in DYLD_LIBRARY_PATH.

I compile as in readme

export C=/usr/local/bin/gcc-8 export CXX=/usr/local/bin/g++-8 cmake .. -DMKL=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_MPI=OFF make make install

build output is long, Compiling looks like for one of the files

[ 27%] Building CXX object CheMPS2/CMakeFiles/chemps2-base.dir/EdmistonRuedenberg.cpp.o cd /Users/someuser/Projects/DMRG/chemps2/build/CheMPS2 && /usr/local/bin/g++-8 -DCHEMPS2_MKL -DCHEMPS2_VERSION="\"1.8.9-1 (2018-12-01)\"" -I/Users/someuser/Projects/DMRG/chemps2/CheMPS2/include/chemps2 -I/Users/someuser/opt/anaconda3/include -flto -fopenmp -march=native -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fPIC -o CMakeFiles/chemps2-base.dir/EdmistonRuedenberg.cpp.o -c /Users/someuser/Projects/DMRG/chemps2/CheMPS2/EdmistonRuedenberg.cpp

linking for test14 is

cd /Users/someuser/Projects/DMRG/chemps2/build/tests && /usr/local/Cellar/cmake/3.11.0/bin/cmake -E cmake_link_script CMakeFiles/test14.dir/link.txt --verbose=1 /usr/local/bin/g++-8 -flto -fopenmp -march=native -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/test14.dir/tests/test14.cpp.o -o test14 -L/{... all the libraries of DYLD_LIBRARY_PATH separated by ":" ... } ld: warning: directory not found for option -L/{... all the libraries of DYLD_LIBRARY_PATH separated by ":" ... }

The warning is because it substitutes just DYLD_LIBRARY_PATH after -L , but why it does it?

the output of test1 is

./test1

CheMPS2::Hamiltonian : Reading FCIDUMP file /Users/someuser/Projects/DMRG/chemps2/tests/matrixelements/N2.STO3G.FCIDUMP CheMPS2::Hamiltonian : Finished reading FCIDUMP file /Users/someuser/Projects/DMRG/chemps2/tests/matrixelements/N2.STO3G.FCIDUMP The group was found to be d2h

CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry Copyright (C) 2013-2018 Sebastian Wouters

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

dyld: lazy symbol binding failed: Symbol not found: dgeqrf Referenced from: .../Projects/DMRG/chemps2/build/CheMPS2/libchemps2.3.dylib Expected in: flat namespace

dyld: Symbol not found: dgeqrf Referenced from: .../Projects/DMRG/chemps2/build/CheMPS2/libchemps2.3.dylib Expected in: flat namespace

Abort trap: 6

SebWouters commented 4 years ago

Does it detect lapack/blas on building?

On my machine,

cmake ..

yields (among other output):

-- A library with BLAS API found.
-- LAPACK detected.
-- Found TargetLAPACK: Found LAPACK: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libblas.so

And is the library linked against lapack/blas?

On my machine,

ldd libchemps2.so

yields (among other output):

liblapack.so.3 => /usr/lib/x86_64-linux-gnu/liblapack.so.3 (0x00007f35ac3ba000)
libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f35ac14d000)

According to https://discussions.apple.com/thread/309193 otool -L should be equivalent on mac.

I have no experience at all with mac, so I'm afraid all I can do is ask dr. google as well :-).

SebWouters commented 4 years ago

@dithillobothrium

Were you able to figure it out?

Best regards, Sebastian