kpeeters / cadabra2

A field-theory motivated approach to computer algebra.
https://cadabra.science/
GNU General Public License v3.0
230 stars 37 forks source link

Fail to [re]build Cadabra 2.3.8 on Ubuntu 20.04 LTS and WSL2 with Ubuntu 20.04 LTS #250

Closed Audrius-St closed 2 years ago

Audrius-St commented 2 years ago

Hello,

I had previously successfully built, run, and used Cadabra2 in VSCode running under WSL2. After several upgrades of Python packages [conda], VSCode, and VSCode extensions, I noticed that Cadabra2 has stopped working - no reference to the Cadabra2 kernel in the Jupyter notebook.

Tried to rebuild Cadabra2 on two different Linux systems

  1. Ubunt2 20.04.4 LTS

  2. WSL2: Ubunt2 20.04 LTS

WSL version: 0.51.3.0 Kernel version: 5.10.93.2 WSLg version: 1.0.30 Windows version: 10.0.22572.100

  1. VSCode 1.65.2

with Jupyter Extension v2022.2.1030672458

  1. Python 3.9.7

Anaconda3-2021.11-Linux-x86_64.sh with package upgrades via conda

  1. The same error occurred during linking on both systems:
/usr/bin/ld: /home/audrius/anaconda3/lib/libpangoft2-1.0.so.0: undefined reference to `pango_font_family_get_face'
/usr/bin/ld: /home/audrius/anaconda3/lib/libpangoft2-1.0.so.0: undefined reference to `pango_font_map_get_family'

The details:

  1. cmake
~/cadabra2/build$ cmake ..
-- The C compiler identification is Clang 12.0.0
-- The CXX compiler identification is Clang 12.0.0
-- Check for working C compiler: /usr/lib/llvm-12/bin/clang
-- Check for working C compiler: /usr/lib/llvm-12/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/llvm-12/bin/clang++
-- Check for working CXX compiler: /usr/lib/llvm-12/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Git found: /usr/bin/git

-------------------------------------------
  Building Cadabra version 2.3.9.1 (64-bit)
-------------------------------------------
-- Build id '2803.ce5bc98ee9' dated 2022-02-18
-- Build mode is set to ''
-- Install directory set to /usr/local
-- This is an Ubuntu 20.04 system
-- Building tweak version
-- Building in user mode
-- Building tests

-------------------------------------------
  Configuring Python
-------------------------------------------
-- Building for use with Python 3 (good!)
-- pybind11 v2.9.0 dev1
-- Found PythonInterp: /home/audrius/anaconda3/bin/python3.9 (found version "3.9.7")
-- Found PythonLibs: /home/audrius/anaconda3/lib/libpython3.9.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Performing Test HAS_FLTO_THIN
-- Performing Test HAS_FLTO_THIN - Success
-- Found python /home/audrius/anaconda3/lib/libpython3.9.so
-- Python version is 3.9.
-- Installing Python module in /usr/local/lib/python3.9/site-packages
-- Python abi name cpython-39-x86_64-linux-gnu

-------------------------------------------
  Configuring Jupyter kernel
-------------------------------------------
-- Building the default Jupyter kernel

-------------------------------------------
  Configuring client-server
-------------------------------------------
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'glibmm-2.4'
--   Found glibmm-2.4, version 2.64.2
-- Found glibmm; include path /usr/include/glibmm-2.4;/usr/lib/x86_64-linux-gnu/glibmm-2.4/include;/usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include;/usr/include/sigc++-2.0;/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
-- Found glibmm; lib glibmm-2.4;gobject-2.0;glib-2.0;sigc-2.0
-- Checking for module 'sqlite3'
--   Found sqlite3, version 3.31.1
-- Found sqlite3 library path sqlite3
-- Found sqlite3 include path
-- Found SQLITE3: sqlite3
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.53.0") found components: system program_options date_time filesystem
-- Not building Xeus Jupyter kernel

-------------------------------------------
  Configuring core
-------------------------------------------
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.53") found components: system
-- Found glibmm; include path /usr/include/glibmm-2.4;/usr/lib/x86_64-linux-gnu/glibmm-2.4/include;/usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include;/usr/include/sigc++-2.0;/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
-- Found glibmm; lib glibmm-2.4;gobject-2.0;glib-2.0;sigc-2.0
-- Found gmp header at  /usr/include/x86_64-linux-gnu
-- Found gmp library at /usr/lib/x86_64-linux-gnu/libgmp.so
-- Found gmp
-- Found gmpxx
-- Building without Mathematica support

-------------------------------------------
  Configuring packages
-------------------------------------------

-------------------------------------------
  Configuring native notebook frontend
-------------------------------------------
-- Checking for module 'gtkmm-3.0'
--   Found gtkmm-3.0, version 3.24.2
-- Found gtkmm
-- Using GTKMM frontend
-- Found sqlite3 library path sqlite3
-- Found sqlite3 include path
-- Found glibmm; include path /usr/include/glibmm-2.4;/usr/lib/x86_64-linux-gnu/glibmm-2.4/include;/usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include;/usr/include/sigc++-2.0;/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
-- Found glibmm; lib glibmm-2.4;gobject-2.0;glib-2.0;sigc-2.0
-- Found gtkmm
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.45.0") found components: system
-- Installing LaTeX style files in /usr/local/share/cadabra2/latex

-------------------------------------------
  Configuring tests
-------------------------------------------
-- Set PYTHONPATH for testing to /usr/local/lib/python3.9/site-packages:/usr/local/bin::/home/audrius/cadabra2/libs/appdirs:/home/audrius/cadabra2/core/packages:/home/audrius/cadabra2/core:/home/audrius/cadabra2/build/core/packages:/home/audrius/cadabra2/build/core/:/home/audrius/cadabra2/build/core/:/home/audrius/cadabra2/tests

-------------------------------------------
  Configuring documentation
-------------------------------------------
-- Book will be created in /home/audrius/cadabra2/build/book

-------------------------------------------
  All scripts completed
-------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/audrius/cadabra2/build
  1. make
~/cadabra2/build$ make

. . . [numerous warnings - no errors] . . .

/usr/bin/ld: CMakeFiles/cadabra2-gtk.dir/__/common/TeXEngine.cc.o: in function `cadabra::TeXEngine::convert_set(std::set<std::shared_ptr<cadabra::TeXEngine::TeXRequest>, std::less<std::shared_ptr<cadabra::TeXEngine::TeXRequest> >, std::allocator<std::shared_ptr<cadabra::TeXEngine::TeXRequest> > >&)':
/home/audrius/cadabra2/frontend/common/TeXEngine.cc:324: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /home/audrius/anaconda3/lib/libpangoft2-1.0.so.0: undefined reference to `pango_font_family_get_face'
/usr/bin/ld: /home/audrius/anaconda3/lib/libpangoft2-1.0.so.0: undefined reference to `pango_font_map_get_family'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [frontend/gtkmm/CMakeFiles/cadabra2-gtk.dir/build.make:331: frontend/gtkmm/cadabra2-gtk] Error 1
make[1]: *** [CMakeFiles/Makefile2:1138: frontend/gtkmm/CMakeFiles/cadabra2-gtk.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Thank you.

kpeeters commented 2 years ago

Your system links against anaconda's gtk-and-friends, but pkg-config has picked up the system-provided gtk. That's not likely to work ever. If you are only interested in the Jupyter kernel, not Cadabra's native notebook frontend, then disable the frontend by adding -DENABLE_FRONTEND=OFF to the cmake line.

Or disable anaconda and just stick to system-provided packages.

Audrius-St commented 2 years ago

Your system links against anaconda's gtk-and-friends, but pkg-config has picked up the system-provided gtk. That's not likely to work ever.

Thanks for your prompt reply and explanation.

If you are only interested in the Jupyter kernel, not Cadabra's native notebook frontend, then disable the frontend by adding -DENABLE_FRONTEND=OFF to the cmake line.

This cmake line addition did the job. Cadabra2 built successfully on both Ubuntu 20.04 and WLS: Ubuntu 20.04. Runs as expected on WLS: Ubuntu 20.04 in VS Code using the Cadabra2 / Jupyter kernel.

Or disable anaconda and just stick to system-provided packages.

I prefer anaconda for its convenience and being more current.