MCMrARM / mcpelauncher-linux

Please note this is a legacy repository, please go to: https://github.com/minecraft-linux/mcpelauncher-manifest/wiki
GNU General Public License v3.0
311 stars 46 forks source link

cmake finds the wrong libraries x86_64 vs lib32 #76

Open guppy42 opened 7 years ago

guppy42 commented 7 years ago

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
  4. 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 commented 7 years ago

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 commented 7 years ago

I'm no CMAKE expert but perhaps

FIND_LIBRARY_USE_LIB32_PATHS

is what's needed ?

KennFatt commented 7 years ago

did you install this software with 32bit machine?

guppy42 commented 7 years ago

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

MCMrARM commented 7 years ago

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.

guppy42 commented 7 years ago

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