sionescu / iolib

Common Lisp I/O library
http://common-lisp.net/project/iolib/
MIT License
140 stars 31 forks source link

iolib fails to compile under FreeBsd 14.0 #82

Open wglb opened 1 week ago

wglb commented 1 week ago

On FreeBSD 14.0, rebuilding system and now regenerating all my code.

Compiling lisp code yields

Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {102F532DA3}>
 with command ("cc" "-o"
               "/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel-tmpOPCILR65.o"
               "-c" "-g" "-Wall" "-Wundef" "-Wsign-compare"
               "-Wpointer-arith" "-O3" "-fno-omit-frame-pointer"
               "-fPIC"
               "-I/home/wglb/quicklisp/dists/quicklisp/software/cffi-20231021-git/"
               "/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c")
 exited with error code 1
   [Condition of type CFFI-GROVEL:GROVEL-ERROR]

Running this by hand with the command clarifies the errors a bit:

/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c:6:10: fatal error: 'lfp.h' file not found
#include <lfp.h>
         ^~~~~~~
1 error generated.

Modifying the above compile to modify the include path:

"cc" "-o" "/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel-tmpMAMO3XGR.o" \
               "-c" "-g" "-Wall" "-Wundef" "-Wsign-compare" \
               "-Wpointer-arith" "-O3" "-fno-omit-frame-pointer" \
               "-fPIC" \
               -I/usr/local/include/ \
               "-I/home/wglb/quicklisp/dists/quicklisp/software/cffi-20231021-git/" \
               "/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c" \

Gives the warnings

/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c:5980:6: warning: ordered comparison between pointer and integer
      ('__sighandler_t *' (aka 'void (*)(int)') and 'long long')
  if(_64_BIT_VALUE_FITS_SIGNED_P(SIG_IGN))
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wglb/quicklisp/dists/quicklisp/software/cffi-20231021-git/grovel/common.h:19:54: note: expanded from macro '_64_BIT_VALUE_FITS_SIGNED_P'
#define _64_BIT_VALUE_FITS_SIGNED_P(value) ( (value) <= 0x7FFFFFFFFFFFFFFFLL )
                                             ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c:5994:6: warning: ordered comparison between pointer and integer
      ('__sighandler_t *' (aka 'void (*)(int)') and 'long long')
  if(_64_BIT_VALUE_FITS_SIGNED_P(SIG_DFL))
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wglb/quicklisp/dists/quicklisp/software/cffi-20231021-git/grovel/common.h:19:54: note: expanded from macro '_64_BIT_VALUE_FITS_SIGNED_P'
#define _64_BIT_VALUE_FITS_SIGNED_P(value) ( (value) <= 0x7FFFFFFFFFFFFFFFLL )
                                             ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c:6235:6: warning: ordered comparison between pointer and integer ('void *' and 'long long')
  if(_64_BIT_VALUE_FITS_SIGNED_P(MAP_FAILED))
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wglb/quicklisp/dists/quicklisp/software/cffi-20231021-git/grovel/common.h:19:54: note: expanded from macro '_64_BIT_VALUE_FITS_SIGNED_P'
#define _64_BIT_VALUE_FITS_SIGNED_P(value) ( (value) <= 0x7FFFFFFFFFFFFFFFLL )
                                             ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/wglb/.cache/common-lisp/sbcl-2.4.0-bsd-x64/home/wglb/quicklisp/dists/quicklisp/software/iolib-v0.8.4/src/syscalls/ffi-types-unix__grovel.c:18:7: warning: unused variable 'autotype_tmp' [-Wunused-variable]
  int autotype_tmp;
      ^
4 warnings generated.

If I load the package cffi-toolchain, and call (default-coolchain-parameters), then the value of cc-flags shows up as

("-m64" "-I" "/usr/local/include/")

So it isn't clear why the compile doesn't seem to pick that up.

wglb commented 1 week ago

*features* used in the compile

(:SWANK :QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT
 :ANSI-CL :BSD :COMMON-LISP :ELF :FREEBSD :IEEE-FLOATING-POINT :LITTLE-ENDIAN
 :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
 :SB-THREAD :SB-UNICODE :SBCL :UNIX)

Versions of sbcl that I tested with and failed, all in the same way:

  1. 2.4.6
  2. 2.4.0
  3. 2.0.6
  4. 2.2.2
  5. 2.3.10

No such problem occurs in ubuntu linux v 22.04.4

wglb commented 1 week ago

I put in a temporary fix to iolib-v0.8.4/src/syscalls/ffi-types-unix.lisp:

#+freebsd
(cc-flags "-I/usr/local/include")

(include "lfp.h")

Just before the

(include "lfp.h")

at line 19. This resolves the problem, temporarily.

It appears that all references to freebsd have been removed fromio-lib-v0.8.4.lsp