Comments (1)
I had the same problem. I found the solution by going through the cffi code. What you need is to modify c-toolchain.lisp. You will also need to install mingw tools on your WSL (I know there's MSYS2 but i thought it makes more sense to try to use WSL2).
check this patch and see if it makes sense in terms of hardcoded paths i.e. C:/, and /mnt/c/. Change those according to your paths
c-toolchain.patch
on WSL2 you will need to install mingw tools. This should be the starting point before anything else.
sudo apt install mingw-w64
You will then need to download libffi sources and compile them libffi-v3.4.6
wget https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz
gzip -d libffi-3.4.6.tar.gz
tar -xf libffi-3.4.6.tar
# the following will not compile (no clue as to why yet. I'm only interested in ffi.h header file)
sh ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-dependency-tracking -host=x86_64-w64-mingw32
# you will find the ffi.h header in the following location
libffi-3.4.6/x86_64-w64-mingw32/include/
From your REPL do the following:
(ql:quickload "str")
(ql:quickload "cffi")
(setf (uiop:getenv "CC") "x86_64-w64-mingw32-gcc")
(ql:quickload "cffi-libffi") <- this will fail. But it has downloaded the files we need.
With the cffi-libffi downloaded, we need to copy some files from libffi compilation to where cffi was downloaded (cffi-libffi is part of that dir)
# copy all contents to c:/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/
cp -r ~/libffi-3.4.6/x86_64-w64-mingw32/include/* /mnt/c/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/
Locate c-toolchain.lisp (mine is in C:/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/toolchain/c-toolchain.lisp)
Apply the patch on that file and attempt to run (ql:quickload "cffi-libffi")
again.
Sample output:
; Dedicated output stream setup (port 60565)
; Redirecting all output to this MREPL
; SLY 1.0.43 (#<MREPL mrepl-1-1>)
CL-USER> (setf (uiop:getenv "CC") "x86_64-w64-mingw32-gcc")
0 (0 bits, #x0, #o0, #b0)
CL-USER> (ql:quickload "str")
To load "str":
Load 1 ASDF system:
str
; Loading "str"
...
("str")
CL-USER> (ql:quickload "cffi")
To load "cffi":
Load 1 ASDF system:
cffi
; Loading "cffi"
.............
("cffi")
CL-USER> (ql:quickload "cffi-libffi")
To load "cffi-libffi":
Load 1 ASDF system:
cffi-libffi
; Loading "cffi-libffi"
; pkg-config libffi --cflags
; ERROR: Couldn't execute "pkg-config": The system cannot find the file specified.
; Attempting to continue anyway.
;wsl -e x86_64-w64-mingw32-gcc -o /mnt/c/Users/your-name/AppData/Local/cache/common-lisp/sbcl-2.2.7-win-x64/C/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmpAAURSO1.obj -c -m64 -I/mnt/c/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/ /mnt/c/Users/your-name/AppData/Local/cache/common-lisp/sbcl-2.2.7-win-x64/C/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.c
.;wsl -e x86_64-w64-mingw32-gcc -o /mnt/c/Users/your-name/AppData/Local/cache/common-lisp/sbcl-2.2.7-win-x64/C/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel-tmpAR3FSGEY.exe -m64 -Wl,--export-dynamic /mnt/c/Users/your-name/AppData/Local/cache/common-lisp/sbcl-2.2.7-win-x64/C/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.obj
;"C:\Users\your-name\AppData\Local\cache\common-lisp\sbcl-2.2.7-win-x64\C\Users\your-name\quicklisp\dists\quicklisp\software\cffi-20231021-git\libffi\libffi-types__grovel.exe" C:/Users/your-name/AppData/Local/cache/common-lisp/sbcl-2.2.7-win-x64/C/Users/your-name/quicklisp/dists/quicklisp/software/cffi-20231021-git/libffi/libffi-types__grovel.grovel-tmp.lisp
...
("cffi-libffi")
CL-USER>
You can now (ql:quickload "cl-raylib")
.
from cl-raylib.
Related Issues (20)
- Have you managed to compile this for the web? HOT 4
- Generate bindings via `cl-autowrap` HOT 15
- Information on camera update HOT 4
- Memory fault with struct passed by value HOT 3
- Camera first person and third person constants are not defined correctly in raylib.lisp HOT 2
- Update raylib's BINDINGS.md file HOT 2
- Add to quicklisp HOT 2
- `load-render-texture` causes a type error about `SB-SYS:SYSTEM-AREA-POINTER` HOT 3
- Supporting Vector and Matrix operations HOT 1
- Support for `raygui` HOT 12
- core_world_screen example fails to place text correctly HOT 2
- audio_sound_loading.lisp makes no sound HOT 3
- Efficient handling of RGBA translation HOT 3
- Consider adding finalizers to resource heavy objects
- Tests failed HOT 1
- why draw-rectangle takes arguments of type integers instead of float? HOT 1
- cl-raylib support load-texture? HOT 2
- Why you deleted a constants?
- Can you please write this in "cl-raylib", i could not get a working version of it? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-raylib.