Maven NAR插件:错误的链接库名称

时间:2015-12-22 14:12:12

标签: c++ maven linker-errors omniorb maven-nar-plugin

我第一次使用maven nar插件来编译C ++中反射的corba IDL文件。我通过使用exec插件和omniidl成功生成了存根和骨架,现在我在src /所有* .C和* .H文件下。

我们正在使用内部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.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

并且链接器尝试链接包含完整版本(依赖版本)的库名称

-lomniORB4-4.2.0-R1

我的问题如下:

  1. 我可以假设在包含共享对象的Nexus存储库中提供的omniORB4 NAR依赖项包含错误的.so名称吗?
  2. 有没有办法通过告诉NAR插件在链接器部分使用不同的库名来链接来解决它?
  3. 以下是配置NAR插件的pom部分:

     <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>
       ....
    

    感谢。

2 个答案:

答案 0 :(得分:0)

错误发生在依赖NAR内容中,这是错误的。

答案 1 :(得分:0)

在依赖项的pom.xml中使用libsName配置选项:

<configuration>
    <libsName>omniORB4</libsName>
    ...
</configuration>
  

libsName

     

此标记用于列出要包含在链接器中的多个库。   这在打包第三方库时非常有用。

     

使用CSV表示法:lib1,lib2

相关问题