Task #5322
Build contrib modules
100%
Description
Building contrib modules fails with the following error message:
Building contrib make -f Makefile -j1 Makefile:5: ../src/Makefile.global: No such file or directory make: *** No rule to make target '../src/Makefile.global'. Stop. Command '['/bin/sh', '/tmp/tmpxgmn5skk', 'make', '-f', 'Makefile', '-j1']' returned non-zero exit status 2
The problem here seems to be that src/contrib/Makefile includes ../src/Makefile.global via a relative path and the snapcraft make plugin wasn't designed for this use case.
Our options are:
- either patch the source code or
- write a custom make plugin or
- report this as a bug to snapcraft developers
and then hope they fix it. The latter is ideal, though, because PostgreSQL may not be the only program that includes a Makefile in a Makefile.
Updated by Eugene Dubinin almost 8 years ago
- Assignee set to Eugene Dubinin
After some research, I have discovered that the root cause of the issue is not in the Snapcraft plugin limitations, but in the source tree being used.
Lets take a look at the contrib part of snapcraft.yaml:
contrib: plugin: make source: parts/postgresql/src/contrib/ after: - postgresql
It acquires its source code from the Postgresql part's src/contrib subdir. It is a part of the pristine source tree without any makefiles generated by Autotools.
The contrib source tree relies on the parent directory Makefile.global, which is not there since the contrib is being used as a root and does not have the correct parent directory structure.
But even if the path is adjusted to be one dir higher in the hierarchy (e.g. source: parts/postgresql/src/contrib/) this will not help either because the parent dir does not have Autotools-generated Makefile.global, but only the Makefile.global.in
Here is the adjusted contrib part:
contrib: plugin: make source: ./parts/postgresql/build source-subdir: contrib after: - postgresql
The idea is to steal the Autotools-processed/configured source tree from the postgres part, that's why the parts/postgresql/build subtree is being used
The source-subdir directive will tell the make plugin change the CWD to the contrib subdir before the build process starts
Hope this helps to solve the issue.
Updated by Ivan Lezhnjov almost 8 years ago
- Priority changed from Normal to High
- % Done changed from 0 to 90
This appears to work. I was able to compile all current major versions with proposed fix. I also tested a couple contrib modules with 9.3.15 and they seem to work.
Ivan
Updated by Ivan Lezhnjov almost 8 years ago
- Status changed from New to Resolved
- % Done changed from 90 to 100