Skip to content
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

JFLAGS is set to a system directory for build #38

Open
mbanck-ntap opened this issue May 21, 2024 · 1 comment
Open

JFLAGS is set to a system directory for build #38

mbanck-ntap opened this issue May 21, 2024 · 1 comment

Comments

@mbanck-ntap
Copy link

mbanck-ntap commented May 21, 2024

The JAVAFILES target builds a class file out of the java sources. However, it runs javac $(JFLAGS) ... , where JFLAGS is defined further up in the Makefile as -d $(pkglibdir). $(pkglibdir) is usually under /usr so not writable for a non-root user.

I think what is needed here is building the class file into a temporary build directory under the current (source) directory and then installing the class file into $pglibdir during make install.

Currently, the build fails with a cryptic error while writing JDBCUtils error that is not obviously due to permission problems:

javac -d /usr/lib/postgresql/16/lib /<<PKGBUILDDIR>>/JDBCUtils.java /<<PKGBUILDDIR>>/JDBCDriverLoader.java /<<PKGBUILDDIR>>/JDBCConnection.java /<<PKGBUILDDIR>>/resultSetInfo.java
/<<PKGBUILDDIR>>/JDBCUtils.java:29: error: error while writing JDBCUtils: /usr/lib/postgresql/16/lib/JDBCUtils.class
public class JDBCUtils {
       ^
Note: /<<PKGBUILDDIR>>/JDBCConnection.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
make[1]: *** [/<<PKGBUILDDIR>>/Makefile:37: JAVAFILES] Error 1
@mbanck-ntap
Copy link
Author

Actually, on further reflection, I don't think $pkglibdir is the right directory anyway. The PL/Java project installs its .jar into the $sharedir/extension directory, as jars (and Java classes) are platform-independent.

This way, one could also leave the installation to PGXS, i.e. build the .class files in the local directory and add them to DATA_built in the Makefile while also switching pkglibdir in PG_CPPFLAGS.

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

No branches or pull requests

1 participant