Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] problem with collecting .so libs that have a . in the name #8109

Open
SimplyLiz opened this issue Nov 25, 2020 · 7 comments
Open
Assignees

Comments

@SimplyLiz
Copy link

SimplyLiz commented Nov 25, 2020

I'm using conan to collect libraries (.so) in a specific directory.
Edit: Since it's not obvious. I'm using cmake.

All libraries are found, but the ones that don't have a lib prefix AND a . in the name are not added correctly.
I get an linker error. You can see in the log below, that all libs have the full path appended, but those "special name" libs are added via -l and thus fail

is this a bug?

Idk if you need more information. those are just external libraries (not built by me) in directory and i use this in the conanfile packaging step:

        self.copy("*", "bin", "IOWA/SDK/bin/"
        self.cpp_info.libdirs = ["lib", "bin"]  # Default value is 'lib', we have so / dll files in bin
        self.cpp_info.libs = tools.collect_libs(self)

to gather those libraries and use them.
most start with lib and do not have dots in the name, but a few do...

[881/3885] Linking CXX shared library lib/libOaBasicsV40.so

FAILED: lib/libOaBasicsV40.so 

: && /usr/bin/c++ -fPIC -Wall -O3 -g -DNDEBUG   -shared -Wl,-soname,libOaBasicsV40.so -o lib/libOaBasicsV40.so Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OaBasics_NoPosix_autogen/mocs_compilation.cpp.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OaFileSystemWatcher.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/FileSystemWatcherQtImpl.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/GetTask.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/IOSUtil.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/Mutex.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OaNoPosix.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OaSharedLib.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OPCBrowser.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/OSInfo.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/ScopeMutex.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/SecureSocket.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/Socket.cxx.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/SslWrapper.cpp.o Libs/OaBasics/NoPosix/CMakeFiles/OaBasics_NoPosix.dir/Win32Utils.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/Adler32.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/CRC.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/Cipher.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/CryptoHash.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/HTTP.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/MsgBuffer.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/OaFileSys.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/OaResources.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/ServerSocket.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/OaConfigFile.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/OaStrUtil.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/TcpLineSocket.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/TcpSocket.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/TimeDiff.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/Timer.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/UdpSocket.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/LangIdConvertor.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/LangTextParser.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/SinglePeerConnConfig.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/PeerConnConfig.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/DistPeerConnConfig.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/VisibleDistSystemEntry.cxx.o Libs/OaBasics/Utilities/CMakeFiles/OaBasics_Utilities.dir/ReduPeerConnConfig.cxx.o Libs/OaBasics/Variables/CMakeFiles/OaBasics_Variables.dir/CmdHdlVar.cxx.o Libs/OaBasics/Variables/CMakeFiles/OaBasics_Variables.dir/ConnHdlVar.cxx.o Libs/OaBasics/Variables/CMakeFiles/OaBasics_Variables.dir/FileVar.cxx.o Libs/OaBasics/Variables/CMakeFiles/OaBasics_Variables.dir/IDispatchVar.cxx.o Libs/OaBasics/Variables/CMakeFiles/OaBasics_Variables.dir/RecHdlVar.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/ChallengeHandler.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/ChallengeHandlerList.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/ChallengeHandlerFactory.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/Crypto.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/CryptoQt.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/CryptoSslWrapper.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/Envelope.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/Key.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/KeySsl.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/KeyWinCertStore.cxx.o Libs/OaBasics/Crypto/CMakeFiles/OaBasics_Crypto.dir/Signature.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/Average0Accu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/Average1Accu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/AverageAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/BaseAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/CountAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/CountBitChangesAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/CyclicPG.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/DiffAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/EndValueAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/FloatingAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/Integral0Accu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/Integral1Accu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/IntermitCyclicPG.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/MaxAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/MaxTimeAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/MinAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/MinTimeAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/NextValidIntermitTime.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/NextValidListTime.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/NextValidTime.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/PeriodAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/SampleAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/SumAccu.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/SyncedCyclicPG.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/SyncedPG.cxx.o Libs/OaBasics/Accu/CMakeFiles/OaBasics_Accu.dir/TimeBitStateAccu.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/LanguageDefRec.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/LanguageFallbackTable.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/OaApplicationNames.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/OaLocale.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/OaLocaleImpl.cxx.o Libs/OaBasics/Core/CMakeFiles/OaBasics_Core.dir/OaStringToken.cxx.o  -Wl,-rpath,/work/WinCCOA/****/linux-debian-x86_64/****/ExternLibs/Qt4/lib:/root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin: ExternLibs/Qt4/lib/libQt5Core.so.5.15.1 ExternLibs/Qt4/lib/libQt5Network.so.5.15.1 -lz /root/.conan/data/openssl/1.1.1f/ETMConanRepo/stable/package/53e971e3e755dae548d0fd37209eb2f392b21992/lib/libcrypto.a /root/.conan/data/openssl/1.1.1f/ETMConanRepo/stable/package/53e971e3e755dae548d0fd37209eb2f392b21992/lib/libssl.a -ldl /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libCfCore.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libRTILtrace.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libStreamingFileTransfer.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILAggregationTimer.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILAlarmService.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILAuditService.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILAuditTrailPluginSQLite3.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILAuditTrailService.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILCDSService.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILComDrv.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILContextLogging.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILContextLoggingPluginSQLite.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILGIDSService.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILLoggingBase.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILLoggingConfiguration.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILOnlineBackup.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILPaHostV1.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILPaHostV2.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILPersistentBuffer.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILPmonClient.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILQueryFilterAssembly.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILRdfMerge.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILRdfMigration.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILRecurrenceCalculator.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILStandardAggregationPlugin.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILbasics.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILchromApi.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILclientSideLibrary.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILmanager.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILpersistency.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILpersistencyDataMan.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libWCCILresources.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libpq.so /root/.conan/data/iowa/5289_04.00.00.00_14.00.0001/ETMConanRepo/stable/package/6db3fd1a57086e2d41f7434cc560e2d180b4dbfc/bin/libpqxx.so -lhmitr.eapi.license -lhmitr.eapi.main -lhmitr.eapi.serverconfig -lhmitr.eapi.tracing -lhmitr.eapi.transfer -lhmitr.scs.common -lhmitr.scs.rt /root/.conan/data/openssl/1.1.1f/ETMConanRepo/stable/package/53e971e3e755dae548d0fd37209eb2f392b21992/lib/libcrypto.a && :

/usr/bin/ld: cannot find -lhmitr.eapi.license

/usr/bin/ld: cannot find -lhmitr.eapi.main

/usr/bin/ld: cannot find -lhmitr.eapi.serverconfig

/usr/bin/ld: cannot find -lhmitr.eapi.tracing

/usr/bin/ld: cannot find -lhmitr.eapi.transfer

/usr/bin/ld: cannot find -lhmitr.scs.common

/usr/bin/ld: cannot find -lhmitr.scs.rt```
@jgsogo
Copy link
Contributor

jgsogo commented Nov 26, 2020

Hi, @JimmySnails

The tool collect_libs might have it's limitations (and bugs). It uses the filesystem name to look for the libraries and it assumes that they follow some rules. It would be really hard (impossible) to match those unexpected names.

Nevertheless, you can list the libraries yourself, or you can combine both approaches if it is easier for you (libs is just a list):

self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.libs.extend(["name1", "name2", ])

And then there is another side of the same problem (not sure which one is bitting you): when Conan generates the FindXXXX.cmake (or -config ones depending on the generator you are using) that CMake will consume we are trying to find the libraries given the libdirs, if the libraries are found they get the full path, if they are not found then we consider them as system libraries. Check your CMake output, it should say something like "Library ${_LIBRARY_NAME} found ${CONAN_FOUND_LIBRARY}" or "Library ${_LIBRARY_NAME} not found in package, might be system one" for those libraries.

@jgsogo jgsogo self-assigned this Nov 26, 2020
@SimplyLiz
Copy link
Author

Thank you for your answer.

Just adding the libraries wasn't enough. they were still incorrectly added as "not found - system libs" via collect.
Now i use collect on windows and on linux i specify all libs manually, which works.

What makes me wonder, is the fact that the libs are found correctly on windows (same filename, .dll extension instead of .so). i think this is a bug in the collection mechanism.

@memsharded
Copy link
Member

Hi @SimplyLiz

Could you please list the exact filenames of the libraries (in the filesystem) you want to collect and what would be the expected result, that colllect_libs() should return? Also what it is returning right now, for comparison.
You can do:

libs = tools.collect_libs(self)
print("LIBS", libs)
self.cpp_info.libs = libs

@SimplyLiz
Copy link
Author

what would be the expected result, that colllect_libs() should return?
i think the result from the collect libs mechanism returns is correct, but something further down the road is unable to find the libraries in the found library path without the .so extension in the list. When i specify the libs manually, i have to add .so so it works.
I think the dots in the filename mess up something.

Please let me know if i can be of further assistance.

        if self.settings.os == "Windows":
            self.cpp_info.libs = tools.collect_libs(self)
        else:
            self.cpp_info.libs.extend(["RTILtrace", "StreamingFileTransfer", "WCCILAggregationTimer", "WCCILAlarmService", "WCCILAuditService", "WCCILAuditTrailPluginSQLite3", "WCCILAuditTrailService", "WCCILCDSService", "WCCILComDrv", "WCCILContextLogging", "WCCILContextLoggingPluginSQLite", "WCCILGIDSService", "WCCILLoggingBase", "WCCILLoggingConfiguration", "WCCILOnlineBackup", "WCCILPaHostV1", "WCCILPaHostV2", "WCCILPersistentBuffer", "WCCILPmonClient", "WCCILQueryFilterAssembly", "WCCILRdfMerge", "WCCILRdfMigration", "WCCILRecurrenceCalculator", "WCCILStandardAggregationPlugin", "WCCILbasics", "WCCILchromApi", "WCCILclientSideLibrary", "WCCILmanager", "WCCILpersistency", "WCCILpersistencyDataMan", "WCCILresources", "hmitr.eapi.license.so", "hmitr.eapi.main.so", "hmitr.eapi.serverconfig.so", "hmitr.eapi.tracing.so", "hmitr.eapi.transfer.so", "hmitr.scs.common.so", "hmitr.scs.rt.so"])

The output with the manually specified list:

LIBS ['RTILtrace', 'StreamingFileTransfer', 'WCCILAggregationTimer', 'WCCILAlarmService', 'WCCILAuditService', 'WCCILAuditTrailPluginSQLite3', 'WCCILAuditTrailService', 'WCCILCDSService', 'WCCILComDrv', 'WCCILContextLogging', 'WCCILContextLoggingPluginSQLite', 'WCCILGIDSService', 'WCCILLoggingBase', 'WCCILLoggingConfiguration', 'WCCILOnlineBackup', 'WCCILPaHostV1', 'WCCILPaHostV2', 'WCCILPersistentBuffer', 'WCCILPmonClient', 'WCCILQueryFilterAssembly', 'WCCILRdfMerge', 'WCCILRdfMigration', 'WCCILRecurrenceCalculator', 'WCCILStandardAggregationPlugin', 'WCCILbasics', 'WCCILchromApi', 'WCCILclientSideLibrary', 'WCCILmanager', 'WCCILpersistency', 'WCCILpersistencyDataMan', 'WCCILresources', 'hmitr.eapi.license.so', 'hmitr.eapi.main.so', 'hmitr.eapi.serverconfig.so', 'hmitr.eapi.tracing.so', 'hmitr.eapi.transfer.so', 'hmitr.scs.common.so', 'hmitr.scs.rt.so']

the collect output:

LIBS ['RTILtrace', 'StreamingFileTransfer', 'WCCILAggregationTimer', 'WCCILAlarmService', 'WCCILAuditService', 'WCCILAuditTrailPluginSQLite3', 'WCCILAuditTrailService', 'WCCILCDSService', 'WCCILComDrv', 'WCCILContextLogging', 'WCCILContextLoggingPluginSQLite', 'WCCILGIDSService', 'WCCILLoggingBase', 'WCCILLoggingConfiguration', 'WCCILOnlineBackup', 'WCCILPaHostV1', 'WCCILPaHostV2', 'WCCILPersistentBuffer', 'WCCILPmonClient', 'WCCILQueryFilterAssembly', 'WCCILRdfMerge', 'WCCILRdfMigration', 'WCCILRecurrenceCalculator', 'WCCILStandardAggregationPlugin', 'WCCILbasics', 'WCCILchromApi', 'WCCILclientSideLibrary', 'WCCILmanager', 'WCCILpersistency', 'WCCILpersistencyDataMan', 'WCCILresources', 'hmitr.eapi.license', 'hmitr.eapi.main', 'hmitr.eapi.serverconfig', 'hmitr.eapi.tracing', 'hmitr.eapi.transfer', 'hmitr.scs.common', 'hmitr.scs.rt']

The libraries:

-rw-rw-r--. 1 root root   202024 Nov 19 09:21 hmitr.eapi.license.so
-rw-rw-r--. 1 root root    20320 Nov 19 09:21 hmitr.eapi.main.so
-rw-rw-r--. 1 root root   645592 Nov 19 09:21 hmitr.eapi.serverconfig.so
-rwxr-xr-x. 1 root root    30824 Nov 19 09:21 hmitr.eapi.tracing.so
-rw-rw-r--. 1 root root   278752 Nov 19 09:21 hmitr.eapi.transfer.so
-rw-rw-r--. 1 root root  8059784 Nov 19 09:21 hmitr.scs.common.so
-rwxr-xr-x. 1 root root  1247368 Nov 19 09:21 hmitr.scs.rt.so

same filename on windows, but .dll instead of ,so and they're properly added on windows.

@memsharded
Copy link
Member

Hi @SimplyLiz

I am checking this behavior, and it seems conan is working consistently. These 2 tests pass:

    def test_collect_multiple_dots(self):
        conanfile = ConanFileMock()
        conanfile.package_folder = temp_folder()
        libs = ["hmitr.eapi.license.so", "hmitr.eapi.main.so"]
        for lib in libs:
            save(os.path.join(conanfile.package_folder, "lib", lib), "")
        conanfile.cpp_info = CppInfo("", "")
        result = conanfile.collect_libs()
        self.assertEqual(["hmitr.eapi.license", "hmitr.eapi.main"], result)

    def test_collect_multiple_dots_libs(self):
        conanfile = ConanFileMock()
        conanfile.package_folder = temp_folder()
        libs = ["hmitr.eapi.license.lib", "hmitr.eapi.main.lib"]
        for lib in libs:
            save( os.path.join(conanfile.package_folder, "lib", lib), "")
        conanfile.cpp_info = CppInfo("", "")
        result = conanfile.collect_libs()
        self.assertEqual(["hmitr.eapi.license", "hmitr.eapi.main"], result)

The problem here is the difference of the linker behavior for different compilers, I would say it is more of an issue or inconsistency in the gcc linker, that when it finds a name with dots, it assumes it already contains the extension. Seems that using dots in library names is really problematic.

I don't think we can change the collect_libs(), I would say it is too risky and would break other users, maybe using other toolchains.
If you want to use that function, and do not need to explicitly list the library names, I think the best approach (besides considering renaming those libraries to not use dots) would be something like:

libs = tools.collect_libs(self)
if self.settings.os == "Linux":  # Assuming shared libs in Linux
   libs = [("{}.so".format(lib) if "." in lib else lib) for lib in libs]
self.cpp_info.libs = libs

Please let me know if this helps.

@SimplyLiz
Copy link
Author

The problem here is the difference of the linker behavior for different compilers, I would say it is more of an issue or inconsistency in the gcc linker
oh! that explains it...

thank you, renaming isn't an option, it's a 3rd party component.
Your workaround is a nice idea and works in my case, but for other people it should also check .a libs and probably wouldn't work for a .so.x.x.x library....

i'll stick with your solution, it's perfect for my package.
what about checking in the collect tool if the found library name contains a dot and ends with .so or .so and dots/numbers?
I totally agree that using dots in library names isn't best practice and should be avoided.
maybe a note in the documentation will suffice?

thank you!

@memsharded
Copy link
Member

Your workaround is a nice idea and works in my case, but for other people it should also check .a libs and probably wouldn't work for a .so.x.x.x library....

Yes, we might try to improve this for Conan 2.0, it will be less risky to change behavior there.

what about checking in the collect tool if the found library name contains a dot and ends with .so or .so and dots/numbers?

Sure, this is what we would try in Conan 2.0, it might work, but we have already learned that this kind of change can also break other users in impossible to anticipate ways.

Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants