Closed RobLoach closed 4 years ago
I'll get going.
Sorry for the delay, had to get my test system in order first. cloned the PR including raylib as submodule and ran npm it. I don't have X11 on that Pi and I don't want it, nor should it be needed to build in the correct headless mode.
> raylib@0.5.3 postinstall /home/pi/node-raylib/node-raylib
> cmake-js compile
[
'/usr/local/lib/nodejs/node-v12.16.2-linux-armv7l/bin/node',
'/home/pi/node-raylib/node-raylib/node_modules/.bin/cmake-js',
'compile'
]
info TOOL Using Unix Makefiles generator.
info CMD BUILD
info RUN cmake --build "/home/pi/node-raylib/node-raylib/build" --config Release
make: *** No targets specified and no makefile found. Stop.
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN cmake -E remove_directory "/home/pi/node-raylib/node-raylib/build"
info CMD CONFIGURE
info RUN cmake "/home/pi/node-raylib/node-raylib" --no-warn-unused-cli -G"Unix Makefiles" -DCMAKE_JS_VERSION="6.1.0" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/home/pi/node-raylib/node-raylib/build/Release" -DCMAKE_JS_INC="/home/pi/.cmake-js/node-arm/v12.16.2/include/node" -DCMAKE_JS_SRC="" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="12.16.2" -DNODE_ARCH="arm"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.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
CMake Warning at CMakeLists.txt:29 (find_package):
By not providing "Findraylib.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "raylib", but
CMake did not find one.
Could not find a package configuration file provided by "raylib" (requested
version 3.0.0) with any of the following names:
raylibConfig.cmake
raylib-config.cmake
Add the installation prefix of "raylib" to CMAKE_PREFIX_PATH or set
"raylib_DIR" to a directory containing one of the above files. If "raylib"
provides a separate development package or SDK, be sure it has been
installed.
-- 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
-- Testing if file system supports symlinks
-- Testing if file system supports symlinks -- supported
-- Using raylib's GLFW
-- 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
-- Using X11 for window creation
CMake Error at /usr/share/cmake-3.13/Modules/FindX11.cmake:429 (message):
Could not find X11
Call Stack (most recent call first):
vendor/raylib/src/external/glfw/CMakeLists.txt:200 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/pi/node-raylib/node-raylib/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/node-raylib/node-raylib/build/CMakeFiles/CMakeError.log".
ERR! OMG Process terminated: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! raylib@0.5.3 postinstall: `cmake-js compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the raylib@0.5.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-04-27T19_45_11_957Z-debug.log
seems like cmake doesn't work properly with raylib on a raspi yet. https://github.com/raysan5/raylib/issues/987
I added the following to the CMakeLists.txt in vendor/raylib/src and could then manually build it using CMake in static and shared mode. I'll check if I can now use it with node-raylib tomorrow.
elseif(${PLATFORM} MATCHES "Raspberry Pi")
set(PLATFORM_CPP "PLATFORM_RPI")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
find_library(OPENGL_LIBRARY OpenGL)
add_definitions(-D_GNU_SOURCE=1)
FIND_LIBRARY(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
FIND_LIBRARY(EGL brcmEGL HINTS /opt/vc/lib)
FIND_LIBRARY(BCMHOST bcm_host HINTS /opt/vc/lib)
include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
link_directories(/opt/vc/lib)
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
endif()
Thanks or investigating.... Just bought a RPi4, so hopefully I can do some debugging too.
Good news:
npm it
> raylib@0.5.3 postinstall /home/pi/node-raylib/node-raylib
> cmake-js compile
[
'/usr/local/lib/nodejs/node-v12.16.2-linux-armv7l/bin/node',
'/home/pi/node-raylib/node-raylib/node_modules/.bin/cmake-js',
'compile'
]
info TOOL Using Unix Makefiles generator.
info CMD BUILD
info RUN cmake --build "/home/pi/node-raylib/node-raylib/build" --config Release
Scanning dependencies of target node-raylib
[ 50%] Building CXX object CMakeFiles/node-raylib.dir/src/addon.cc.o
[100%] Linking CXX shared library Release/node-raylib.node
[100%] Built target node-raylib
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.1 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN eslint-import-resolver-webpack@0.12.1 requires a peer of webpack@>=1.11.0 but none is installed. You must install peer dependencies yourself.
audited 3318 packages in 83.466s
47 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
> raylib@0.5.3 test /home/pi/node-raylib/node-raylib
> mocha
raylib
window
✓ IsWindowReady()
✓ IsWindowReady("incorrect", "number", "of", "args")
audio
✓ IsAudioDeviceReady()
file
✓ FileExists()
✓ IsFileExtension()
rlgl
INFO: FILEIO: [/home/pi/node-raylib/node-raylib/package.json] Text file loaded successfully
✓ LoadText()
enums
✓ KEY_A
✓ COMPRESSED_ASTC_4x4_RGBA
color
✓ GetColor()
camera
✓ Camera()
cli
✓ should execute on a script (917ms)
✓ should display the help (697ms)
12 passing (2s)
> raylib@0.5.3 posttest /home/pi/node-raylib/node-raylib
> xo index.js bin/node-raylib src/scripts/pkg.js
I checked out this PR clean, removed LoadImagePro from node-raylib.h and updated the vendor/raylib to origin master. There, I did the fix from my last comment above. Maybe raylib was also installed with cmake -> make install and that was found, however it could obviously build against it without problems.
I could sucessfully copy the simple_game template, run npm install ~/node-raylib and run the application! It works!
I created a pull request on raylib, with that, your PR should work. https://github.com/raysan5/raylib/pull/1229
At least after the mentioned API change has been incorporated, so raylib/master can be used.
That's great news! I knew thehre was something that we needed to pass throguh or something. Thanks a lot :rocket:
Hi Rob I would really need to get this working on "lite" raspberry pi image (no x11) I have tried patching the node-raylib and raylib files that you and armageddon421 have been talking, without success.
From my understanding, step#1: git clone node-raylib in my ~/ directory step#2: git clone raylib in ~/node-raylib/vendor directory step#3: Modify ~/node-raylib/CMakeLists.txt step#4: Modify ~/node-raylib/vendor/src/CMakeLists.txt then.. what commands should I run and from what directory Detailed step by step list of todo commands and files modes would really help.
Daniel Benoit
The Pull Request isn't merged yet. Once it's merged, I'll update raylib and things should work :wink:
Also, you can run the following to bring in raylib...
git submodule update --init
I'll add a note in the readme.
Thanks Rob! By using "git submodule update --init", the src/external directory now contains the correct /ANGLE and /android directories. It was not the case when I "git cloned" raylib.
Also what is the correct usage and syntax regarding: npm it, should it be called from a specific directory? Daniel
git clone https://github.com/RobLoach/node-raylib.git
cd node-raylib
git submodule update --init
npm it
The PR on raylib was just merged to master. I hope this also works now, I'll only be able to check it in about two days. https://github.com/raysan5/raylib/pull/1229
Check the architecture in CMake to pass off
Raspberry Pi
toPLATFORM
.@daniel-thd-labs @armageddon421 Maybe something like this works? Mind checking out the branch and doing a
npm it
to see if it works? Thanks!https://github.com/RobLoach/node-raylib/issues/61