Bug 247212 - net/openmpi: make pkgconfig files accessible
Summary: net/openmpi: make pkgconfig files accessible
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Danilo Egea Gondolfo
Keywords: easy, patch, patch-ready
Depends on:
Reported: 2020-06-12 21:08 UTC by Christoph Moench-Tegeder
Modified: 2020-06-26 07:20 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (danilo)

move openmpi pkgconfig files in standard location (1.72 KB, patch)
2020-06-12 21:08 UTC, Christoph Moench-Tegeder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Moench-Tegeder freebsd_committer 2020-06-12 21:08:06 UTC
Created attachment 215496 [details]
move openmpi pkgconfig files in standard location

currently (net/openmpi 4.3.0) the whole port, including pkgconfig (.pc) files, is installed under /usr/local/mpi/openmpi/. This makes the pkgconfig files (/usr/local/mpi/openmpi/libdata/pkgconfig/*.pc) hard to access (standard pkgconfig needs fiddling with environment variables, with cmake this feels hackish). As proof I present the ports which are not using pkgconfig but are passing openmpi libs and other paths as variables from the port Makefile.

By simply moving the .pc files to their standard location (/usr/local/libdata/pkgconfig/) correct usage of openmpi gets much easier. Attached patch fixes that, passes poudriere and the results have been verified against cad/freecad (I can drop the mpi path fiddling from freecad). Consumers of openmpi do not have to change right now - the actual openmpi software and locations haven't been changed.
Comment 1 alt2600 2020-06-15 23:16:23 UTC
I wonder if this explains issues I have with net/mpich seemingly conflicting with openmpi. I discovered FreeCAD was incorrectly linking to mpich, even though its build cmake log shows it found openmpi. I started checking my system and found nothing was dependent on openmpi, even though some should be.

$} pkg info -r mpich
        FreeCAD-0.18.4_9  ---> openmpi
        vtk8-8.2.0      ---> openmpi

I then noticed hypre has a knob to choose so I rebuilt it. and found it was linked to openmpi but tracked a dependency on mpich instead.

/usr/ports/science/hypre|$} ldd /usr/local/lib/libHYPRE.so
        liblapack.so.4 => /usr/local/lib/liblapack.so.4 (0x801600000)
        libblas.so.2 => /usr/local/lib/libblas.so.2 (0x801e16000)
        libm.so.5 => /lib/libm.so.5 (0x80066f000)
        libmpi.so.40 => /usr/local/mpi/openmpi/lib/libmpi.so.40 (0x802069000)
        libthr.so.3 => /lib/libthr.so.3 (0x8006a1000)
        libc.so.7 => /lib/libc.so.7 (0x80024a000)
        libgfortran.so.5 => /usr/local/lib/gcc9/libgfortran.so.5 (0x802400000)
        libquadmath.so.0 => /usr/local/lib/gcc9/libquadmath.so.0 (0x802891000)
        libopen-rte.so.40 => /usr/local/mpi/openmpi/lib/libopen-rte.so.40 (0x802ad7000)
        libopen-pal.so.40 => /usr/local/mpi/openmpi/lib/libopen-pal.so.40 (0x802d8b000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x8006cd000)
        libutil.so.9 => /lib/libutil.so.9 (0x8006d2000)
        libz.so.6 => /lib/libz.so.6 (0x8006e9000)
        libhwloc.so.5 => /usr/local/lib/libhwloc.so.5 (0x800703000)
        libevent-2.1.so.7 => /usr/local/lib/libevent-2.1.so.7 (0x800736000)
        libevent_pthreads-2.1.so.7 => /usr/local/lib/libevent_pthreads-2.1.so.7 (0x80078a000)
        libgcc_s.so.1 => /usr/local/lib/gcc9/libgcc_s.so.1 (0x803035000)
        libelf.so.2 => /lib/libelf.so.2 (0x80078f000)
        libpciaccess.so.0 => /usr/local/lib/libpciaccess.so.0 (0x8007a9000)
        libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x80140f000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x8007b3000)

/usr/ports/science/hypre|$} pkg info -dr mpich
Depends on     :
Required by    :
        hypre-2.19.0  ---> built with openmpi knob, unset mpich

I gave up and removed mpich and all things requiring costing me scilab, but freecad was more important to me. they do not play nice together, and something about them being installed breaks pkgng. I'm assuming this might be related to pkgconfig items in the bug. I just wanted to post my experience to document you cannot have mpich and openmpi on your system without very weird issues, most times mpich is what is linked, I guessed due to it being in the LDD path ahead of the openmpi prefix, but even when openmpi links pkgng cannot track it. as with hypre above. I'm hoping the pkgconfig files might help, id be willing to test if the patch is accepted.
Comment 2 Danilo Egea Gondolfo freebsd_committer 2020-06-16 17:56:46 UTC

I was resisting this change to be able to have multiple openmpi's versions installed. Also, to keep the consistency between all the installations (not have files in different locations for different versions).

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237750

Maybe it would be good to have just one OpenMPI in ports, but right now some ports don't build with net/openmpi, just with net/openmpi3. But they are not too many.

I'll consider doing this change during the week. I'm not sure, but maybe your patch breaks some consumers of net/openmpi. Did you check that?

Comment 3 Christoph Moench-Tegeder freebsd_committer 2020-06-17 21:13:18 UTC
(In reply to Danilo Egea Gondolfo from comment #2)
I didn't test all consumers of openmpi, but a "random sample" - they all passed poudriere without modifications. Further, I couldn't find (by grepping in Makefiles and patches) any port setting PKG_CONFIG_PATH or similar for openmpi, all those ports just inject the openmpi paths into CFLAGS/LDFLAGS (via environment, cmake options, patching Makefiles, etc). I think that somehow proves my point that having pkgconfig files outside their standard location is not that helpful :)

In the intermediate run, I'd argue for pushing everything from openmpi3 to openmpi: as of https://raw.githubusercontent.com/open-mpi/ompi/v3.1.x/NEWS "v3.1.7 will likely never be released.", marking openmpi3 more or less EOL.

And while we're at this: there's a openmpi 4.0.4 (June 10th) - upgrade for net/openmpi seems trivial; do you want me to prepare a patch?
Comment 4 Danilo Egea Gondolfo freebsd_committer 2020-06-17 21:19:32 UTC
I was working to move all the consumers to net/openmpi but 3 of them are not compiling:


But yeah, I still want to move all of them to net/openmpi.

I already have the version 4.0.4 in the patch I'll commit this week (hopefuly), thanks :)
Comment 5 commit-hook freebsd_committer 2020-06-26 07:18:19 UTC
A commit references this bug:

Author: danilo
Date: Fri Jun 26 07:17:46 UTC 2020
New revision: 540422
URL: https://svnweb.freebsd.org/changeset/ports/540422

  - Update to 4.0.4
  - Install .pc files to ${LOCALBASE} to simplify how consumers look for openmpi [1]

  PR:		247212
  Submitted by:	cmt [1]

Comment 6 Danilo Egea Gondolfo freebsd_committer 2020-06-26 07:20:06 UTC
Committed, thanks!