Closed atopheim closed 8 months ago
it looks like gklib isn't being linked. Make sure there is a gklib shared object in your usr/local/lib after you build it
I specified /usr/local on both installs, but it didn't work.
I ended up installing using yay instead and it worked.
it looks like gklib isn't being linked. Make sure there is a gklib shared object in your usr/local/lib after you build it
The way to do this when building GKlib is:
make config CONFIG_FLAGS='-D BUILD_SHARED_LIBS=ON'
make
make install
In my specific case I need a bunch more flags. I found other people needing the same, so here they are:
make config CONFIG_FLAGS='-D CMAKE_C_FLAGS="-D_POSIX_C_SOURCE=200809L" -D CMAKE_INSTALL_PREFIX='$HOME'/.local -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON'
Then METIS can be installed with:
LDFLAGS="-Wl,-rpath -Wl,$HOME/.local/lib -L${HOME}/.local/lib" make config shared=1 prefix=$HOME/.local gklib_path=$HOME/.local
make
make install
The fix in #77 is much nicer (and complete) than some of the dark magic used on those flags.
Just some notes:
sudo apt-get update
sudo apt-get install build-essential git cmake vim
git clone https://github.com/KarypisLab/GKlib.git
cd GKlib
make config prefix="~/local" CONFIG_FLAGS='-D CMAKE_INSTALL_PREFIX='$HOME'/local -D BUILD_SHARED_LIBS=ON'
make install
# cd ..
git clone https://github.com/KarypisLab/METIS.git
cd METIS
make config shared=1 prefix=~/local
make install
mkdir demo
cd demo
mkdir src
vim src/main.cpp
# ...
vim Makefile
# ...
A demo cpp main file to test with: https://gist.github.com/erikzenker/c4dc42c8d5a8c1cd3e5a
Makefile:
run: build
LD_LIBRARY_PATH=~/local/lib ./build/main
build: clean
mkdir -p build
g++ src/*.cpp -std=c++11 -I ~/local/include -L ~/local/lib -lmetis -lGKlib -W -Wall -O3 -o ./build/main
clean:
rm ./build/main || true
I have built GKLib version make config prefix=/usr/local/ sudo make install
Then I build METIS make config shared=1 cc=gcc prefix=/usr/local sudo make install
when I try to build colmap I get: [97%] Linking CXX executable colmap /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_randint32' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_mcorePop' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_rmpath' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_free' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_mcoreCreate' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_CPUSeconds' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_jbufs' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_siguntrap' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_idxsmalloc' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_cur_jbufs' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_errexit' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_malloc_init' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_mcoreDestroy' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_randinit' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_realloc' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_log2' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_mcorePush' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_malloc_cleanup' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference togk_mcoreMalloc' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to
gk_sigtrap' /usr/bin/ld: /usr/local/lib/libmetis.so: undefined reference to `gk_malloc' collect2: error: ld returned 1 exit status make[2]: [src/colmap/exe/CMakeFiles/colmap_main.dir/build.make:278: src/colmap/exe/colmap] Error 1 make[1]: [CMakeFiles/Makefile2:668: src/colmap/exe/CMakeFiles/colmap_main.dir/all] Error 2 make: *** [Makefile:136: all] Error 2nm -D /usr/local/lib/libmetis.so | grep gk_ U gk_CPUSeconds U gk_cur_jbufs U gk_errexit U gk_free U gk_idxsmalloc U gk_jbufs U gk_log2 U gk_malloc U gk_malloc_cleanup U gk_malloc_init U gk_mcoreCreate U gk_mcoreDestroy U gk_mcoreMalloc U gk_mcorePop U gk_mcorePush U gk_randinit U gk_randint32 U gk_realloc U gk_rmpath U gk_sigtrap U gk_siguntrap