Skip to content

pkgconfig files are missing in the built package #74

Closed

Description

@rgommers

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.

Activity

  1. mattip commented on May 18, 2022

    @mattip
    Collaborator

    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.

  2. rgommers commented on May 18, 2022

    @rgommers
    CollaboratorAuthor

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

  3. mattip commented on May 19, 2022

    @mattip
    Collaborator

    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.

  4. rgommers commented on May 19, 2022

    @rgommers
    CollaboratorAuthor

    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).

  5. mattip commented on May 19, 2022

    @mattip
    Collaborator

    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.

  6. eli-schwartz commented on May 19, 2022

    @eli-schwartz

    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.

  7. tylerjereddy commented on Jun 29, 2022

    @tylerjereddy
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions