Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

souffle-compile looking in original directory for includes #2205

Closed
pnwamk opened this issue Mar 9, 2022 · 2 comments
Closed

souffle-compile looking in original directory for includes #2205

pnwamk opened this issue Mar 9, 2022 · 2 comments

Comments

@pnwamk
Copy link
Contributor

pnwamk commented Mar 9, 2022

We are building souffle (2.2) in a temporary directory, installing, and then clearing away the source directory (for a docker image):

RUN cd /tmp && \
    git clone --single-branch --branch=2.2 https://github.com/souffle-lang/souffle && \
    cd souffle && \
    cmake -S . -B build -G Ninja \
        -DCMAKE_C_FLAGS=-g \
        -DCMAKE_CXX_FLAGS=-g \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DSOUFFLE_USE_ZLIB=ON && \
    cmake --build build --target install && \
    cd && \
    rm -rf /tmp/souffle

When we go to use souffle later to compile and run queries, we get errors about missing types, e.g.

compiler error: cannot compile source file "./soufflezLREUj.cpp"
"/usr/bin/c++" "-march=native" "-g" "-stdlib=libc++" "-fopenmp=libomp" "-O2" "-g" "-DUSE_NCURSES" "-DUSE_LIBZ" "-DUSE_SQLITE" "-fopenmp" "-std=c++17" "-o/mate/soufflezLREUj" "./soufflezLREUj.cpp" "-I/usr/local/bin/../include" "-I/usr/local/bin/include" "-I/usr/local/bin/../include/souffle/swig" "-I/usr/local/bin/include/souffle/swig" "-I/tmp/souffle/src/include" "-L.out/build/llvm" "-lpthread" "-ldl" "/usr/lib/x86_64-linux-gnu/libsqlite3.so" "/usr/lib/x86_64-linux-gnu/libz.so" "/usr/lib/x86_64-linux-gnu/libncurses.so" "-lFunctors" 
./soufflezLREUj.cpp:14295:1: error: unknown type name 'Logger'
Logger logger("@runtime;", 0);
^
./soufflezLREUj.cpp:14297:2: error: use of undeclared identifier 'Logger'; did you mean 'logger'?
        Logger logger(R"_(@runtime;)_",iter);
        ^~~~~~
        logger
./soufflezLREUj.cpp:14295:8: note: 'logger' declared here
Logger logger("@runtime;", 0);
       ^
./soufflezLREUj.cpp:30893:2: error: unknown type name 'Logger'
        Logger logger(R"_(@t-nonrecursive-relation;the_empty_alloc_context;./interface.dl [202:7-202:30];)_",iter, [&](){return rel_1_the_empty_alloc_context->size();});

I think the problem is that souffle is trying to use that original (now non-existent) source directory that was created before the installation: -I/tmp/souffle/src/include.

Aside from not deleting the source directory, is there another easy fix for this you're aware of? Is this a bug in the CMake? Or are we not passing a flag to get the installation to put the include directories somewhere more permanent?

@pnwamk pnwamk changed the title installing souffle does not place include directory in a central place souffle-compile looking in original directory for includes Mar 9, 2022
@pnwamk
Copy link
Contributor Author

pnwamk commented Mar 9, 2022

I think these lines are why the souffle-compile script that is generated is looking in our temporary directory and not in /usr/local/include (which I now see does contain the souffle include directory! we just need to get souffle-compile to look there instead, I think):

# This is ugly. Once we switch to cmake, we need to figure out a cleaner
# way to handle things like these. The headers, and souffle's dependence
# on this shell script are just a bit strange
CMAKE_HEADER_DIRS="@CMAKE_HEADER_DIRS@"
if [ -n "$CMAKE_HEADER_DIRS" ]; then
HEADER_DIRS+=("-I$CMAKE_HEADER_DIRS")
fi

@pnwamk
Copy link
Contributor Author

pnwamk commented Mar 9, 2022

Apologies for the noise - I tracked down that this is an issue that has already been fixed: #2186

@pnwamk pnwamk closed this as completed Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant