deltaphc / raylib-rs

Rust bindings for raylib
Other
794 stars 140 forks source link

Fail to build on FreeBSD 14 current #154

Open wisonye opened 1 year ago

wisonye commented 1 year ago

Hi there, I'm trying to port my raylib project from MacOS to FreeBSD, but the compilation is fail:

   Compiling cc v1.0.79
   Compiling fs_extra v1.3.0
   Compiling libc v0.2.140
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling cmake v0.1.49
   Compiling raylib-sys v3.7.0
error: failed to run custom build command for `raylib-sys v3.7.0`

Caused by:
  process didn't exit successfully: `/usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-99c6dec6590bb7b2/build-script-build` (exit status: 101)
  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-freebsd = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_freebsd = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-freebsd = None
  CMAKE_GENERATOR_x86_64_unknown_freebsd = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-freebsd = None
  CMAKE_PREFIX_PATH_x86_64_unknown_freebsd = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-freebsd = None
  CMAKE_x86_64_unknown_freebsd = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out/raylib" "-DBUILD_EXAMPLES=OFF" "-DCMAKE_BUILD_TYPE=Release" "-DSUPPORT_BUSY_WAIT_LOOP=OFF" "-DPLATFORM=Desktop" "-DCMAKE_INSTALL_PREFIX=/usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc"
  -- The C compiler identification is Clang 14.0.5
  -- The CXX compiler identification is Clang 14.0.5
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Performing Test COMPILER_HAS_THOSE_TOGGLES
  -- Performing Test COMPILER_HAS_THOSE_TOGGLES - Success
  -- Testing if -Werror=pointer-arith can be used -- compiles
  -- Testing if -Werror=implicit-function-declaration can be used -- compiles
  -- Testing if -fno-strict-aliasing can be used -- compiles
  -- Using raylib's GLFW
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  -- 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
  -- Using X11 for window creation
  -- Found X11: /usr/local/include
  -- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so
  -- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/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
  -- Looking for IceConnectionNumber in ICE
  -- Looking for IceConnectionNumber in ICE - found
  -- Audio Backend: miniaudio
  -- Building raylib static library
  -- Generated build type: Release
  -- Compiling with the flags:
  --   PLATFORM=PLATFORM_DESKTOP
  --   GRAPHICS=GRAPHICS_API_OPENGL_33
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out/build
  running: cd "/usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out/build" && "cmake" "--build" "." "--target" "install" "--config" "Debug" "--parallel" "16"
  [  8%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/context.c.o
  [  8%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/init.c.o
  [ 12%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/input.c.o
  [ 16%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/monitor.c.o
  [ 24%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/vulkan.c.o
  [ 24%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/window.c.o
  [ 32%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/x11_init.c.o
  [ 32%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/x11_monitor.c.o
  [ 36%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/x11_window.c.o
  [ 40%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/xkb_unicode.c.o
  [ 48%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/posix_time.c.o
  [ 48%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/posix_thread.c.o
  [ 56%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/glx_context.c.o
  [ 56%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/egl_context.c.o
  [ 64%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/osmesa_context.c.o
  [ 64%] Building C object raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/null_joystick.c.o

  --- stderr
  CMake Warning (dev) at /usr/local/share/cmake/Modules/FindOpenGL.cmake:315 (message):
    Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
    available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

    FindOpenGL found both a legacy GL library:

      OPENGL_gl_LIBRARY: /usr/local/lib/libGL.so

    and GLVND libraries for OpenGL and GLX:

      OPENGL_opengl_LIBRARY: /usr/local/lib/libOpenGL.so
      OPENGL_glx_LIBRARY: /usr/local/lib/libGLX.so

    OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
    compatibility with CMake 3.10 and below the legacy GL library will be used.
  Call Stack (most recent call first):
    cmake/LibraryConfigurations.cmake:20 (find_package)
    src/CMakeLists.txt:56 (include)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS

  /usr/home/wison/Rust/ping-pong-tron-legacy-rust/target/debug/build/raylib-sys-377270cf76bdc406/out/raylib/src/external/glfw/src/posix_time.c:81:9: error: implicit declaration of function 'gettimeofday' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          gettimeofday(&tv, NULL);
          ^
  1 error generated.
  gmake[2]: *** [raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/build.make:216: raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/posix_time.c.o] Error 1
  gmake[2]: *** Waiting for unfinished jobs....
  gmake[1]: *** [CMakeFiles/Makefile2:159: raylib/external/glfw/src/CMakeFiles/glfw_objlib.dir/all] Error 2
  gmake: *** [Makefile:166: all] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

  build script failed, must exit now', /home/wison/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.49/src/lib.rs:1104:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


Tried OpenGL_GL_PREFERENCE=GLVND cargo build already but still fail:)


raysan5 commented 1 year ago

@wisonye An issue with FreeBSD was fixed yesterday, please, try with latest raylib master branch from github.

wisonye commented 1 year ago

@wisonye An issue with FreeBSD was fixed yesterday, please, try with latest raylib master branch from github.

I just gave it a try, but fail to compile the latest master with the commit ([Update BINDINGS.md for raylib Odin 4.5 (]

 I  wison | /home/wison/temp/raylib   mkdir build
 I  wison | /home/wison/temp/raylib   cd build && cmake -DCMAKE_C_COMPILER=/usr/local/llvm15/bin/clang  ..
-- The C compiler identification is Clang 15.0.6
-- The CXX compiler identification is Clang 15.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/llvm15/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/llvm15/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_HAS_THOSE_TOGGLES
-- Performing Test COMPILER_HAS_THOSE_TOGGLES - Success
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Setting build type to 'Debug' as none was specified.
-- Using raylib's GLFW
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
-- Including X11 support
-- Found X11: /usr/local/include
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/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
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Audio Backend: miniaudio
-- Building raylib static library
-- Generated build type: Debug
-- Compiling with the flags:
--   PLATFORM=PLATFORM_DESKTOP
--   GRAPHICS=GRAPHICS_API_OPENGL_33
-- Building examples is enabled
-- Looking for CLOCK_MONOTONIC
-- Looking for CLOCK_MONOTONIC - found
-- Looking for QueryPerformanceCounter
-- Looking for QueryPerformanceCounter - not found
-- Looking for stdatomic.h
-- Looking for stdatomic.h - found
-- Testing if -std=c11 can be used -- compiles
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wison/temp/raylib/build
 I  wison | /home/wison/temp/raylib/build   make
[  1%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/context.c.o
[  1%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/init.c.o
[  1%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/input.c.o
[  2%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/monitor.c.o
[  2%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/platform.c.o
[  2%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/vulkan.c.o
[  3%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/window.c.o
[  3%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/egl_context.c.o
[  3%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/osmesa_context.c.o
[  4%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/null_init.c.o
[  4%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/null_monitor.c.o
[  4%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/null_window.c.o
[  5%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/null_joystick.c.o
[  5%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/posix_module.c.o
[  5%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/posix_time.c.o
[  6%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/posix_thread.c.o
[  6%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/x11_init.c.o
[  6%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/x11_monitor.c.o
[  7%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/x11_window.c.o
[  7%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o
[  7%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/glx_context.c.o
[  8%] Building C object raylib/external/glfw/src/CMakeFiles/glfw.dir/posix_poll.c.o
[  8%] Linking C static library libglfw3.a
[  8%] Built target glfw
[  8%] Building C object raylib/CMakeFiles/raylib.dir/rcore.c.o
[  9%] Building C object raylib/CMakeFiles/raylib.dir/rmodels.c.o
In file included from /home/wison/temp/raylib/src/rmodels.c:112:
/home/wison/temp/raylib/src/external/par_shapes.h:1133:32: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
    float r = (float) rand() / RAND_MAX;
                             ~ ^~~~~~~~
/usr/include/stdlib.h:80:18: note: expanded from macro 'RAND_MAX'
#define RAND_MAX        0x7fffffff
                        ^~~~~~~~~~
1 warning generated.
[  9%] Building C object raylib/CMakeFiles/raylib.dir/rshapes.c.o
[  9%] Building C object raylib/CMakeFiles/raylib.dir/rtext.c.o
[ 10%] Building C object raylib/CMakeFiles/raylib.dir/rtextures.c.o
[ 10%] Building C object raylib/CMakeFiles/raylib.dir/utils.c.o
[ 10%] Building C object raylib/CMakeFiles/raylib.dir/raudio.c.o
[ 11%] Linking C static library libraylib.a
[ 11%] Built target raylib
[ 11%] Building C object examples/CMakeFiles/audio_mixed_processor.dir/audio/audio_mixed_processor.c.o
[ 11%] Linking C executable audio_mixed_processor
ld: error: unable to find library -latomic
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[2]: stopped in /usr/home/wison/temp/raylib/build
*** Error code 1

Stop.
make[1]: stopped in /usr/home/wison/temp/raylib/build
*** Error code 1

Stop.
make: stopped in /usr/home/wison/temp/raylib/build


Tried to install the following dependencies that are related to atomic but will get this error: ld: error: unable to find library -latomic

Totally have no idea at this moment:)