简体   繁体   中英

Create so instead of dylib using nar maven plugin

I now have pljava building on the Mac. pljava uses maven and the maven nar plugin for building. This maven nar build is currently creating a dylib instead of a .so. It looks like that postgres wants an .so instead. This is the output from turning postgres trace on:

2014-09-26 10:12:59 EDT STATEMENT:  CREATE FUNCTION sqlj.java_call_handler() RETURNS language_handler AS 'pljava' LANGUAGE C
2014-09-26 10:12:59 EDT DEBUG:  bind <unnamed> to <unnamed>
2014-09-26 10:12:59 EDT LOG:  execute <unnamed>: CREATE FUNCTION sqlj.java_call_handler() RETURNS language_handler AS 'pljava' LANGUAGE C
2014-09-26 10:12:59 EDT DEBUG:  ProcessUtility
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/lib/postgresql/pljava"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/lib/pljava"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/share/pljava/pljava"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/pljava"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/pljava"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/lib/postgresql/pljava.so"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/lib/pljava.so"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/PostgreSQL/9.1/share/pljava/pljava.so"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/pljava.so"
2014-09-26 10:12:59 EDT DEBUG:  find_in_dynamic_libpath: trying "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/pljava.so"
2014-09-26 10:12:59 EDT ERROR:  could not access file "pljava": No such file or directory

So my question is - how can I make maven nar output a .so file instead of a .dylib? If I use type "shared" a dylib is created, if I use type "plugin" a .bundle is created and if I use type "static" the link fails.

I solved my problem. Using type "plugin" creates the right type of file. Miles answer to this question helped me figure it out:

What are the differences between .so and .dylib on osx?

Mac OS recommends .bundle extension for loadable modules but ported applications (like PostgreSQL) still want to use .so. After I changed the file name to pljava.so, PostgreSQL was successfully able to load the module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM