使用nar maven插件创建so而不是dylib

时间:2014-09-26 15:26:57

标签: c macos maven maven-nar-plugin pljava

我现在在Mac上安装了pljava。 pljava使用maven和maven nar插件进行构建。这个maven nar build目前正在创建一个dylib而不是.so。看起来postgres想要一个.so。这是转向postgres跟踪的输出:

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

所以我的问题是 - 如何让maven nar输出.so文件而不是.dylib?如果我使用“共享”类型,则会创建一个dylib,如果我使用“plugin”类型,则会创建.bundle,如果我使用“static”类型,则链接将失败。

1 个答案:

答案 0 :(得分:1)

我解决了我的问题。使用type&#34;插件&#34;创建正确类型的文件。迈尔斯对这个问题的回答帮助我弄明白了:

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

Mac OS建议.bundle扩展用于可加载模块,但移植的应用程序(如PostgreSQL)仍然希望使用.so。在我将文件名更改为pljava.so后,PostgreSQL成功加载了模块。