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

Build of Souffle 2.1 fails on macOS 11.5.2 #7

Open
legendtang opened this issue Aug 24, 2021 · 18 comments
Open

Build of Souffle 2.1 fails on macOS 11.5.2 #7

legendtang opened this issue Aug 24, 2021 · 18 comments

Comments

@legendtang
Copy link

==> Downloading https://github.com/souffle-lang/souffle/archive/refs/tags/2.1.tar.gz
==> cmake -B build -S .
==> cmake --build build --target install
Last 15 lines from /Users/legend/Library/Logs/Homebrew/souffle/02.cmake:
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/math.h:155:5: note: expanded from macro 'isfinite'
    ( sizeof(x) == sizeof(float)  ? __inline_isfinitef((float)(x))       \
    ^
[ 29%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/RelationDetailCache.cpp.o
[ 29%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/RelationSchedule.cpp.o
[ 30%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/SCCGraph.cpp.o
[ 30%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/SumTypeBranches.cpp.o
[ 31%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/TopologicallySortedSCCGraph.cpp.o
[ 31%] Building CXX object src/CMakeFiles/libsouffle.dir/ast/analysis/Type.cpp.o
15 errors generated.
gmake[2]: *** [src/CMakeFiles/libsouffle.dir/build.make:787: src/CMakeFiles/libsouffle.dir/ast/analysis/ProfileUse.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:1179: src/CMakeFiles/libsouffle.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
@b-scholz
Copy link
Member

b-scholz commented Sep 2, 2021

This is very strange. Which compiler do you use for the compilation? Is it a new MAC OS X / processor?

@legendtang
Copy link
Author

This is very strange. Which compiler do you use for the compilation? Is it a new MAC OS X / processor?
FYI

Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

It is on a MBP'16 2019 Intel model.

@b-scholz
Copy link
Member

b-scholz commented Sep 2, 2021

Try to install manually and check whether this works.
https://souffle-lang.github.io/build

@legendtang
Copy link
Author

Try to install manually and check whether this works.
https://souffle-lang.github.io/build

I tried above and it fails in another place:

github/souffle-2.1/src/include/souffle/utility/ParallelUtil.h:43:10: fatal error: 'omp.h' file not found
#include <omp.h>

@b-scholz
Copy link
Member

b-scholz commented Sep 2, 2021

Oh - you haven't installed gcc. Could you install gcc and openMP?

@legendtang
Copy link
Author

Oh - you haven't installed gcc. Could you install gcc and openMP?

I have gcc installed, but cmake will automatically select clang for default compiler. In the document, Clang is well supported and OpenMP is supported after Clang v3.7+. Maybe it is a problem of CMakeLists.txt which does not include -fopenmp flag properly?

@rahlk
Copy link
Contributor

rahlk commented Nov 24, 2021

Any updates on this issue? I am facing the same issue on the lastest macOS

@b-scholz
Copy link
Member

Would you like to help?

@rahlk
Copy link
Contributor

rahlk commented Nov 24, 2021

Absolutely, please let me know how I can help.

@rahlk
Copy link
Contributor

rahlk commented Nov 25, 2021

Ok, I was able to get this to work by looking at the old build instructions from v2.0.2. The issue is most likely with Apple's clang gcc/g++ and with brew's version.

Try this:

  1. Reinstall gcc
brew reinstall gcc
  1. Link bison/libffi
brew link bison --force
brew link libffi --force
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig/

You may get an error here saying Warning: Refusing to link macOS provided/shadowed software: bison. In that case, just follow homebrew's recommendations.

  1. Clone the souffle repo, and install.
git clone --branch 2.1 https://github.com/souffle-lang/souffle
cd souffle

If you have previously cloned the repo, cd into it and clean cmake cache with cmake --build ./build/ --target clean

  1. Export the correct versions of CC/CXX and then use cmake.
export CC=gcc-11
export CXX=g++-11
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=<path/to/install/dir>
cmake --build build --target install -j8

@b-scholz
Copy link
Member

That is great! Basically, we need to rewire the cmake scripts to pick up gcc rather clang.

@b-scholz
Copy link
Member

We could also set the flags as with

-DCMAKE_C_COMPILER='gcc-11' -DCMAKE_CXX_COMPILER='g++-11'

@b-scholz
Copy link
Member

We would need to add these flags here:

system "cmake", "-B", "build", "-S", ".", "-DCMAKE_INSTALL_PREFIX=#{prefix}","-DSOUFFLE_GIT=OFF", "-DSOUFFLE_BASH_COMPLETION=OFF"

And add the gcc/g++ dependency. Would you like to create a pull-request for this?

@b-scholz
Copy link
Member

The GCC dependencies needs to be added here:

depends_on "bison" => :build

@rahlk
Copy link
Contributor

rahlk commented Nov 29, 2021

Thanks! Let me send you a PR with this.

@rahlk
Copy link
Contributor

rahlk commented Dec 6, 2021

Hi @b-scholz, I have updated the formula. However, I am having some issue which copying over bash completion:

...
-- Installing: /etc/bash_completion.d/souffle
CMake Error at cmake_install.cmake:64 (file):
  file INSTALL cannot copy file
  "/tmp/souffle-20211206-11911-13e0thm/souffle-2.1/debian/souffle.bash-completion"
  to "/etc/bash_completion.d/souffle": Operation not permitted.

The problem seems to lie in the CMakeLists.txt file, line 100. For some reason, -DSOUFFLE_BASH_COMPLETION=OFF is not getting registered. If were to manually turn it off, brew install --HEAD ... seems to work fine.

We can update the HEAD version of souffle-lang/souffle to update the CMakeLists.txt (Line 100) with option(SOUFFLE_BASH_COMPLETION "Enable/Disable bash completion" OFF) in the interim to allow installation with brew install --HEAD souffle-lang/souffle

Let me how you want me proceed next?

@b-scholz
Copy link
Member

b-scholz commented Dec 6, 2021

Let's merge what you have and let's continue. Completion seems to have a problem.

@rahlk
Copy link
Contributor

rahlk commented Dec 6, 2021

Great, I have submitted a PR (#2146) at souffle-lang/souffle turning off the bash completion there. This will work as soon as that has also been updated.

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

3 participants