mcpelauncher-linux icon indicating copy to clipboard operation
mcpelauncher-linux copied to clipboard

cmake finds the wrong libraries x86_64 vs lib32

Open guppy42 opened this issue 8 years ago • 6 comments

Problem:

cmake finds the x86_64 libraries rather then the lib32 ones, cmake will finish but make fails with missing "-lEGL"

Steps to reproduce:

  1. git clone https://github.com/MCMrARM/mcpelauncher-linux.git
  2. cd mcpelauncher-linux
  3. cmake . (output)
guppy@guppybox:~/MinecraftPE/mcpelauncher-linux$ cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'egl'
--   Found egl, version 11.2.0
-- Found EGL: /usr/include  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/guppy/MinecraftPE/mcpelauncher-linux
  1. make (output)
[...]
/usr/bin/ld: cannot find -lEGL
collect2: error: ld returned 1 exit status

Further digging shows;

guppy@guppybox:~/MinecraftPE/mcpelauncher-linux$ grep EGL_LIBRARIES CMakeCache.txt 
EGL_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/libEGL.so
//ADVANCED property for variable: EGL_LIBRARIES
EGL_LIBRARIES-ADVANCED:INTERNAL=1
PC_EGL_LIBRARIES:INTERNAL=EGL

guppy@guppybox:~/MinecraftPE/mcpelauncher-linux$ ls -l /usr/lib32/nvidia-367/libEGL.so
lrwxrwxrwx 1 root root 11 Oct 25 19:57 /usr/lib32/nvidia-367/libEGL.so -> libEGL.so.1

guppy42 avatar Nov 24 '16 20:11 guppy42

manually editing CMakeFiles/mcpelauncher.dir/link.txt and adding -L/usr/lib32/nvidia-367/ just before -lEGL makes the make finish

But it's not really a robust solution ;)

guppy42 avatar Nov 24 '16 20:11 guppy42

I'm no CMAKE expert but perhaps

FIND_LIBRARY_USE_LIB32_PATHS

is what's needed ?

guppy42 avatar Nov 28 '16 14:11 guppy42

did you install this software with 32bit machine?

KennFatt avatar Nov 29 '16 08:11 KennFatt

No it's being compiled on a 64bit machine, problem is that the application needs 32bit libraries ( aparently android is 32bit only? ) and the CMAKE find_library() macros are looking in the wrong places.

I've been unable to coax cmake into finding the correct ones, so I have to resort to manually editing the linking instructions

guppy42 avatar Nov 29 '16 10:11 guppy42

Myself to fix this I have added a symlink from /usr/lib32/nvidia-version/libEGL.so to /usr/lib/i386-linux-gnu/ and that worked. If anyone has a better solution, please post it here.

MCMrARM avatar Dec 06 '16 17:12 MCMrARM

I feel that this information needs to be on the front page between required packages and compiling;

If your using a nividia card you will have to create two symbolic links like so: sudo ln -s /usr/lib32/nvidia-###/libEGL.so /usr/lib/i386-linux-gnu/ sudo ln -s /usr/lib32/nvidia-###/libGLESv2.so /usr/lib/i386-linux-gnu/

Where ### is your driver version

guppy42 avatar Apr 19 '17 22:04 guppy42