Trying to install petsc and slepc with pamac

Hello,

I am trying to install petsc and slepc with pamac, but apparently my mpi compiler can’t be found. I do have mpicc installed (/usr/bin), but for some reason that doesn’t seem good enough. Unfortunately I am unable to edit the build files to point to the correct compiler with pamac. I find this behavior a bit odd:

sudo pamac build petsc
Warning: Building packages as dynamic user
Warning: Setting build directory to /var/cache/pamac
Preparing...
Cloning petsc build files...
Running as unit: run-p16669-i16969.service
fatal: not a git repository (or any parent up to mount point /var/cache/private)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Finished with result: exit-code
Main processes terminated with: code=exited, status=128/n/a
Service runtime: 41ms
CPU time consumed: 12ms
Memory peak: 1.9M (swap: 0B)
Running as unit: run-p16675-i16975.service
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 220ms
CPU time consumed: 179ms
Memory peak: 1.9M (swap: 0B)
Running as unit: run-p16681-i16981.service
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 346ms
CPU time consumed: 59ms
Memory peak: 4.7M (swap: 0B)
Generating petsc information...
Running as unit: run-p16695-i16995.service
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 1.111s
CPU time consumed: 1.288s
Memory peak: 7M (swap: 0B)
Checking petsc dependencies...
Resolving dependencies...
Checking inter-conflicts...

To build (1):
  petsc  3.22.3-1    AUR


Edit build files : [e] 
Apply transaction ? [e/y/N] 

When I press “e”, edit the compile flags and save the files the following happens:

Cloning petsc build files...
Running as unit: run-p18793-i19093.service
fatal: not a git repository (or any parent up to mount point /var/cache/private)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Finished with result: exit-code
Main processes terminated with: code=exited, status=128/n/a
Service runtime: 35ms
CPU time consumed: 9ms
Memory peak: 1.9M (swap: 0B)
Running as unit: run-p18799-i19099.service
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 47ms
CPU time consumed: 11ms
Memory peak: 1.9M (swap: 0B)
Running as unit: run-p18805-i19105.service
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 341ms
CPU time consumed: 61ms
Memory peak: 5.4M (swap: 0B)
Generating petsc information...
Running as unit: run-p18819-i19119.service
Finished with result: success
Main processes terminated with: code=exited, status=0/SUCCESS
Service runtime: 1.143s
CPU time consumed: 1.354s
Memory peak: 6.9M (swap: 0B)
Checking petsc dependencies...
Resolving dependencies...
Checking inter-conflicts...

To build (1):
  petsc  3.22.3-1    AUR


Edit build files : [e] 
Apply transaction ? [e/y/N] 

What am I missing here?

First of all, do not use sudo with pamac. It will prompt for privilege escalation when required.

petsc depends on openmpi that provides the mpicc binary. I had no issues building it in a clean chroot. There should be no issue unless you have something installed locally included in your $PATH.

However, slepc fails to build:

==> Making package: slepc 3.22.2-1 (Sat 15 Mar 2025 11:13:56 PM UTC)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading slepc-3.22.2.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1824k  100 1824k    0     0  1269k      0  0:00:01  0:00:01 --:--:-- 1269k
==> Validating source files with md5sums...
    slepc-3.22.2.tar.gz ... Passed
==> Extracting sources...
  -> Extracting slepc-3.22.2.tar.gz with bsdtar
==> Starting build()...
--with-clean --with-slepc4py=1
Checking environment... done
Checking PETSc installation... 
ERROR: Unable to link with PETSc
ERROR: See "installed-arch-linux2-c-debug/lib/slepc/conf/configure.log" file for details
configure.log
================================================================================
Starting Configure Run at Sat Mar 15 23:13:58 2025
Configure Options: --prefix=/build/slepc/pkg/slepc/opt/slepc/linux-c-opt --with-clean=1 --with-slepc4py=1
Working directory: /build/slepc/src/slepc-3.22.2
Python version:
3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128]
make: /usr/bin/make
PETSc source directory: /opt/petsc/linux-c-opt
PETSc install directory: /opt/petsc/linux-c-opt
PETSc version: 3.22.3
SLEPc source directory: /build/slepc/src/slepc-3.22.2
SLEPc install directory: /build/slepc/pkg/slepc/opt/slepc/linux-c-opt
SLEPc version: 3.22.2
Checking configure hashfile
No previous hashfile found
================================================================================
Checking PETSc installation...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Checking link with code:

#include "petscsnes.h"
int main() {
PetscErrorCode ierr; Vec v; Mat m; KSP k;
ierr = PetscInitializeNoArguments();
ierr = VecCreate(PETSC_COMM_WORLD,&v);
ierr = MatCreate(PETSC_COMM_WORLD,&m);
ierr = KSPCreate(PETSC_COMM_WORLD,&k);
(void)ierr;
return 0;
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Running command:
cd /tmp/slepc-m9p5ecce;/usr/bin/make checklink LINKFLAGS=""
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Output:
/usr/bin/mpicc -o checklink.o -c -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto -fPIC  -I/opt/petsc/linux-c-opt/include -I/usr/include/suitesparse -I/usr/include -I/usr/include/superlu    checklink.c
/usr/bin/mpicc -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto -fPIC  -o checklink checklink.o  -Wl,-rpath,/opt/petsc/linux-c-opt/lib -L/opt/petsc/linux-c-opt/lib -Wl,-rpath,/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1 -lpetsc -lspqr -lumfpack -lklu -lcholmod -lamd -lsuperlu -lfftw3_mpi -lfftw3 -llapack -lblas -lzfp -lnetcdf -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lm -lz -lgsl -lgslcblas -ljpeg -lyaml -lX11 -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath
/usr/bin/ld: cannot find -lX11: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [makefile:2: checklink] Error 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

ERROR: Unable to link with PETSc

No clue what’s going on there. Maybe check upstream issues.

1 Like

That did the trick - thank you!

Mod Edit: Removed random blockquote

You’re welcome.

:information_source: Keep in mind there is most likely a missing dependency since slepc failed to build in a clean chroot. Whatever it is (maybe libx11 related, see the ld error above) you already had whatever it is installed.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.