| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0013352 | CMake | CMake | public | 2012-06-26 14:52 | 2013-01-09 10:56 | ||||
| Reporter | Daniel Richard G. | ||||||||
| Assigned To | Brad King | ||||||||
| Priority | normal | Severity | major | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | PowerPC | OS | AIX | OS Version | 5.3 | ||||
| Product Version | CMake 2.8.8 | ||||||||
| Target Version | CMake 2.8.9 | Fixed in Version | CMake 2.8.9 | ||||||
| Summary | 0013352: Incorrect linking of shared-library dependencies on AIX with GNU compiler | ||||||||
| Description | This report is borne of this failing dashboard test: http://open.cdash.org/testDetails.php?test=150972101&build=2394658 [^] Some tinkering around in the test directory: cport@vibraslap:~/Dashboards/MyTests/CMake-build/Tests/CustomCommand/PerConfig> env OBJECT_MODE=32 /usr/bin/gcc -mminimal-toc -O0 CMakeFiles/perconfig.dir/perconfig.c.o -o ../bin/perconfig ../bin/libpcStatic.a ../bin/libpcShared.so -Wl,-blibpath:/home/cport/Dashboards/MyTests/CMake-build/Tests/CustomCommand/bin:/usr/lib:/lib cport@vibraslap:~/Dashboards/MyTests/CMake-build/Tests/CustomCommand/PerConfig> ldd ../bin/perconfig ../bin/perconfig needs: /usr/lib/libc.a(shr.o) ../bin/libpcShared.so /unix /usr/lib/libcrypt.a(shr.o) cport@vibraslap:~/Dashboards/MyTests/CMake-build/Tests/CustomCommand/PerConfig> ln -s ../bin/libpcShared.so . cport@vibraslap:~/Dashboards/MyTests/CMake-build/Tests/CustomCommand/PerConfig> env OBJECT_MODE=32 /usr/bin/gcc -mminimal-toc -O0 CMakeFiles/perconfig.dir/perconfig.c.o -o ../bin/perconfig ../bin/libpcStatic.a libpcShared.so -Wl,-blibpath:/home/cport/Dashboards/MyTests/CMake-build/Tests/CustomCommand/bin:/usr/lib:/lib cport@vibraslap:~/Dashboards/MyTests/CMake-build/Tests/CustomCommand/PerConfig> ldd ../bin/perconfig ../bin/perconfig needs: /usr/lib/libc.a(shr.o) /home/cport/Dashboards/MyTests/CMake-build/Tests/CustomCommand/bin/libpcShared.so /unix /usr/lib/libcrypt.a(shr.o) Notice how when the linker is given "../bin/libpcShared.so", it records exactly that in the executable's dependencies, and fails to find the library dependency. Only if I link in "libpcShared.so", without a path prefix, does the executable build correctly. Looking through the ld(1) man page, these bits appear relevant: Note: If you specify a shared object, or an archive file containing a shared object, with an absolute or relative path name, instead of with the -lName flag, the path name is included in the import file ID string in the loader section of the output file. You can override this behavior with the -bnoipath option. [...] noipath For shared objects listed on the command-line, rather than specified with the -l flag, use a null path component when listing the shared object in the loader section of the output file. A null path component is always used for shared objects specified with the -l flag. This option does not affect the specification of a path component by using a line beginning with #! in an import file. The default is the ipath option. Adding -Wl,-bnoipath allows the original link invocation to produce a correct binary. | ||||||||
| Tags | No tags attached. | ||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0030000) Brad King (manager) 2012-07-09 09:19 |
We already do this for the XL compiler: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmComputeLinkInformation.cxx;hb=v2.8.8#l38 [^] http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/AIX-XL.cmake;hb=v2.8.8 [^] |
|
(0030001) Brad King (manager) 2012-07-09 09:24 |
Try this patch:
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index 543f3e8..81ba365 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -21,5 +21,6 @@ set(__AIX_COMPILER_GNU 1)
macro(__aix_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
- set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-brtl,-bnoipath")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag
for exe link to use shared lib
endmacro()
|
|
(0030009) Daniel Richard G. (reporter) 2012-07-09 16:45 |
Yes, that allows the test to complete successfully. I've attached a patch (against git master) for this minor nit that came up elsewhere in the same test: ----8<---- [ 57%] Building C object CMakeFiles/CustomCommand.dir/generated.c.o [ 60%] Building C object CMakeFiles/CustomCommand.dir/gen_redirect.c.o Linking CXX executable bin/CustomCommand ld: 0711-224 WARNING: Duplicate symbol: .main ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. Target "CMakeFiles/CustomCommand.dir/build" is up to date. [ 60%] Built target CustomCommand ---->8---- |
|
(0030010) Brad King (manager) 2012-07-09 17:21 |
Thanks for testing. Applied: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=767a7ad9 [^] and your other suggestion: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d54618f3 [^] |
|
(0032034) Robert Maynard (manager) 2013-01-09 10:56 |
Closing resolved issues that have not been updated in more than 4 months. |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2012-06-26 14:52 | Daniel Richard G. | New Issue | |
| 2012-07-09 09:19 | Brad King | Note Added: 0030000 | |
| 2012-07-09 09:19 | Brad King | Status | new => acknowledged |
| 2012-07-09 09:19 | Brad King | Summary | Incorrect linking of shared-library dependencies on AIX => Incorrect linking of shared-library dependencies on AIX with GNU compiler |
| 2012-07-09 09:24 | Brad King | Note Added: 0030001 | |
| 2012-07-09 16:44 | Daniel Richard G. | File Added: CustomCommand-duplicate-main.patch | |
| 2012-07-09 16:45 | Daniel Richard G. | Note Added: 0030009 | |
| 2012-07-09 17:21 | Brad King | Note Added: 0030010 | |
| 2012-07-09 17:21 | Brad King | Assigned To | => Brad King |
| 2012-07-09 17:21 | Brad King | Status | acknowledged => resolved |
| 2012-07-09 17:21 | Brad King | Resolution | open => fixed |
| 2012-08-09 19:42 | David Cole | Fixed in Version | => CMake 2.8.9 |
| 2012-08-09 19:42 | David Cole | Target Version | => CMake 2.8.9 |
| 2013-01-09 10:56 | Robert Maynard | Note Added: 0032034 | |
| 2013-01-09 10:56 | Robert Maynard | Status | resolved => closed |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |