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

Installation on MacOS fails to find sqlite3 #223

Closed
maxmunzel opened this issue Aug 11, 2023 · 4 comments
Closed

Installation on MacOS fails to find sqlite3 #223

maxmunzel opened this issue Aug 11, 2023 · 4 comments
Assignees
Labels
C-bug Category: Bug
Milestone

Comments

@maxmunzel
Copy link

maxmunzel commented Aug 11, 2023

Hey ikos-Team!

I got an error trying to install ikos via brew as recommended in the README:

brew install nasa-sw-vnv/core/ikos
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
==> Updated Homebrew from 4.1.3 (5183103d5) to 4.1.4 (f70a49be2).
Updated 5 taps (homebrew/cask-versions, homebrew/services, minio/stable, homebrew/core and homebrew/cask).
==> New Formulae
arm-none-eabi-binutils     img2pdf                    medusa
arm-none-eabi-gcc          katana                     ollama
arm-none-eabi-gdb          lune                       python-certifi
feishu2md                  lxi-tools                  uncover
==> New Casks
applite                    git-credential-manager     luniistore
crystalfetch               hovrly                     rstudio-daily
elektron-transfer          iem-plugin-suite           xiaomi-cloud

You have 161 outdated formulae and 12 outdated casks installed.


The 4.1.4 changelog can be found at:
  https://github.com/Homebrew/brew/releases/tag/4.1.4
==> Tapping nasa-sw-vnv/core
Cloning into '/usr/local/Homebrew/Library/Taps/nasa-sw-vnv/homebrew-core'...
remote: Enumerating objects: 73, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 73 (delta 4), reused 24 (delta 2), pack-reused 46
Receiving objects: 100% (73/73), 22.33 KiB | 4.47 MiB/s, done.
Resolving deltas: 100% (14/14), done.
Tapped 2 formulae (15 files, 34.5KB).
==> Fetching dependencies for nasa-sw-vnv/core/ikos: cmake, ppl, nasa-sw-vnv/core/apron, xz, tbb and openssl@3
==> Fetching cmake
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.27.2
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:86f1c2132b9e
######################################################################### 100.0%
==> Fetching ppl
==> Downloading https://ghcr.io/v2/homebrew/core/ppl/manifests/1.2_1
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ppl/blobs/sha256:c37e9a48bbaa4e
######################################################################### 100.0%
==> Fetching nasa-sw-vnv/core/apron
==> Downloading http://apron.cri.ensmp.fr/library/apron-0.9.10.tgz
######################################################################### 100.0%
==> Fetching xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.4.4
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:4c25f68798c0b4c
######################################################################### 100.0%
==> Fetching tbb
==> Downloading https://ghcr.io/v2/homebrew/core/tbb/manifests/2021.10.0
Already downloaded: /Users/casparfriedrich/Library/Caches/Homebrew/downloads/3a7e2ae8260ce12215d367faafb19f3db71aeadc02217a328215c3ea3d0c32c0--tbb-2021.10.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/tbb/blobs/sha256:54c8bbc3954d70
Already downloaded: /Users/casparfriedrich/Library/Caches/Homebrew/downloads/43e4fa3b76b7fb479e6434a1fbe7a7fe778230816d406d145617a2b059b91f8a--tbb--2021.10.0.ventura.bottle.tar.gz
==> Fetching openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.1.2-1
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:2bea791e
######################################################################### 100.0%
==> Fetching nasa-sw-vnv/core/ikos
==> Downloading https://files.pythonhosted.org/packages/7e/ae/26808275fc76bf2832
######################################################################### 100.0%
==> Downloading https://github.com/NASA-SW-VnV/ikos/archive/refs/tags/v3.1.tar.g
==> Downloading from https://codeload.github.com/NASA-SW-VnV/ikos/tar.gz/refs/ta
 # #=O#-  #
==> Installing ikos from nasa-sw-vnv/core
==> Installing dependencies for nasa-sw-vnv/core/ikos: cmake, ppl, nasa-sw-vnv/core/apron, xz, tbb and openssl@3
==> Installing nasa-sw-vnv/core/ikos dependency: cmake
==> Pouring cmake--3.27.2.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/cmake/3.27.2: 3,284 files, 59.0MB
==> Installing nasa-sw-vnv/core/ikos dependency: ppl
==> Pouring ppl--1.2_1.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/ppl/1.2_1: 1,545 files, 36.8MB
==> Installing nasa-sw-vnv/core/ikos dependency: nasa-sw-vnv/core/apron
==> Patching
==> make APRON_PREFIX=/usr/local/Cellar/apron/0.9.10_1 GMP_PREFIX=/usr/local/opt
🍺  /usr/local/Cellar/apron/0.9.10_1: 125 files, 9.7MB, built in 1 minute 44 seconds
==> Installing nasa-sw-vnv/core/ikos dependency: xz
==> Pouring xz--5.4.4.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/xz/5.4.4: 163 files, 2.5MB
==> Installing nasa-sw-vnv/core/ikos dependency: tbb
==> Pouring tbb--2021.10.0.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/tbb/2021.10.0: 224 files, 3.4MB
==> Installing nasa-sw-vnv/core/ikos dependency: openssl@3
==> Pouring openssl@3--3.1.2.ventura.bottle.1.tar.gz
🍺  /usr/local/Cellar/openssl@3/3.1.2: 6,495 files, 30.0MB
==> Installing nasa-sw-vnv/core/ikos
==> python3 -m venv --system-site-packages --without-pip /usr/local/Cellar/ikos/
==> python3 -m pip --python=/usr/local/Cellar/ikos/3.1_1/libexec/vendor/bin/pyth
==> cmake -G Unix Makefiles -DGMP_ROOT=/usr/local/opt/gmp -DMPFR_ROOT=/usr/local
Last 15 lines from /Users/casparfriedrich/Library/Logs/Homebrew/ikos/03.cmake:
Found Boost: /usr/local/lib/cmake/Boost-1.82.0 (found version "1.55.0")
Found Boost components:
   filesystem;system;thread
CMake Error at cmake/FindSQLite3.cmake:88 (message):
  error when running a program linked with SQLite3:

  Assertion failed: (strcmp(SQLITE_VERSION, sqlite3_libversion()) == 0),
  function main, file FindSQLite3Version.c, line 8.

  Subprocess aborted
Call Stack (most recent call first):
  analyzer/CMakeLists.txt:102 (find_package)


-- Configuring incomplete, errors occurred!

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/nasa-sw-vnv/homebrew-core/issues

These open issues may also help:
IKOS build fails on gcc12 https://github.com/NASA-SW-VnV/homebrew-core/issues/6
Failed to install IKOS v3.1 with Homebrew on Ubuntu 20.04 (WSL-2) https://github.com/NASA-SW-VnV/homebrew-core/issues/5

The reason seems to be this assert failing:

assert(strcmp(SQLITE_VERSION, sqlite3_libversion()) == 0);

I tweaked the formula (added "sqlite" as a dependency)...

diff --git a/Formula/ikos.rb b/Formula/ikos.rb
index 47a7a40..04c8317 100644
--- a/Formula/ikos.rb
+++ b/Formula/ikos.rb
@@ -2,10 +2,11 @@ class Ikos < Formula
   include Language::Python::Virtualenv
   desc "Static analyzer for C/C++ based on the theory of Abstract Interpretation"
   homepage "https://github.com/nasa-sw-vnv/ikos"
-  url "https://github.com/NASA-SW-VnV/ikos/archive/refs/tags/v3.1.tar.gz"
-  sha256 "e2a9ff32d02aeff92abbb8f69f1a6730ad96b6f59a10e18c30522d033f950844"
+  url "https://demo.maxnagy.com/ikos_mod.tar.gz"
+  sha256 "6db1e2541293dffe6ecce74bbad185360518e664a4c8b7836773a25dcf9d4acd"
   license "MIT"
   revision 1
+  version "42.42.42"

   depends_on "cmake" => :build
   depends_on "apron"
@@ -16,6 +17,7 @@ class Ikos < Formula
   depends_on "mpfr"
   depends_on "ppl"
   depends_on "python"
+  depends_on "sqlite"

   resource "Pygments" do
     url "https://files.pythonhosted.org/packages/7e/ae/26808275fc76bf2832deb10d3a3ed3107bc4de01b85dcccbe525f2cd6d1e/Pygments-2.4.2.tar.gz"

I also disabled the check and added print-statements to the cmake...

diff -au ikos-3.1/cmake/FindSQLite3.cmake ikos-3.1\ 2/cmake/FindSQLite3.cmake
--- ikos-3.1/cmake/FindSQLite3.cmake	2023-08-11 15:43:55
+++ ikos-3.1 2/cmake/FindSQLite3.cmake	2022-12-05 07:21:57
@@ -63,9 +63,8 @@
       #include <sqlite3.h>

       int main() {
-        assert(strcmp(SQLITE_VERSION, sqlite3_libversion()) == 0);
-        printf(\"%s\", sqlite3_libversion());
+        printf(\"libversion: %s\", sqlite3_libversion());
+        printf(\"SQLITE3_VERSION: %s\", sqlite3_libversion());
+        //assert(strcmp(SQLITE_VERSION, sqlite3_libversion()) == 0);
         return 0;
       }
     ")

Now it installs and the output suggests, that the assertion should have passed (maybe some invisible characters?).

FIND_PACKAGE_MESSAGE_DETAILS_SQLite3:INTERNAL=[/Library/Frameworks/Mono.framework/Headers][/usr/local/opt/sqlite/lib/libsqlite3.dylib][vlibversion: 3.42.0SQLITE3_VERSION: 3.42.0()](sorry for the bad formatting)

Hope this helps fixing the installation, thank you for your work on this awesome tool!

@ivanperez-keera
Copy link
Collaborator

Hi,

I'm working on the CI setup and I was met with this error (https://github.com/ivanperez-keera/ikos/actions/runs/6757978476).

I am confused about your statement. You say:

Now it installs and the output suggests, that the assertion should have passed (maybe some invisible characters?).

FIND_PACKAGE_MESSAGE_DETAILS_SQLite3:INTERNAL=[/Library/Frameworks/Mono.framework/Headers][/usr/local/opt/sqlite/lib/libsqlite3.dylib][vlibversion: 3.42.0SQLITE3_VERSION: 3.42.0()](sorry for the bad formatting)

And in the code I see:

+        printf(\"libversion: %s\", sqlite3_libversion());
+        printf(\"SQLITE3_VERSION: %s\", sqlite3_libversion());

This is going to print the same string every time. Should the second line have been printf(\"SQLITE3_VERSION: %s\", SQLITE_VERSION); instead?

@ivanperez-keera ivanperez-keera changed the title Install Fails on MacOS/Homebrew Install on MacOS fails to find sqlite3 Nov 5, 2023
@ivanperez-keera ivanperez-keera changed the title Install on MacOS fails to find sqlite3 Installation on MacOS fails to find sqlite3 Nov 5, 2023
ivanperez-keera added a commit to ivanperez-keera/ikos that referenced this issue Nov 5, 2023
Installation on MacOS fails partly because a sqlite3-related assertion in one
of the pre-installation checks does not hold on MacOS. More specifically, the
assertion in question is whether the version numbers of sqlite3 in the string
SQLITE_VERSION and the one returned by sqlite3_libversion are the same. This is
a known issue with the sqlite3 library, and is external to IKOS.

This commit adds a condition around that assertion so that it is not checked on
MacOS.
@ivanperez-keera
Copy link
Collaborator

@maxmunzel I just added a PR to partly address this issue (#235).

Could you please check if by using this version of ikos and just changing the formula, that's enough for you?

If you have issues finding ikos (or more specifically, if running ikos reports issues finding the ikos python library, add also the change from #234.

Please let me know. I'll try to wait to merge until you have a chance to try it.

@ivanperez-keera ivanperez-keera self-assigned this Nov 5, 2023
@ivanperez-keera ivanperez-keera added the C-bug Category: Bug label Nov 5, 2023
@ivanperez-keera ivanperez-keera added this to the ikos 3.2 milestone Nov 5, 2023
ivanperez-keera added a commit to ivanperez-keera/ikos that referenced this issue Nov 5, 2023
Installation on MacOS fails partly because a sqlite3-related assertion in one
of the pre-installation checks does not hold on MacOS. More specifically, the
assertion in question is whether the version numbers of sqlite3 in the string
SQLITE_VERSION and the one returned by sqlite3_libversion are the same. This is
a known issue with the sqlite3 library, and is external to IKOS.

This commit adds a condition around that assertion so that it is not checked on
MacOS.
@maxmunzel
Copy link
Author

maxmunzel commented Nov 6, 2023

Hi Ivan, thanks for addressing the issue. You‘re right about the prints, no wonder I couldn’t find a difference. I’ll test the updated version tomorrow. Is there anything to do for testing it besides brew editing the commit?

@ivanperez-keera
Copy link
Collaborator

Hi! No problem :) I don't know what brew edit does, but just make sure you are using the version of ikos provided in that PR #235 . You may also need the changes in #234 . Thanks!

ivanperez-keera added a commit to ivanperez-keera/ikos that referenced this issue Nov 8, 2023
Installation on MacOS fails partly because a sqlite3-related assertion in one
of the pre-installation checks does not hold on MacOS. More specifically, the
assertion in question is whether the version numbers of sqlite3 in the string
SQLITE_VERSION and the one returned by sqlite3_libversion are the same. This is
a known issue with the sqlite3 library, and is external to IKOS.

This commit adds a condition around that assertion so that it is not checked on
MacOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

No branches or pull requests

2 participants