rpav / cl-autowrap

(c-include "file.h") => complete FFI wrapper
BSD 2-Clause "Simplified" License
212 stars 41 forks source link

unable to handle compilation, expected exactly one compiler job in ... #118

Open alanruttenberg opened 2 years ago

alanruttenberg commented 2 years ago

Hi, I'm having trouble getting autowrap to work for me. I'm using docker based on the c2ffi CI script (see below). I do

(setq autowrap::*trace-c2ffi* t)
(autowrap:c-include "/root/quicklisp/dists/quicklisp/software/cl-autowrap-20210411-git/t/test.h")

and get output

; Invoking: c2ffi /root/quicklisp/dists/quicklisp/software/cl-autowrap-20210411-git/t/test.h -D null -M /tmp/tmp9KKTJMYV.tmp -A x86_64-pc-linux-gnu
; Invoking: c2ffi /tmp/tmpJU0JWO19.tmp -o /root/quicklisp/dists/quicklisp/software/cl-autowrap-20210411-git/test.x86_64-pc-linux-gnu.spec -A x86_64-pc-linux-gnu
#<THREAD "main thread" RUNNING {10009F0083}>:
  Subprocess #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {1004299373}>
 with command ("c2ffi" "/tmp/tmpJU0JWO19.tmp" "-o"
               "/root/quicklisp/dists/quicklisp/software/cl-autowrap-20210411-git/test.x86_64-pc-linux-gnu.spec"
               "-A" "x86_64-pc-linux-gnu")
 exited with error code 1

When I run the same command directly in a shell I get

warning: /tmp/tmpJU0JWO19.tmp: 'linker' input unused
error: unable to handle compilation, expected exactly one compiler job in '/tmp/tmpJU0JWO19.tmp'

The tmp file contents:

#include "/root/quicklisp/dists/quicklisp/software/cl-autowrap-20210411-git/t/test.h"
#include "/tmp/tmp9KKTJMYV.tmp"

The generated .spec file is empty as is /tmp/tmp9KKTJMYV.tmp. Something I'm doing wrong?

Dockerfile:

FROM ubuntu:20.10
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y llvm-11 clang-11 libclang-11-dev libclang-cpp11-dev python3-pip sbcl curl git 

# Easiest way to get sufficiently new cmake appears to be using pip - Ubuntu 20.10 version is too old
RUN pip3 install --upgrade cmake

# Copy the source into the Docker container
RUN mkdir /repos
WORKDIR /repos
RUN git clone  --branch llvm-11.0.0 --single-branch --depth 1 https://github.com/rpav/c2ffi.git 
RUN git clone  --branch master --single-branch --depth 1 https://github.com/FFmpeg/FFmpeg.git

RUN cd /repos/c2ffi && \
        rm -rf build && mkdir -p build && cd build && \
        cmake -DBUILD_CONFIG=Release .. && make
# As a sanity check, make sure the binary we built can be executed
ENV PATH "$PATH:/repos/c2ffi/build/bin/"
RUN /repos/c2ffi/build/bin/c2ffi --help
RUN curl -O https://beta.quicklisp.org/quicklisp.lisp
RUN sbcl --load quicklisp.lisp --eval '(quicklisp-quickstart:install)' --eval '(setq ql-util::*do-not-prompt* t)' --eval '(ql:add-to-init-file)' --eval '(ql:quickload "cl-autowrap")'