Skip to content

pkgconfig files are missing in the built package #74

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

Closed
rgommers opened this issue May 17, 2022 · 7 comments · Fixed by #77
Closed

pkgconfig files are missing in the built package #74

rgommers opened this issue May 17, 2022 · 7 comments · Fixed by #77

Comments

@rgommers
Copy link
Collaborator

rgommers commented May 17, 2022

See scipy/scipy#16187 (comment) for more context. All development headers and CMake files are present, but .pc files are missing. We need those for building with Meson.

@mattip
Copy link
Collaborator

mattip commented May 18, 2022

It seems this might be solved by fixing #68 from this comment:

The other custom openblas build we have, in .github/workflows/windows.yml (built with the MinGW toolchain by Matthew) do include pkg-config files.

@rgommers
Copy link
Collaborator Author

That's a bigger lift though, and Windows-only. We need .pc files on all platforms.

@mattip mattip mentioned this issue May 19, 2022
@mattip
Copy link
Collaborator

mattip commented May 19, 2022

I made a PR to add pkgconfig files in #77. The file assumes the tarball will be unpacked into C:\opt on windows and /usr/local otherwise. We should document the need to set PKG_CONFIG_PATH. Also, local builds will prefer to set PKG_CONFIG_SYSROOT_DIR since they may not be able to unpack into those locations.

@rgommers
Copy link
Collaborator Author

Thanks @mattip!

We should document the need to set PKG_CONFIG_PATH. Also, local builds will prefer to set PKG_CONFIG_SYSROOT_DIR since they may not be able to unpack into those locations.

This is only relevant for SciPy at this point, I'm not sure that it needs documenting anywhere (aside from the CI files where it's used).

@mattip
Copy link
Collaborator

mattip commented May 19, 2022

Note #77 was missing the git config --global --add safe.directory '*' fix for the versions, so the first OpenBLAS tarballs with openblas.pc files are the v0.3.20 releases.

@eli-schwartz
Copy link

eli-schwartz commented May 19, 2022

The file assumes the tarball will be unpacked into C:\opt on windows and /usr/local otherwise. We should document the need to set PKG_CONFIG_PATH. Also, local builds will prefer to set PKG_CONFIG_SYSROOT_DIR since they may not be able to unpack into those locations.

https://github.com/xianyi/OpenBLAS/blob/0b678b19dc03f2a999d6e038814c4c50b9640a4e/Makefile.install#L152-L159

#Generating openblas.pc
	@echo Generating $(LIBSONAMEBASE).pc in "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)"
	@echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
	@echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
	@echo 'openblas_config= USE_64BITINT='$(USE_64BITINT) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
	@echo 'version='$(VERSION) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
	@echo 'extralib='$(PKG_EXTRALIB) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
	@cat openblas.pc.in >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"

This embeds OPENBLAS_LIBRARY_DIR and OPENBLAS_INCLUDE_DIR which don't have pkg-config ${prefix} relocation.

Meson in git master has built-in support for relocatable pkg-config files, which is how I know this is possible... I discussed it with the implementer and merged it.

Basically, assuming everything is in C:/opt/lib/pkgconfig and C:/opt/lib and C:/opt/include you want this

includedir=${prefix}/include
libdir=${prefix}/lib

So far pretty normal. The interesting thing is, what is prefix? Usually that is /usr/local or I guess C:/opt, but pkg-config has support for relocatable installs, which look like this instead:

prefix=${pcfiledir}/../..

This can then be extracted absolutely anywhere, and pkg-config will expand pcfiledir to the directory that the .pc file is in, which per the designated structure is in lib/pkgconfig relative to the extraction path, so two levels up from there is your relocatable prefix.

Supporting this here could be done either by reimplementing the openblas pkg-config file (or patching it at least), or else by working with openblas upstream to add an option for it. Unfortunately there is no good abstraction like the meson one. :( So it may be a bit messy to figure out exactly which path should be specified in every case.

@tylerjereddy
Copy link
Collaborator

When testing on some supercomputer hardware I had to manually edit the /usr/local pkgconf stuff to another path (b/c don't have root on the comp of course). This was pretty easy to do though.

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.

4 participants