Maven NAR插件:链接库名称错误 我首次使用Maven NAR插件编译C++中CORBA IDL文件的弹出。我使用exec插件和omnidl成功地生成了存根和骨架,现在我在src/下创建了所有的*.C和*.H文件
我们正在使用一个内部Nexus存储库来检索NAR依赖项,到目前为止,我成功地编译了所有的*.o文件。但是,链接器失败,并显示以下消息:Maven NAR插件:链接库名称错误 我首次使用Maven NAR插件编译C++中CORBA IDL文件的弹出。我使用exec插件和omnidl成功地生成了存根和骨架,现在我在src/下创建了所有的*.C和*.H文件,c++,maven,linker-errors,omniorb,maven-nar-plugin,C++,Maven,Linker Errors,Omniorb,Maven Nar Plugin,我们正在使用一个内部Nexus存储库来检索NAR依赖项,到目前为止,我成功地编译了所有的*.o文件。但是,链接器失败,并显示以下消息: [INFO] 21 files were compiled. [INFO] 21 files were compiled. [INFO] Linking... [INFO] Linking... [INFO] Starting link {4.8 -shared -L/home/dev/repos/idl/cpp-idl/bin/nar/omniORB4-4.2
[INFO] 21 files were compiled.
[INFO] 21 files were compiled.
[INFO] Linking...
[INFO] Linking...
[INFO] Starting link {4.8 -shared -L/home/dev/repos/idl/cpp-idl/bin/nar/omniORB4-4.2.0-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lomniORB4-4.2.0-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/omnithread-4.2.0-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lomnithread-4.2.0-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/c-2.19-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lc-2.19-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/m-2.19-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lm-2.19-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/stdc__plus__plus-4.8.3+r212056-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lstdc__plus__plus-4.8.3+r212056-R1 -fexceptions -lstdc++}
[INFO] Starting link {4.8 -shared -L/home/dev/repos/idl/cpp-idl/bin/nar/omniORB4-4.2.0-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lomniORB4-4.2.0-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/omnithread-4.2.0-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lomnithread-4.2.0-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/c-2.19-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lc-2.19-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/m-2.19-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lm-2.19-R1 -L/home/dev/repos/idl/cpp-idl/bin/nar/stdc__plus__plus-4.8.3+r212056-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared -lstdc__plus__plus-4.8.3+r212056-R1 -fexceptions -lstdc++}
[ERROR] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lomniORB4-4.2.0-R1
[ERROR] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lomnithread-4.2.0-R1
[ERROR] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lc-2.19-R1
[ERROR] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lm-2.19-R1
[ERROR] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lstdc__plus__plus-4.8.3+r212056-R1
[ERROR] collect2: error: ld returned 1 exit status
问题是,例如,文件夹
/home/dev/repos/idl/cpp-idl/bin/nar/omniORB4-4.2.0-R1-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared
包含以下共享对象:
libomniORB4.so libomniORB4.so.2 libomniORB4.so.2.0
并且链接器尝试根据包含完整版本(依赖项版本)的库名称进行链接
我的问题如下:
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<configuration>
<libraries>
<library>
<type>shared</type>
</library>
</libraries>
<cpp>
<name>g++</name>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<options>
<option>-g</option>
</options>
<includes>
<include>**/*.C</include>
</includes>
<includePaths>
<includePath>${project.basedir}/src</includePath>
</includePaths>
</cpp>
</configuration>
</plugin>
....
安装
com.github.maven-nar
nar maven插件
共享
g++
${project.basedir}/src
-g
**/*C
${project.basedir}/src
....
谢谢。错误出现在格式不正确的依赖项NAR内容中。使用依赖项的pom.xml中的
libsName
配置选项:
<configuration>
<libsName>omniORB4</libsName>
...
</configuration>
omniORB4
...
此标记用于列出要包含在链接器中的多个LIB。
这在打包第三方库时非常有用
使用CSV表示法:lib1、lib2
这实际上是自定义NAR Dependency中的一个错误。请关闭该问题或回答它(如果它有助于其他人)。这是一个多么详细的回答,它准确地解释了问题所在以及您如何解决问题。如果你甚至没有提供一个关于问题是如何解决的细节,就不要将你自己的“答案”标记为被接受的答案。这是垃圾。
<configuration>
<libsName>omniORB4</libsName>
...
</configuration>