google-research / football

Check out the new game server:
https://research-football.dev
Apache License 2.0
3.28k stars 1.27k forks source link

[Solution] Fix the compiling error in Ubuntu 16.04 #333

Open tjuHaoXiaotian opened 1 year ago

tjuHaoXiaotian commented 1 year ago

If anyone is facing a similar problem as below:

      -- 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
      -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
      -- Found EGL: /usr/lib/x86_64-linux-gnu/libEGL.so
      -- Found SDL2_image: /usr/lib/x86_64-linux-gnu/libSDL2_image.so
      -- Found SDL2_ttf: /usr/lib/x86_64-linux-gnu/libSDL2_ttf.so
      -- Found SDL2_gfx: /usr/lib/x86_64-linux-gnu/libSDL2_gfx.so (found version "1.0.1")
      -- Found PythonLibs: /usr/local/lib/libpython3.6m.so (found suitable version "3.5.2", minimum required is "3")
      Using Python: 3.5 ================================================================= /usr/include/python3.5m, /usr/lib/x86_64-linux-gnu/libpython3.5m.so
      Using Python: 3.5
      -- Boost version: 1.65.1
      -- Found the following Boost libraries:
      --   python35
      Using Boost.Python: python35
      -- 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
      -- Boost version: 1.65.1
      -- Found the following Boost libraries:
      --   thread
      --   system
      --   filesystem
      --   python35
      --   chrono
      --   date_time
      --   atomic
      -- Configuring done
      CMake Error at CMakeLists.txt:183 (add_library):
        Target "game" links to item "-L/usr/lib/x86_64-linux-gnu -lSDL2 " which has
        leading or trailing whitespace.  This is now an error according to policy
        CMP0004.

      -- Generating done
      -- Build files have been written to: /home/hxt/rl_dir/env/football/third_party/gfootball_engine
      gfootball/build_game_engine.sh: line 30: pushd: third_party/gfootball_engine: No such file or directory
      error: Google Research Football compilation failed
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Can't roll back gfootball; was not uninstalled
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> gfootball

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

print the LIBRARIES variable of third_party/gfootball_engine/CMakeLists.txt and modify the incorrect path in LIBRARIES could fix this issue.


As an example, in my unbuntu 16.04 server:

(1) before this line: target_link_libraries(${OUTPUT_LIB_NAME} ${LIBRARIES})

I print the value of LIBRARIES and get: gamelib;menulib;datalib;blunted2;Boost::filesystem;Boost::system;Boost::thread;Boost::python35;/usr/lib/x86_64-linux-gnu/libpython3.5m.so;/usr/lib/x86_64-linux-gnu/libSDL2_image.so;/usr/lib/x86_64-linux-gnu/libSDL2_ttf.so;/usr/lib/x86_64-linux-gnu/libSDL2_gfx.so;-L/usr/lib/x86_64-linux-gnu -lSDL2;/usr/lib/x86_64-linux-gnu/libEGL.so;/usr/lib/x86_64-linux-gnu/libOpenGL.so;/usr/lib/x86_64-linux-gnu/libOpenGL.so;/usr/lib/x86_64-linux-gnu/libGLX.so;/usr/lib/x86_64-linux-gnu/libGLU.so

(2) I see -L/usr/lib/x86_64-linux-gnu -lSDL2; is incorrect.

Then, I set the path to the corrected one:

set(LIBRARIES "gamelib;menulib;datalib;blunted2;Boost::filesystem;Boost::system;Boost::thread;Boost::python35;/usr/lib/x86_64-linux-gnu/libpython3.5m.so;/usr/lib/x86_64-linux-gnu/libSDL2_image.so;/usr/lib/x86_64-linux-gnu/libSDL2_ttf.so;/usr/lib/x86_64-linux-gnu/libSDL2_gfx.so;-lSDL2;/usr/lib/x86_64-linux-gnu/libEGL.so.1;/usr/lib/x86_64-linux-gnu/libOpenGL.so;/usr/lib/x86_64-linux-gnu/libOpenGL.so;/usr/lib/x86_64-linux-gnu/libGLX.so;/usr/lib/x86_64-linux-gnu/libGLU.so")

After modifying the path, I successfully install the gfootball.

glx15534565855 commented 1 year ago

Hi, I have the same problem as you, but I don't know CMake very well, can you please give some more detailed instructions? About how to print variables and where to modify the path?Thank you very much