q66 / cffi-lua

A portable C FFI for Lua 5.1+
MIT License
176 stars 24 forks source link

ffi.h not found #4

Closed diamond-lizard closed 1 year ago

diamond-lizard commented 3 years ago

Since I couldn't get luarocks install --local cffi-lua to work (see Issue 3), I tried:

luarocks unpack cffi-lua
cd cffi-lua/cffi-lua-0.1.1-1/cffi-lua
luarocks make --local cffi-lua-0.1.1-1.rockspec

and then get an error about ffi.h not being found (see full log below), despite me having libffi installed and ffi.h residing in /usr/lib64/libffi-3.2.1/include/ffi.h.

I'm this build on amd64 Gentoo Linux.

Here's the full build log:

%  luarocks make --local cffi-lua-0.1.1-1.rockspec
env \
        LUA="lua" CC="gcc" LD="gcc" \
        CFLAGS='-O2 -fPIC -I/usr/include -I/usr/include' \
        LDFLAGS='-L/usr/lib -lffi' \
        PREFIX="/home/me/.luarocks/lib/luarocks/rocks/cffi-lua/0.1.1-1" LIBDIR="/home/me/.luarocks/lib/luarocks/rocks/cffi-lua/0.1.1-1/lib" \
        ./luarocks/build.sh build

The Meson build system
Version: 0.50.1
Source dir: /home/me/test/lua/cffi-lua/cffi-lua-0.1.1-1/cffi-lua
Build dir: /home/me/test/lua/cffi-lua/cffi-lua-0.1.1-1/cffi-lua/build
Build type: native build
Project name: cffi-lua
Project version: 0.1.1
Appending CXXFLAGS from environment: '-O2 -fPIC -I/usr/include -I/usr/include'
Appending LDFLAGS from environment: '-L/usr/lib -lffi'
Native C++ compiler: g++ (gcc 8.2.0 "g++ (Gentoo 8.2.0-r6 p1.7) 8.2.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Compiler for C++ supports arguments -Wshadow: YES
Compiler for C++ supports arguments -Wold-style-cast: YES
Compiler for C++ supports arguments -fvisibility=hidden: YES
Checking for size of "void *" : 8
Has header "endian.h" : YES
Library dl found: YES
Has header "ffi.h" with dependency not-found: NO
Has header "ffi/ffi.h" with dependency not-found: NO

meson.build:109:8: ERROR: Problem encountered: libffi header file not found

A full log can be found at /home/me/test/lua/cffi-lua/cffi-lua-0.1.1-1/cffi-lua/build/meson-logs/meson-log.txt

Error: Build error: Failed building.
q66 commented 3 years ago

how exactly is the system supposed to know the location of the libffi headers if they're in a non-standard path? install your libffi properly, so that headers reside in /usr/include, or specify the incdir manually, or don't use luarocks

diamond-lizard commented 3 years ago

This is where portage, the Gentoo package manager installed the headers.

So it looks like there is an incompatibility between the luarocks cffi-package and Gentoo.

Per your recommendation, I will try installing cffi-lua from outside of luarocks.

Thank you for your help.