orthecreedence / cl-libuv Goto Github PK
View Code? Open in Web Editor NEWLibuv CL bindings
License: MIT License
Libuv CL bindings
License: MIT License
MSYS2 (Windows) uses a slightly different name for the library, "libuv-1.dll". I created pull request #7 to fix this.
cl-libuv
To WorkWith the latest and greatest MSYS2
as well as the latest sbcl
installed, loading cl-async
as follows:
(ql:quickload :cl-async)
Results in this error for me:
Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {1007101DF3}>
with command ("gcc" "-o"
"C:\\Users\\russe\\AppData\\Local\\cache\\common-lisp\\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\\c\\msys64\\home\\russe\\work\\lisp\\quicklisp\\dists\\quicklisp\\software\\cl-libuv-20200610-git\\grovel__grovel-tmpN1ZVB1HZ.obj"
"-c" "-g" "-W" "-Wall" "-Wno-unused-function"
"-Wno-unused-parameter" "-Wno-cast-function-type"
"-fno-omit-frame-pointer" "-O5" "-m64"
"-DWINVER=0x0501" "-D__W32API_USE_DLLIMPORT__"
"-fno-pie" "-Ic:/include/" "-Ic:/include/uv/"
"-Ic:/msys64/home/russe/work/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/"
"C:\\Users\\russe\\AppData\\Local\\cache\\common-lisp\\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\\c\\msys64\\home\\russe\\work\\lisp\\quicklisp\\dists\\quicklisp\\software\\cl-libuv-20200610-git\\grovel__grovel.c")
exited with error code 1
[Condition of type CFFI-GROVEL:GROVEL-ERROR]
Restarts:
0: [RETRY] Retry #<PROCESS-OP > on #<GROVEL-FILE "cl-libuv" "grovel">.
1: [ACCEPT] Continue, treating #<PROCESS-OP > on #<GROVEL-FILE "cl-libuv" "grovel"> as having been successful.
2: [RETRY] Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
4: [RETRY] Retry ASDF operation.
5: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
--more--
Backtrace:
0: (CFFI-GROVEL:GROVEL-ERROR "~a" #<UIOP/RUN-PROGRAM:SUBPROCESS-ERROR {1006FCD2D3}>)
1: ((FLET "THUNK" :IN CFFI-GROVEL:PROCESS-GROVEL-FILE))
2: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<FUNCTION (FLET "THUNK" :IN CFFI-GROVEL:PROCESS-GROVEL-FILE) {600DACB}>)
3: (CFFI-GROVEL:PROCESS-GROVEL-FILE #P"c:/msys64/home/russe/work/lisp/quicklisp/dists/quicklisp/software/cl-libuv-20200610-git/grovel.lisp" #P"C:/Users/russe/AppData/Local/cache/common-lisp/sbcl-2.2.0.11..
4: ((:METHOD ASDF/ACTION:PERFORM (CFFI-GROVEL::PROCESS-OP CFFI-GROVEL:GROVEL-FILE)) #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cl-libuv" "grovel">) [fast-method]
5: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unused argument> #<unused argument> #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cl-libuv" "grovel">)
6: ((LAMBDA NIL :IN ASDF/ACTION:CALL-WHILE-VISITING-ACTION))
7: ((:METHOD ASDF/ACTION:PERFORM :AROUND (CFFI-GROVEL::PROCESS-OP CFFI-GROVEL::CC-FLAGS-MIXIN)) #<CFFI-GROVEL::PROCESS-OP > #<CFFI-GROVEL:GROVEL-FILE "cl-libuv" "grovel">) [fast-method]
cffi-grovel
has created a C source file to probe the capabilities of
the system, but the generated C program fails to compile. The error
messages from the failed compilation are not accessible from the
debugger, so we repeat the compilation at the command line so that we
can see precisely what is failing.
The compilation command we run is as follows:
gcc -o \
"C:\\Users\\russe\\AppData\\Local\\cache\\common-lisp\\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\\c\\msys64\\home\\russe\\work\\lisp\\quicklisp\\dists\\quicklisp\\software\\cl-libuv-20200610-git\\grovel__grovel-tmpN1ZVB1HZ.obj" \
-c -g -W -Wall -Wno-unused-function \
-Wno-unused-parameter -Wno-cast-function-type \
-fno-omit-frame-pointer -O5 -m64 \
-DWINVER=0x0501 -D__W32API_USE_DLLIMPORT__ \
-fno-pie -Ic:/include/ -Ic:/include/uv/ \
-Ic:/msys64/home/russe/work/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/ \
"C:\\Users\\russe\\AppData\\Local\\cache\\common-lisp\\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\\c\\msys64\\home\\russe\\work\\lisp\\quicklisp\\dists\\quicklisp\\software\\cl-libuv-20200610-git\\grovel__grovel.c"
From the output of that compilation, here is the first error:
C:\Users\russe\AppData\Local\cache\common-lisp\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\c\msys64\home\russe\work\lisp\quicklisp\dists\quicklisp\software\cl-libuv-20200610-git\grovel__grovel.c:201:35: error: ‘WCHAR’ undeclared (first use in this function)
201 | type_name(output, TYPE_SIGNED_P(WCHAR), sizeof(WCHAR));
| ^~~~~
From this we can determine that the WCHAR
type is not defined. We also
notice another similar error:
C:\Users\russe\AppData\Local\cache\common-lisp\sbcl-2.2.0.113-4f1492b0e-wip-win-x64\c\msys64\home\russe\work\lisp\quicklisp\dists\quicklisp\software\cl-libuv-20200610-git\grovel__grovel.c:213:35: error: ‘ULONG’ undeclared (first use in this function)
213 | type_name(output, TYPE_SIGNED_P(ULONG), sizeof(ULONG));
But where are WCHAR
and ULONG
referenced? After much code reading,
we have determined that CL-ASYNC
depends on another system named
CL-LIBUV
, and these references are from CL-LIBUV
. Specifically, the
references are from the grovel.lisp
file:
#+windows
(progn
(ctype uv-uid-t "unsigned char")
(ctype uv-gid-t "unsigned char")
(ctype wchar "WCHAR")
(ctype ulong "ULONG"))
We propose the following edit:
#+windows
(progn
(ctype uv-uid-t "unsigned char")
(ctype uv-gid-t "unsigned char") #+msys2 (ctype wchar "uint16_t")
#-msys2 (ctype ulong "uint32_t") #-msys2 (ctype wchar "WCHAR")
#-msys2 (ctype ulong "ULONG"))
What is the logic behind this proposed change? The WCHAR
and ULONG
types are defined in some Windows header file (WinDef.h
?) which is
accessible when compiling libuv
on Windows using Visual Studio.
However these data type definitions do not appear in the MSYS2
header
files, so if you compiling with MSYS2
then you will get this error.
The change allows the user to add :MSYS2
to *FEATURES*
, which will
instruct cffi-grovel
to output the specified data types. But how do we
know that WCHAR
is a uint16_t
and ULONG
is a uint32_t
? Lot's of
search engine usage, is how.
No doubt a cleaner resolution of this problem is possible, suggestions
welcome.
Building with SBCL 2.3.3.83-562a1a329 / ASDF 3.3.5 for quicklisp dist creation.
Trying to build commit id 19fbd1a
cl-libuv fails to build with the following error:
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_loop_size" UV-LOOP-SIZE) ...))
; Unknown CFFI type SIZE-T
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_now" UV-NOW) ...))
; Unknown CFFI type UINT64-T
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_handle_size" UV-HANDLE-SIZE) ...))
; Unknown CFFI type UV-HANDLE-TYPE
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_req_size" UV-REQ-SIZE) ...))
; Unknown CFFI type UV-REQ-TYPE
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_guess_handle" UV-GUESS-HANDLE) ...))
; Unknown CFFI type UV-HANDLE-TYPE
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_pipe_pending_type" UV-PIPE-PENDING-TYPE) ...))
; Unknown CFFI type UV-HANDLE-TYPE
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_timer_start" UV-TIMER-START) ...))
; Unknown CFFI type UINT64-T
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_timer_set_repeat" UV-TIMER-SET-REPEAT) ...))
; Unknown CFFI type UINT64-T
...
; caught ERROR:
; (during macroexpansion of (DEFCFUN ("uv_timer_get_repeat" UV-TIMER-GET-REPEAT) ...))
; Unknown CFFI type UINT64-T
...
Unhandled CFFI::UNDEFINED-FOREIGN-TYPE-ERROR in thread #<SB-THREAD:THREAD tid=3303063 "main thread" RUNNING {1001738003}>: Unknown CFFI type UV-UID-T
Hi there and thanks for the excellent work you are doing.
Libuv installs on Windows into C:\Program Files\libuv, which breaks a number of builds in quicklisp with dependencies on libuv, so I've patched as follows for your consideration:
@@ -1,6 +1,7 @@
(in-package :libuv)
-(cc-flags #+windows "-Ic:/include/"
+(cc-flags #+windows "-IC:/Program Files/libuv/include"
#+windows "-Ic:/include/"
#+windows "-Ic:/include/uv/"
#+darwin "-I/usr/local/include/")
This fix in turn breaks cffi's grovel, so I've also lodged a separate patch to fix that with the developers over there.
The patch above doesn't display properly (has a big dot in the middle etc) so I gave up I'm sorry, but the intent should be clear.
Cheers and thanks for your time
Mike Thomas
cl-async:alet* calls to (LIBUV:UV-LOOP-SIZE) which gives error:
"The alien function "uv_loop_size" is undefined."
The current version of libuv for Archlinux is 1.21.
It looks like the include hierarchy has changed, and the package does not compile anymore. For instance, this line is wrong, because the uv-errno.h
is now uv/errno.h
as far as I can tell.
Note: I was able to build cl-libuv (and therefore cl-async) by just modifying uv-errno.h
by uv/errno.h
.
https://github.com/rpav/cl-autowrap
When loading cl-libuv on Windows I get an error that gcc isn't found. This is of course from grovelling. I realize the cl-libuv has gone from maybe custom descriptions of the libuv api to grovel (in Issue #2 ), but this means one has to install cygwin, or msys(2?) on Windows, which is kind of a bummer.
Would you be interested in merging work that ports cl-libuv to use cl-autowrap?
With cl-autowrap no compiler is needed - not even a header file from libuv. The description of the API is generated for all platforms on any platform c2ffi is run simultaneously (you don't need Windows, for example, to generated the autowrap file).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.