[CMake] Trouble with FindPNG module
I'm running CMake 3.8.0 on Ubuntu 14. I invoke the following: find_package(PNG REQUIRED) Which gives me the output in CMake: Could NOT find PNG (missing: PNG_LIBRARY) (found version "1.2.50") The CMakeCache.txt file has these variables set: PNG_LIBRARY_DEBUG:FILEPATH=PNG_LIBRARY_DEBUG-NOTFOUND PNG_LIBRARY_RELEASE:FILEPATH=PNG_LIBRARY_RELEASE-NOTFOUND PNG_PNG_INCLUDE_DIR:PATH=/usr/include So it found the headers, but not the libs. Why did it not find the libs? Note that my version of Ubuntu is 64-bit, and I've installed the 32-bit libs like so: $ sudo apt-get install libpng12-dev:i386 Would the find module be confused because it is trying to find the 64-bit library? What's the issue? -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl
after find_package is invoked, several variables will be set. You use these to augment your compiler and linker information, e.g.: target_include_directories(mytarget $ZLIB_INCLUDE_DIRS) target_link_libraries(mytarget $ZLIB_LIBRARIES) …and so on for other modules you find (OpenSSL, for example). You can also choose to add the include paths “globally” using include_directories(), but it’s usually considered best practice to modify individual target properties where possible. -Mike .. > On Apr 21, 2017, at 10:58 AM, Alex Chen wrote: > > Although cmake uses the path I supplied for OpenSSL and Zlib, I do not see > the –I flag being used in compiling the code. (I set VERBOSE=1 to make to see > what it does.) > When I run ‘ldd’ against the resulting .so files, reference to libssl.so or > libcrypto.so is empty, i.e ‘libssl.so => not found’, but libz.so still links > to /lib64/libz.so. (It seems to ignore the fact it does find a new path of > zlib.) > > How to I set the linker flag, i.e. –L and –Wl,-rpath=$myLibPath ? > > Alex Chen > > From: CMake on behalf of Alex Chen > > Date: Friday, April 21, 2017 at 10:28 AM > To: CMake > Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, > Zlib and libcurl > > Thanks for the help. I will try that. > > Alex Chen > > From: Michael Ellery > Date: Thursday, April 20, 2017 at 8:13 PM > To: Alex Chen > Cc: CMake > Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, > Zlib and libcurl > > It doesn’t look like that find module directly supports HINTS or PATHS, so > you can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH > (https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before > calling the curl finder. I think you can add to those variables whatever > paths are appropriate to search for CURL on your systems. > > -Mike > >> On Apr 20, 2017, at 6:06 PM, Alex Chen wrote: >> The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, >> and ‘FindCURL’ to resolve the paths of these libraries. >> However, I have newer version of these libraries in different locations. >> How to I override these to use my paths? >> I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, >> from FindZLIB module, to override the paths. >> But I cannot find anything in FindCURL module to override the path of >> libcurl. >> >> >> Alex Chen >> -- >> Powered by www.kitware.com >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake > > > -- Powered by www.kitware.com Please keep messages on-topic and check the > CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQKitware offers various > services to support the CMake community. For more information on each > offering, please visit: CMake Support: > http://cmake.org/cmake/help/support.html CMake Consulting: > http://cmake.org/cmake/help/consulting.html CMake Training Courses: > http://cmake.org/cmake/help/training.html Visit other Kitware open-source > projects at http://www.kitware.com/opensource/opensource.html Follow this > link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitw
Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl
Although cmake uses the path I supplied for OpenSSL and Zlib, I do not see the –I flag being used in compiling the code. (I set VERBOSE=1 to make to see what it does.) When I run ‘ldd’ against the resulting .so files, reference to libssl.so or libcrypto.so is empty, i.e ‘libssl.so => not found’, but libz.so still links to /lib64/libz.so. (It seems to ignore the fact it does find a new path of zlib.) How to I set the linker flag, i.e. –L and –Wl,-rpath=$myLibPath ? Alex Chen From: CMake on behalf of Alex Chen Date: Friday, April 21, 2017 at 10:28 AM To: CMake Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl Thanks for the help. I will try that. Alex Chen From: Michael Ellery Date: Thursday, April 20, 2017 at 8:13 PM To: Alex Chen Cc: CMake Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl It doesn’t look like that find module directly supports HINTS or PATHS, so you can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH (https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before calling the curl finder. I think you can add to those variables whatever paths are appropriate to search for CURL on your systems. -Mike On Apr 20, 2017, at 6:06 PM, Alex Chen wrote: The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, and ‘FindCURL’ to resolve the paths of these libraries. However, I have newer version of these libraries in different locations. How to I override these to use my paths? I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, from FindZLIB module, to override the paths. But I cannot find anything in FindCURL module to override the path of libcurl. Alex Chen -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] add_custom_command on test input files
Hello, for my project I have a sub dir with test case which feeds the tests '*.input' and allows to check to output '*.expected'. For documentation purpose, I have a python script which generates a TestMatrix.rst file. Using CMake I have: dir structure: $root/{src,include,utils,test} test/CMakeLists.txt project(test LANGUAGES CXX) ... set(TEST_MATRIX_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/../utils/gen_test_matrix.py) set(TEST_MATRIX_GENERATOR_TARGET ${CMAKE_CURRENT_SOURCE_DIR}/test_matrix.rst) file(GLOB_RECURSE TEST_CASE_FILES LIST_DIRECTORIES true "${CMAKE_CURRENT_SOURCE_DIR}/test_case/" "*.expected" ) add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${TEST_MATRIX_GENERATOR} ${CMAKE_CURRENT_SOURCE_DIR} > ${TEST_MATRIX_GENERATOR_TARGET} DEPENDS ${TEST_MATRIX_GENERATOR} ${TEST_CASE_FILES} BYPRODUCT ${TEST_MATRIX_GENERATOR_TARGET} COMMENT "Generate TestCase Matrix (RST)" ) set_source_files_properties( ${TEST_MATRIX_GENERATOR_TARGET} PROPERTIES GENERATED TRUE ) but I assume, this isn't clever since it doesn't depend on the test_case dirs/files as I've seen so far. Changes in these file doesn't trigger the generation process, removing the ${TEST_MATRIX_GENERATOR_TARGET} doesn't recreate it. How to get it working/generating on each changes (additions) of the files/dirs in test_case? Thanks, Olaf -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl
Thanks for the help. I will try that. Alex Chen From: Michael Ellery Date: Thursday, April 20, 2017 at 8:13 PM To: Alex Chen Cc: CMake Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl It doesn’t look like that find module directly supports HINTS or PATHS, so you can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH (https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before calling the curl finder. I think you can add to those variables whatever paths are appropriate to search for CURL on your systems. -Mike On Apr 20, 2017, at 6:06 PM, Alex Chen wrote: The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, and ‘FindCURL’ to resolve the paths of these libraries. However, I have newer version of these libraries in different locations. How to I override these to use my paths? I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, from FindZLIB module, to override the paths. But I cannot find anything in FindCURL module to override the path of libcurl. Alex Chen -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Need code review of my android toolchain file
Hi Robert, I would use file(TO_NATIVE_PATH "${_dir}" _dir) and file(TO_CMAKE_PATH "${_dir}" _dir) hope that helps, Cheers, Volker Am 21/04/2017 um 15:45 schrieb Robert Dailey: I guess the only feedback I really would like is if the path normalization I'm doing for CMAKE_ANDROID_NDK is necessary (converting backslashes to forward slashes). Will CMake translate the backslashes properly? Sometimes I use CMAKE_ANDROID_NDK in custom commands and custom targets to build absolute paths to items in the NDK. On Tue, Apr 18, 2017 at 9:45 PM, Robert Dailey wrote: I'm trying to follow best practices where I can, but the trouble is I'm not aware of any. So I want to post my android.toolchain.cmake file here, with the hope that I can get some pointers. The main thing I want to understand is when it is appropriate to require cache variables be set via command line argument (-D) or via the toolchain file itself. Here is what is in my toolchain right now: set(CMAKE_SYSTEM_NAME Android) set(CMAKE_SYSTEM_VERSION 15) # API level set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a) set(CMAKE_ANDROID_STL_TYPE c++_static) set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang) string(REGEX REPLACE "" "/" ndk_path "$ENV{ANDROID_NDK}") set(CMAKE_ANDROID_NDK ${ndk_path}) unset(ndk_path) My idea here is to provide a different toolchain file per specific NDK configuration. For example, I need to build my native libraries for both x86 and ARM platforms, so I would use 2 CMAKE_BINARY_DIR, each configured using a different toolchain: x86 would use "android.toolchain.x86.cmake" ARM would use "android.toolchain.arm.cmake" Something like that. Is this best practice? What other advice would you offer? Thanks in advance. -- Volker Enderlein Institut für Mechatronik e.V. Phone: +49 (0)371 531 19651 Reichenhainer Strasse 88 Fax: +49 (0)371 531 19699 D-09126 Chemnitz Mail: volker.enderl...@ifm-chemnitz.de www.ifm-chemnitz.de Vorstand: Prof. Dr.-Ing. Welf-Guntram Drossel (Vorsitz) Dipl.-Ing. Heiko Freudenberg (Geschäftsführer) Amtsgericht Chemnitz VR 713 Ust.-IdNr. DE 159285348 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] fftw library in cmake
Thanks Nils for the input . On Fri, Apr 21, 2017 at 7:19 PM, Nils Gladitz wrote: > On 04/21/2017 03:40 PM, aishwarya selvaraj wrote: > > add_library(fftw STATIC IMPORTED) > > [...] > > TARGET_LINK_LIBRARIES(prose fftw ) > > [...] > > make[2]: *** No rule to make target `fftw-NOTFOUND', needed by `prose'. > Stop. > > > You are creating an IMPORTED target "fftw" but you aren't populating its > IMPORTED_LOCATION [1] (or IMPORTED_LOCATION_ [2]) target property. > Without it CMake does not know what on disk library file to link to. > > You can set target properties with set_property() or > set_target_properties(). > > Nils > > [1] https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION.html > [2] https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_ > LOCATION_CONFIG.html > -- Regards, Aishwarya Selvaraj -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] fftw library in cmake
On 04/21/2017 03:40 PM, aishwarya selvaraj wrote: add_library(fftw STATIC IMPORTED) [...] TARGET_LINK_LIBRARIES(prose fftw ) [...] make[2]: *** No rule to make target `fftw-NOTFOUND', needed by `prose'. Stop. You are creating an IMPORTED target "fftw" but you aren't populating its IMPORTED_LOCATION [1] (or IMPORTED_LOCATION_ [2]) target property. Without it CMake does not know what on disk library file to link to. You can set target properties with set_property() or set_target_properties(). Nils [1] https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION.html [2] https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION_CONFIG.html -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Need code review of my android toolchain file
I guess the only feedback I really would like is if the path normalization I'm doing for CMAKE_ANDROID_NDK is necessary (converting backslashes to forward slashes). Will CMake translate the backslashes properly? Sometimes I use CMAKE_ANDROID_NDK in custom commands and custom targets to build absolute paths to items in the NDK. On Tue, Apr 18, 2017 at 9:45 PM, Robert Dailey wrote: > I'm trying to follow best practices where I can, but the trouble is > I'm not aware of any. So I want to post my android.toolchain.cmake > file here, with the hope that I can get some pointers. > > The main thing I want to understand is when it is appropriate to > require cache variables be set via command line argument (-D) or via > the toolchain file itself. Here is what is in my toolchain right now: > > > set(CMAKE_SYSTEM_NAME Android) > set(CMAKE_SYSTEM_VERSION 15) # API level > set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a) > set(CMAKE_ANDROID_STL_TYPE c++_static) > set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang) > > string(REGEX REPLACE "" "/" ndk_path "$ENV{ANDROID_NDK}") > set(CMAKE_ANDROID_NDK ${ndk_path}) > > unset(ndk_path) > > > > My idea here is to provide a different toolchain file per specific NDK > configuration. For example, I need to build my native libraries for > both x86 and ARM platforms, so I would use 2 CMAKE_BINARY_DIR, each > configured using a different toolchain: > > x86 would use "android.toolchain.x86.cmake" > ARM would use "android.toolchain.arm.cmake" > > Something like that. Is this best practice? What other advice would you offer? > > Thanks in advance. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] fftw library in cmake
Hi all , Below is my CMakelist.txt. I'm getting an error as mentioned below . I'm not to rectify it . Could anyone help me out here please ? CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(PROSE) ExternalProject_Add(project_fftw #GIT_REPOSITORY https://github.com/FFTW/fftw3 URL "http://www.fftw.org/fftw-3.3.2.tar.gz"; PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fftw CONFIGURE_COMMAND "" #--Build step- BUILD_COMMAND "" #--Install step--- UPDATE_COMMAND "" # Skip annoying updates for every build INSTALL_COMMAND "" ) include_directories(${CMAKE_CURRENT_BINARY_DIR}/fftw/src/project_fftw/api) ExternalProject_Get_Property(project_fftw install_dir) add_library(fftw STATIC IMPORTED) add_dependencies(fftw project_fftw) ADD_EXECUTABLE(prose ${PROJECT_SOURCE_DIR}/src/prose.cpp) TARGET_LINK_LIBRARIES(prose fftw ) ERROR: Scanning dependencies of target prose [100%] Building CXX object CMakeFiles/prose.dir/src/prose.cpp.o make[2]: *** No rule to make target `fftw-NOTFOUND', needed by `prose'. Stop. make[1]: *** [CMakeFiles/prose.dir/all] Error 2 make: *** [all] Error 2 Where Am I going wrong ? -- Regards, Aishwarya Selvaraj -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Prevent libraries from linking twice during LLVM build
Thanks a lot for the context Michael ! On Thu, 20 Apr 2017 at 22:03 Michael Kruse wrote: > The cmake mailing list may not have sufficient context, so let me add > some details. > > Polly is an extension library for LLVM. Both can be configured in > multiple configurations: > > LLVM can be > - A bunch of libLLVM*.a files > - A bunch of libLLVM*.so files > - A single libLLVM.so > > Polly can be > - LLVMPolly.so to be loaded dynamically into the LLVM host application > using an LD_PRELOAD-like mechanism (e.g. clang or opt) > - Linked directly into the LLVM host application (target_link_library) > - as dynamic library libPolly.so > - as static library libPolly.a > > and it should work with all combinations of these. > > The issue is not all host applications always have all LLVM components > linked into it. In the example below, there is the Julia compiler > which does not have the the NVPTX backend in it, but it is required by > (some configuration of) Polly. > > Hence if we have an LLVMPolly.so we don't know whether the host > program has the LLVMNVPTX* libraries in it. If we do not depend on > these libraries, the linker will complain about missing symbols if the > host doesn't have these either. If we do depend on these libraries, > and the host has them as well, we risk having the same library > multiple times in the address space (e.g. LLVMNVPTX* is statically > linked into libLLVM.so, but LLVMPolly.so contains them as well). > > This is not really a cmake-specific question, and the solution I > proposed to Sanjay to require the host application to have all > required components already linked into it. We can do this for clang, > opt (and bugpoint), but the Julia compiler guys do not like to depend > of the NVPTX backend, which they usually do not use. > > Michael > > > > 2017-04-20 17:56 GMT+02:00 Sanjay Srivallabh Singapuram > : > > Hello, > > > > I'm proposing a patch to the Polly/LLVM project that involves linking > > libPolly.a or libPolly.so to NVPTX back-end libraries. I'm currently > using, > > target_link_libraries(Polly > > LLVMNVPTXCodeGen > > LLVMNVPTXInfo > > LLVMNVPTXDesc > > LLVMNVPTXAsmPrinter > > ) > > > > The opt binary links to both Polly and NVPTX back-end libraries, > therefore > > including the back-end libraries twice which causes problems. Can linking > > the libraries as an INTERFACE to Polly solve the problem ? > > > > target_link_libraries(Polly INTERFACE > > LLVMNVPTXCodeGen > > LLVMNVPTXInfo > > LLVMNVPTXDesc > > LLVMNVPTXAsmPrinter > > ) > > > > Thank You, > > Sanjay > > > > -- > Tardyzentrismus verboten! > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake