Being a new CalculiX user is challenging. I spent some time on this forum to find a comprehensive tutorial on how to build CalculiX. Since the repository is opening to contributions I propose a BUILD.md file that can ease this experience. This community has way more knowledge on this topic, so I’d like to ask the members for their help with this.
We’re currently working on a CMake build system to address this issue. While the existing Makefiles work well for some people, they require a fair amount of platform-specific knowledge and manual handling of compiler settings, library paths, and dependencies (which is probably the main reason why no comprehensive tutorial exists at the moment). CMake will improve cross-platform support and dependency management, making it easier for new users and contributors.
On a UNIX-like environment, building CalculiX isn’t all that difficult, see e.g. my build scripts.
I like to link all the libraries statically into CalculiX as much as possible. That makes it easier to do a build with 64-bit integers without messing with the libraries that might be installed system-wide.
Building stuff on ms-windows out-of-the-box is a pretty poor experience in comparison.
I have started using w64devkit for building windows binaries of my own programs if I need to make those. It comes with a lot of the tools that make building software on UNIX-like systems so nice.
Pastix can be more troublesome, especially if you need a build without cuda because you don’t have an Nvidia card or CUDA doesn’t exist for your platform. E.g, building the current pastix4calculix requires the long deprecated python 2.
I would say that integrating a recent pastix might be deserving of a higher priority than yet another meta-build system. cmake requires its own set of settings that you have to use.
This is e.g. how I’m building pastix4calculix:
set -e
PREFIX=`pwd`
# This build *requires* Python 2.7.
# The code generation scripts in this version of PaStiX do *not* work with
# python 3!
if ! which python2.7 >/dev/null; then
echo "Python 2.7 not found."
echo "It is required for building this version of pastix. Exiting..."
exit 1
fi
cd source
rm -rf pastix
tar xf ../distfiles/PaStiX4CalculiX-2.17_cudaless.tar.gz
mv PaStiX4CalculiX-2.17_cudaless pastix4calculix
cd pastix4calculix
patch < ../../patches/pastix/kabbone-CMakeLists.txt.patch
patch < ../../patches/pastix/spm.c.patch
patch < ../../patches/pastix/bcsc_z.h.patch
mkdir build
cd build
env PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig \
cmake -Wno-dev \
-DPYTHON_EXECUTABLE=/usr/local/bin/python2.7 \
-DPASTIX_WITH_CUDA=OFF \
-DCMAKE_PREFIX_PATH=${PREFIX} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_BUILD_TYPE=Release \
-DSCOTCH_DIR=${PREFIX} \
-DPASTIX_ORDERING_SCOTCH=ON \
-DCMAKE_C_COMPILER=gcc13 \
-DCMAKE_CXX_COMPILER=g++13 \
-DCMAKE_Fortran_COMPILER=gfortran13 \
-DCMAKE_C_FLAGS='-fopenmp -lpciaccess -lm -Wno-unused-parameter' \
..
gmake -j4
gmake install
cd ../..
rm -rf pastix4calculix
This cmake call isn’t really an improvement over a standard Makefile, IMO.
On Windows, I just download the official binaries without compiling CalculiX myself.
But indeed, it would be great to have official building instructions for all systems and some tools to make compilation easier. Btw. FreeCAD has recently moved from CMake to Pixi and the compilation is really fast and easy now.
The issue you show with building a compatible PaStiX for CalculiX is orthogonal to improving build instructions and tooling for core CalculiX and we will address this specific issue in separation.