The officially official Devuan Forum!

You are not logged in.

#1 2025-05-02 10:48:50

igorzwx
Member
Registered: 2024-05-06
Posts: 161  

How to build a portable wxMaxima-25.04.0 and a Debian package for it.

$ inxi -b | grep Host -A1
  Host: devuan Kernel: 6.1.0-34-amd64 arch: x86_64 bits: 64 Desktop: MATE
    v: 1.26.0 Distro: Devuan GNU/Linux 5 (daedalus)
How to build portable standalone wxMaxima-25.04.0 and wxMaxima-25.04.0.deb

NOTE: It is "portable standalone" in the sense that it does not require installation.
Just click on it and use. You can also start it from terminal, or create a deskto launcher wxMaxima.desktop

$ ./_CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin/wxmaxima --version
wxMaxima 25.04.0 (Git version: 735a94e3a)

_https://github.com/wxMaxima-developers/wxmaxima/releases/tag/Version-25.04.0
wxMaxima 25.04.0  Latest
A bugfix release

https://github.com/wxMaxima-developers/wxmaxima.git
Build dependencies

To build wxMaxima-25.04.0.deb, we need CMake 4.0.1
There is a portable standalone version of CMake 4.0.1 in GitHub.
The manual for it is here:

https://dev1galaxy.org/viewtopic.php?id=7161

You can simply download and unpack it into your home folder, for example:

$ ls -1 $HOME/.CTools/
cmake-4.0.1
meson-1.7.2 

Download portable CMake v4.0.1:

https://github.com/Kitware/CMake/releases/download/v4.0.1/cmake-4.0.1-linux-x86_64.tar.gz 

Install "build-essential", build dependencies, etc.:

sudo apt install build-essential debhelper

sudo apt install libwxgtk3.2-dev xvfb netcat-openbsd xauth desktop-file-utils appstream-util libwxgtk-webview3.2-dev libwebkit2gtk-4.0-dev 

sudo apt install fakeroot dpkg-repack git sed tree maxima appstream pandoc po4a imagemagick doxygen texlive-xetex

Clone the source from git:

mkdir wxmaxima2504_build
cd wxmaxima2504_build

git clone https://github.com/wxmaxima-developers/wxmaxima.git 
$ ls
wxmaxima

Project: wxMaxima-25.04.0 (GitHub)

Create DEB_config.cmake

nano ./wxmaxima/DEB_config.cmake 
$ cat ./wxmaxima/DEB_config.cmake
# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}
    CACHE STRING "The resulting package name"
)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_DESCRIPTION}
    CACHE STRING "Package description for the package metadata"
)
set(CPACK_VERBATIM_VARIABLES TRUE)

set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")

set(CPACK_PACKAGE_VERSION "${WXMAXIMA_VERSION}")
set(CPACK_DEBIAN_PACKAGE_RELEASE "1")

set(CPACK_DEBIAN_PACKAGE_MAINTAINER Devuan
    CACHE STRING "Package MAINTAINER"
)
# AUTO-Deps: autogenerate dependency information
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

list(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS maxima)
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "maxima-doc, fonts-inter, fonts-inter-variable, fonts-texgyre, fonts-texgyre-math, fonts-dejavu")
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "fonts-jsmath, texlive-latex-extra, ibus-gtk3")
set(CPACK_DEBIAN_PACKAGE_SECTION math)

set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
# set(CPACK_SOURCE_GENERATOR "TBZ2;TGZ;TXZ;TZ")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\.git*")

include(CPack)

Find the "CMakeLists" of the main project:

$ ls ./wxmaxima | grep CMakeLists
CMakeLists.txt 

To enable the DEB_config.cmake in the main project, append these lines:

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(DEB_config.cmake) 

to the end of the file ./wxmaxima/CMakeLists.txt. This can be done with a text editor, or echo  command:

$ echo -e '\n\nset(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})\ninclude(DEB_config)' >> ./wxmaxima/CMakeLists.txt

$ tail -3 ./wxmaxima/CMakeLists.txt

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(DEB_config) 

Enable portable CMake 4.0.1

$ cmake --version
cmake version 3.25.1
export PATH="$HOME/.CTools/cmake-4.0.1/bin:$PATH"
$ cmake --version
cmake version 4.0.1

1. Generate the Project Buildsystem

cmake -S wxmaxima -B build -DCMAKE_BUILD_TYPE="Release" -DCPACK_DEBIAN_PACKAGE_MAINTAINER=Daedalus -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_COMPILER=g++ -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config -Wno-dev 
$ ls -1
build
wxmaxima

2. Build the Project

cmake --build build  

3. Make the Debian package with CPack

$ ls ./build | grep Config.cmake
CPackConfig.cmake
CPackSourceConfig.cmake 
$ cpack --config build/CPackConfig.cmake -G DEB
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: wxMaxima
CPack: - Install project: wxMaxima []
CPack: Create package
CPackDeb: - Generating dependency list
CPack: - package: /home/.../wxmaxima2504_build/wxmaxima_25.04.0-1_amd64.deb generated. 

Generate the source package with CPack

$ cpack -G TGZ -DCPACK_PACKAGING_INSTALL_PREFIX="/" --config build/CPackSourceConfig.cmake
CPack: Create package using TGZ
CPack: Install projects
CPack: - Install directory: /home/igor/Desktop/Builds/Builds_wxMaxima/Build_wxmaxima_25.01.0_GIT/wxmaxima2504_build/wxmaxima
CPack: Create package
CPack: - package: /home/.../wxmaxima2504_build/wxMaxima-25.04.0-Source.tar.gz generated.
$ ls -1
build
_CPack_Packages
wxmaxima
wxmaxima_25.04.0-1_amd64.deb
wxMaxima-25.04.0-Source.tar.gz
$ dpkg-deb -f *.deb
Architecture: amd64
Depends: maxima, libc6 (>= 2.34), libgcc-s1 (>= 3.0), libstdc++6 (>= 11), libwxbase3.2-1 (>= 3.2.2+dfsg), libwxgtk-webview3.2-1 (>= 3.2.2+dfsg), libwxgtk3.2-1 (>= 3.2.1+dfsg-2)
Description: wxMaxima is a document based interface for the computer algebra system Maxima.
Homepage: https://wxmaxima-developers.github.io/wxmaxima/
Maintainer: Daedalus
Package: wxmaxima
Priority: optional
Recommends: maxima-doc, fonts-inter, fonts-inter-variable, fonts-texgyre, fonts-texgyre-math, fonts-dejavu
Section: math
Suggests: fonts-jsmath, texlive-latex-extra, ibus-gtk3
Version: 25.04.0-1
Installed-Size: 15154

Install wxMaxima

sudo dpkg -i wxmaxima_25.04.0-1_amd64.deb 
$ wxmaxima --version
wxMaxima 25.04.0 (Git version: 735a94e3a)
$ apt show wxmaxima
Package: wxmaxima
Version: 25.04.0-1
Status: install ok installed
Priority: optional
Section: math
Maintainer: Daedalus
Installed-Size: 15.5 MB
Depends: maxima, libc6 (>= 2.34), libgcc-s1 (>= 3.0), libstdc++6 (>= 11), libwxbase3.2-1 (>= 3.2.2+dfsg), libwxgtk-webview3.2-1 (>= 3.2.2+dfsg), libwxgtk3.2-1 (>= 3.2.1+dfsg-2)
Recommends: maxima-doc, fonts-inter, fonts-inter-variable, fonts-texgyre, fonts-texgyre-math, fonts-dejavu
Suggests: fonts-jsmath, texlive-latex-extra, ibus-gtk3
Homepage: https://wxmaxima-developers.github.io/wxmaxima/
Download-Size: unknown
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: wxMaxima is a document based interface for the computer algebra system Maxima.

The project directory wxmaxima2504_build:

$ ls -1
build
_CPack_Packages
wxmaxima
wxmaxima_25.04.0-1_amd64.deb
wxMaxima-25.04.0-Source.tar.gz
■  What was built seems to be a sort of portable standalone wxMaxima.
./_CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin/wxmaxima

Just click on it and use.

$ ./_CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin/wxmaxima --version
wxMaxima 25.04.0 (Git version: 735a94e3a)

It should work on any Linux with "NEEDED" shared libraries installed:

$ readelf --dynamic ./_CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin/wxmaxima | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libwx_gtk3u_richtext-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_gtk3u_aui-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_gtk3u_webview-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_baseu_net-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_baseu_xml-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_gtk3u_core-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libwx_baseu-3.2.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
$ readelf --dynamic ./_CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin/wxmaxima | grep NEEDED | sort | uniq -u | sed -e 's/ /\n/g' | sed -n '/\[l/p' | sed -e 's/\]/ /g' | sed -e 's/\[//g' | tee wxMaxima-git_DEPs_libs.txt
libc.so.6 
libgcc_s.so.1 
libm.so.6 
libstdc++.so.6 
libwx_baseu-3.2.so.0 
libwx_baseu_net-3.2.so.0 
libwx_baseu_xml-3.2.so.0 
libwx_gtk3u_aui-3.2.so.0 
libwx_gtk3u_core-3.2.so.0 
libwx_gtk3u_richtext-3.2.so.0 
libwx_gtk3u_webview-3.2.so.0 

You can verify all dependencies, for example:

$ apt-file search libwx_gtk3u_richtext-3.2.so.0
libwxgtk3.2-1: /usr/lib/x86_64-linux-gnu/libwx_gtk3u_richtext-3.2.so.0
libwxgtk3.2-1: /usr/lib/x86_64-linux-gnu/libwx_gtk3u_richtext-3.2.so.0.2.0 
$ apt info wxmaxima | grep Depends
Depends: maxima, libc6 (>= 2.34), libgcc-s1 (>= 3.0), libstdc++6 (>= 11), libwxbase3.2-1 (>= 3.2.2+dfsg), libwxgtk-webview3.2-1 (>= 3.2.2+dfsg), libwxgtk3.2-1 (>= 3.2.1+dfsg-2)

Notice that wxMaxima is a GUI for Maxima. It does depends on Maxima, in this sense.

Last edited by igorzwx (2025-05-02 12:45:23)

Offline

#2 2025-05-22 07:21:15

igorzwx
Member
Registered: 2024-05-06
Posts: 161  

Re: How to build a portable wxMaxima-25.04.0 and a Debian package for it.

How to build wxMaxima with samu

Enable portable CMake 4.0.2

export PATH="$HOME/.CTools/cmake-4.0.2/bin:$PATH"
$ cmake --version
cmake version 4.0.2

1. Generate the Buildsystem

cmake -S wxmaxima -B build -G Ninja -DCMAKE_BUILD_TYPE="Release" -DCPACK_DEBIAN_PACKAGE_MAINTAINER=Daedalus -DCMAKE_INSTALL_PREFIX='/usr' -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config -DWXM_INTERPROCEDURAL_OPTIMIZATION=ON -Wno-dev 
$ ls -1
build
wxmaxima
$ ls build | grep ninja
build.ninja 

2. Compile wxMaxima with samu

samu -C build

3. Make a Debian package with CPack

$ ls build | grep Config.cmake
CPackConfig.cmake
CPackSourceConfig.cmake 
cpack --config build/CPackConfig.cmake -G DEB 
$ cpack --config build/CPackConfig.cmake -G DEB
CPack: Create package using DEB
CPack: Install projects
CPack: - Install project: wxMaxima []
CPack: Create package
CPackDeb: - Generating dependency list
CPack: - package: /home/.../wxmaxima_25.04.0-1_amd64.deb generated.
$ ls *.deb
wxmaxima_25.04.0-1_amd64.deb 

Install wxMaxima

sudo dpkg -i wxmaxima_25.04.0-1_amd64.deb
$ wxmaxima --version
wxMaxima 25.04.0 (Git version: 6bc13e5)

Last edited by igorzwx (2025-05-22 07:22:55)

Offline

#3 2025-06-03 03:56:34

igorzwx
Member
Registered: 2024-05-06
Posts: 161  

Re: How to build a portable wxMaxima-25.04.0 and a Debian package for it.

Compiling wxMaxima_25.04.0 with GCC-15 on Devuan 5 Daedalus

Portable CMake is available here:
_https://github.com/Kitware/CMake
Portable Ninja is available here:
_https://github.com/ninja-build/ninja
Portable GCC is available here:
_https://github.com/Frogging-Family/mostlyportable-gcc

Portable CMake and Ninja are ready to use.
Portable GCC is easy to compile.

➤ gcc --version
gcc (TkG-mostlyportable) 15.1.1 20250601
➤ g++ --version
g++ (TkG-mostlyportable) 15.1.1 20250601
➤ cmake --version
cmake version 4.0.2
➤ ninja --version
1.12.1 

1. Generating the Buildsystem

cmake -S wxmaxima -B build -G Ninja -DCMAKE_BUILD_TYPE="Release" -DCPACK_DEBIAN_PACKAGE_MAINTAINER=Daedalus -DCMAKE_INSTALL_PREFIX='/usr' -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config -DWXM_INTERPROCEDURAL_OPTIMIZATION=ON -Wno-dev 
-- The CXX compiler identification is GNU 15.1.1
...
-- CMake version:                      4.0.2
-- CMake build type:                   Release
...
-- Found Doxygen: /usr/bin/doxygen (found version "1.9.4") found components: doxygen dot
-- Found po4a: /usr/bin/po4a (found version "0.73")
...
-- Found pandoc: /usr/bin/pandoc (found version "2.17.1.1")
-- Found LATEX: /usr/bin/latex  found components: XELATEX LUALATEX
-- Found ImageMagick: /usr/bin/identify (found version "6.9.11-60")
-- Found Gettext: /usr/bin/msgmerge (found version "0.21")
...
-- Found Maxima: /usr/bin/maxima (found version "5.47post")
-- Found appstreamcli: /usr/bin/appstreamcli (found version "0.16.1") 

2. Compiling with invisible Ninja

cmake --build build 

3. Making a Debian package with CPack

cpack --config build/CPackConfig.cmake -G DEB 
➤ cpack --config build/CPackConfig.cmake -G DEB
CPack: Create package using DEB
CPack: Install projects
CPack: - Install project: wxMaxima []
CPack: Create package
CPackDeb: - Generating dependency list
CPack: - package:.../Build1/wxmaxima_25.04.0-1_amd64.deb generated.
➤ ls -1
build
_CPack_Packages
wxmaxima
wxmaxima_25.04.0-1_amd64.deb 
➤ tree -L 5 _CPack_Packages
_CPack_Packages
└── Linux
    └── DEB
        ├── wxmaxima_25.04.0-1_amd64.deb
        └── wxMaxima-25.04.0-Linux
            ├── control
            ├── control.tar.gz
            ├── data.tar.gz
            ├── debian-binary
            ├── md5sums
            └── usr
                ├── bin
                └── share 
➤ dpkg --info wxmaxima_25.04.0-1_amd64.deb | grep Depends
 Depends: libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 11), libwxbase3.2-1 (>= 3.2.2+dfsg), libwxgtk-webview3.2-1 (>= 3.2.2+dfsg), libwxgtk3.2-1 (>= 3.2.1+dfsg-2) 

These dependencies are very good in the sense that the package can be installed on Devuan 5.
The only problem is that they are wrong. This can be easily verified:

➤ cd _CPack_Packages/Linux/DEB/wxMaxima-25.04.0-Linux/usr/bin
➤ ls
wxmaxima
➤ ./wxmaxima
./wxmaxima: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ./wxmaxima)
./wxmaxima: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.15' not found (required by ./wxmaxima) 

It means that wxMaxima depends on certain libraries compiled together with the portable gcc-15. This problem can be easily fixed, but, first of all, we have to find the cause of the deception.

Debian is deceptive, and, perhaps, fundamentally wrong by design.
We have several hypotheses to verify:
1. The CMake developers do not know the secret esoteric method with which to calculate dependencies.
2. The secret esoteric method is wrong.
3. The Debian "dependency system" is fundamentally wrong.

➤  cd ../../../
➤ ls -1
wxmaxima_25.04.0-1_amd64.deb
wxMaxima-25.04.0-Linux
➤ mkdir debian
➤ ls -1
debian
wxmaxima_25.04.0-1_amd64.deb
wxMaxima-25.04.0-Linux
➤ echo -e "Source: wxmaxima\nPackage: wxmaxima\nDepends: \${shlibs:Depends}" >> debian/control
➤ cat debian/control
Source: wxmaxima
Package: wxmaxima
Depends: ${shlibs:Depends} 
dpkg-shlibdeps -v -xwxmaxima --ignore-missing-info -e $(find wxMaxima-25.04.0-Linux -type f 2>/dev/null) 
➤ cat debian/substvars
shlibs:Depends=libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 11), libwxbase3.2-1 (>= 3.2.2+dfsg), libwxgtk-webview3.2-1 (>= 3.2.2+dfsg), libwxgtk3.2-1 (>= 3.2.1+dfsg-2)

dpkg-shlibdeps produced the same wrong dependencies.

CONCLUSION: The CMake developers are using the same secret esoteric method to calculate dependencies of Debian packages, and this method is wrong.
The method is secret, simply because the system is buggy.
dpkg-shlibdeps cannot be trusted. It is as reliable as weather forecast. Sometimes it is true. Sometimes it is wrong.
The Debian packaging system is either logically inconsistent, or fundamentally wrong by design. This may require a further investigation.

It seems that dpkg-shlibdeps is capable of calculating imaginary esoteric virtual dependencies which are somehow related to the real world dependencies. It might be a product of "demented artificial intelligence", perhaps.

Nevertheless, these dependencies a very good, for they do not prevent installation of the package. The only problem to fix is that of shared libraries. It has a standard solution.

sudo apt install fakeroot patchelf 
➤ fakeroot
# mkdir debdir
# ls -1
debdir
debian
wxmaxima_25.04.0-1_amd64.deb
wxMaxima-25.04.0-Linux
# dpkg-deb -R wxmaxima_25.04.0-1_amd64.deb debdir
# patchelf --print-rpath debdir/usr/bin/wxmaxima
   <empty>
# patchelf --set-rpath $HOME/.CTools/gcc-15.1.1/lib64 debdir/usr/bin/wxmaxima
# patchelf --print-rpath debdir/usr/bin/wxmaxima
~/.CTools/gcc-15.1.1/lib64
# exit
exit 
➤ ./debdir/usr/bin/wxmaxima --version
wxMaxima 25.04.0 (Git version: 583c11f) 
➤ cd debdir
➤ mv -v DEBIAN/md5sums ..
renamed 'DEBIAN/md5sums' -> '../md5sums'
➤ fakeroot
# find . -type f -not -path "./DEBIAN/*" -exec md5sum {} + | sort -k 2 | sed 's/\.\/\(.*\)/\1/' > DEBIAN/md5sums
# ls -1 DEBIAN
control
md5sums
# cd ..
# chmod 0644 -- debdir/DEBIAN/md5sums 
# dpkg-deb -b debdir wxmaxima_25.04.0-1_amd64-fixed.deb
dpkg-deb: building package 'wxmaxima' in 'wxmaxima_25.04.0-1_amd64-fixed.deb'.
# exit
exit
➤  cd ..
➤ ls -1 *.deb
wxmaxima_25.04.0-1_amd64.deb
wxmaxima_25.04.0-1_amd64-fixed.deb 

Now we can install wxMaxima

sudo dpkg -i wxmaxima_25.04.0-1_amd64-fixed.deb 
➤ wxmaxima --version
wxMaxima 25.04.0 (Git version: 583c11f)

Last edited by igorzwx (2025-06-03 03:59:01)

Offline

Board footer