Skip to content

Fix errors when building an RPM #178

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

adrianreber
Copy link
Contributor

Building an RPM for OpenHPC of pnetcdf fails with:

+ /usr/lib/rpm/check-buildroot
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/bin/pnetcdf-config:prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/bin/pnetcdf-config:exec_prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/lib/pkgconfig/pnetcdf.pc:prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/lib/pkgconfig/pnetcdf.pc:exec_prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0 
Found '/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64' in installed files; aborting

The reason is that the variable DESTDIR is added to the path of the binary location. This is, however, wrong. DESTDIR is the directory where the files are installed but not where they are located in the final RPM.

Keeping DESTDIR for the file location is correct but not for the path where the files are located.

With this patch applied, it is possible to create an RPM without errors like above.

Building an RPM for OpenHPC of pnetcdf fails with:

```
+ /usr/lib/rpm/check-buildroot
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/bin/pnetcdf-config:prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/bin/pnetcdf-config:exec_prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/lib/pkgconfig/pnetcdf.pc:prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0/lib/pkgconfig/pnetcdf.pc:exec_prefix=/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64/opt/ohpc/pub/libs/gnu14/mvapich2/pnetcdf/1.14.0
Found '/home/ohpc/rpmbuild/BUILDROOT/pnetcdf-gnu14-mvapich2-ohpc-1.14.0-19999.ci.ohpc.x86_64' in installed files; aborting
```

The reason is that the variable DESTDIR is added to the path of the
binary location. This is, however, wrong. DESTDIR is the directory where
the files are installed but not where they are located in the final
RPM.

Keeping DESTDIR for the file location is correct but not for the path
where the files are located.

With this patch applied, it is possible to create an RPM without errors
like above.

Signed-off-by: Adrian Reber <[email protected]>
@adrianreber
Copy link
Contributor Author

Needed for openhpc/ohpc#2127

@wkliao wkliao force-pushed the 2025-04-27-DESTDIR branch from 22f4e34 to 71dacb8 Compare May 1, 2025 18:23
wkliao added 4 commits May 1, 2025 14:15
Revise to take one requires command-line argument and one optional:
prefix and DESTDIR.

Note command "make install prefix=/path/of/install DESTDIR=/path/to/dest"
does not install the library. It copies all install files into folder
"$DESTDIR/$prefix", so one can cd to $DESTDIR and pack the folder $prefix
there into a tar ball.
@wkliao wkliao force-pushed the 2025-04-27-DESTDIR branch from 71dacb8 to 816cb62 Compare May 1, 2025 19:15
@wkliao
Copy link
Member

wkliao commented May 1, 2025

Thanks.
I also added more fixes related to DESTDIR. Please give it try.
If they work fine with you, then I will merge this PR.

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 this pull request may close these issues.

2 participants