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

pkgconfig info missing? #31

Closed
francesco-ballarin opened this issue Feb 16, 2023 · 4 comments · Fixed by #33
Closed

pkgconfig info missing? #31

francesco-ballarin opened this issue Feb 16, 2023 · 4 comments · Fixed by #33

Comments

@francesco-ballarin
Copy link

Hi,
I am moving here the discussion from multiphenics/multiphenicsx@b80f047

It seems that conda packages do not ship pkgconfig info for dolfinx:

Python 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:27:40) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dolfinx.pkgconfig
>>> print(dolfinx.pkgconfig.exists("dolfinx"))
False
>>> print(dolfinx.pkgconfig.parse("dolfinx"))
{'define_macros': [], 'include_dirs': [], 'library_dirs': [], 'libraries': []}

When building from source, I get instead

Python 3.10.9 (main, Dec  7 2022, 13:47:07) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dolfinx.pkgconfig
>>> print(dolfinx.pkgconfig.exists("dolfinx"))
True
>>> print(dolfinx.pkgconfig.parse("dolfinx"))
{'define_macros': ['DOLFINX_VERSION=0.6.0.0', 'DOLFINX_VERSION=0.6.0.0', 'HAS_SLEPC', 'HAS_PTSCOTCH', 'HAS_PARMETIS', 'PKG_BASIX_DEFINITIONS-NOTFOUND'], 'include_dirs': ['/home/francesco/opt/personal/gnu/install/fenicsx/2023-02-10-bb7ac95c0f/petsc-2022-07-25-2c78e79264-3.17.3-real/include', '/home/francesco/opt/personal/gnu/install/slepc/2022-07-25-0ba3c7aea-3.17.1/petsc-2022-07-25-2c78e79264-3.17.3-real/include', '/usr/include/hdf5/openmpi', '/home/francesco/opt/personal/gnu/install/petsc/2022-07-25-2c78e79264-3.17.3/real/opt/include', '/home/francesco/opt/personal/gnu/install/fenicsx/2023-02-10-bb7ac95c0f/petsc-2022-07-25-2c78e79264-3.17.3-real/lib/python3.10/site-packages/ffcx/codegeneration'], 'library_dirs': ['/home/francesco/opt/personal/gnu/install/slepc/2022-07-25-0ba3c7aea-3.17.1/petsc-2022-07-25-2c78e79264-3.17.3-real/lib', '/home/francesco/opt/personal/gnu/install/petsc/2022-07-25-2c78e79264-3.17.3/real/opt/lib', '/home/francesco/opt/personal/gnu/install/fenicsx/2023-02-10-bb7ac95c0f/petsc-2022-07-25-2c78e79264-3.17.3-real/lib'], 'libraries': ['slepc', 'petsc', 'boost_timer', 'dolfinx']}

The file responsible for the compilation of the C++ backend in the multiphenicsx repo is
https://github.com/multiphenics/multiphenicsx/blob/b80f047c74827497ad6d1a689173d24e2e506974/multiphenicsx/cpp/compile_code.py
and I am actually surprised how multiphenicsx ever worked with dolfinx from conda, considering that without pkgconfig info multiphenicsx e.g. never links to petsc!
(my gut feeling is that, since multiphenicsx imports dolfinx and dolfinx imports dolfinx.cpp, then petsc and all other shared libraries are getting loaded by dolfinx.cpp in the python process, and this somehow defines symbols to be used afterwards also for multiphenicsx.cpp)

Please ping @hermanmakhm if tests on the actual conda environment need to be run, since I don't have access to it.

@francesco-ballarin
Copy link
Author

Hi @minrk,
I bump this issue, since we just had the same report at multiphenics/multiphenicsx#12.

Thanks!

@EvgeniyAzarov
Copy link

EvgeniyAzarov commented Jun 12, 2023

Hi @francesco-ballarin and @minrk ,
I ran into the same problem, and figured out that it can be easily solved with just installing pkg-config in the conda environment.
More precisely, in the environment with dolfinx run

conda install -c conda-forge pkg-config

Before the installation I had

$ pkg-config dolfinx --cflags
Package dolfinx was not found in the pkg-config search path.
Perhaps you should add the directory containing `dolfinx.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dolfinx' found

After installation:

$ pkg-config dolfinx --cflags
-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/fenics-dolfinx-split_1676643338970/work=/usr/local/src/conda/fenics-libdolfinx-0.6.0 -fdebug-prefix-map=/home/user/mambaforge/envs/fenicsx-env=/usr/local/src/conda-prefix -DDOLFINX_VERSION=\"0.6.0\" -DDOLFINX_VERSION=0.6.0 -DHAS_ADIOS2 -DHAS_SLEPC -DHAS_PARMETIS -DPKG_BASIX_DEFINITIONS-NOTFOUND -isystem /home/user/mambaforge/envs/fenicsx-env/include -I/home/user/mambaforge/envs/fenicsx-env/include -IPKGCONFIG_DOLFINX_INCLUDE_DIRECTORIES-NOTFOUND

Hope it helps

@minrk
Copy link
Member

minrk commented Jun 12, 2023

Nice, sounds like pkg-config should be a dependency of the dolfinx package.

@francesco-ballarin
Copy link
Author

Great, thanks @EvgeniyAzarov and @minrk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants