From 35e30c104533e11174a056707b4122a4e11be4fe Mon Sep 17 00:00:00 2001 From: PengZheng Date: Sat, 9 Mar 2024 17:45:57 +0800 Subject: [PATCH] Revert "Fix linker error caused by private linking of transitive dependencies." This reverts commit f75a41974cb53673d88592f8dacc2b3a7eb3022f. Revert "Fix copy error in generate method." This reverts commit 6f147b8b26c474544238a8e8a8f52fc7fb279bcb. Revert "Fix copy error in generate method." This reverts commit 1db9b858fe924e87e0290d812062636a14cd5c17. Revert "Add more tracing to CI." This reverts commit 3b12f3b6739770916f283a6f55262e10f44cdb58. Revert "Add more tracing to CI." This reverts commit 2d285da34979f75c7c4dbd8290d1d142b45ba604. Revert "Revert "Fix copy error in generate method."" This reverts commit 09cfcaee91894fc64965349f020f8f4ba6b7087f. Revert "Revert "Fix copy error in generate method."" This reverts commit 52eaaf835d74789ac062126271a86344101b7f1c. Revert "Fix assertion failure when dep.cpp_info.libdir is None." This reverts commit 4d831cc8562243fc1d5711eb9b06ca64e1dd94a8. Revert "Fix assertion failure when dep.cpp_info.libdir is None." This reverts commit fdf96fd138578576631473ecfbc710b335832b77. Revert "Fix broken test_package for conan1." This reverts commit acabf59ffab54eb49ddf14f3dd3b715bff1920d4. Revert "Copy dependent libraries in Pythonic way." This reverts commit 3bd54746b5c87f4793f57468c439e2c2258aedfd. --- conanfile.py | 8 +- examples/conan_test_package/conanfile.py | 89 +++++++++------------ examples/conan_test_package_v2/conanfile.py | 9 +-- 3 files changed, 46 insertions(+), 60 deletions(-) diff --git a/conanfile.py b/conanfile.py index a1653a98e..60e05f719 100644 --- a/conanfile.py +++ b/conanfile.py @@ -344,10 +344,10 @@ def generate(self): tc.cache_variables["CELIX_ERR_BUFFER_SIZE"] = str(self.options.celix_err_buffer_size) # tc.cache_variables["CMAKE_PROJECT_Celix_INCLUDE"] = os.path.join(self.build_folder, "conan_paths.cmake") # the following is workaround for https://github.com/conan-io/conan/issues/7192 - for dep in self.dependencies.host.values(): - for ld in dep.cpp_info.libdirs: - copy(self, "*", ld, os.path.join(self.build_folder, "lib")) - tc.cache_variables["CMAKE_BUILD_RPATH"] = os.path.join(self.build_folder, "lib") + if self.settings.os == "Linux": + tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,--unresolved-symbols=ignore-in-shared-libs" + elif self.settings.os == "Macos": + tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,-undefined -Wl,dynamic_lookup" v = Version(self.version) tc.cache_variables["CELIX_MAJOR"] = str(v.major.value) tc.cache_variables["CELIX_MINOR"] = str(v.minor.value) diff --git a/examples/conan_test_package/conanfile.py b/examples/conan_test_package/conanfile.py index c2c081d9e..c80070e3d 100644 --- a/examples/conan_test_package/conanfile.py +++ b/examples/conan_test_package/conanfile.py @@ -15,64 +15,51 @@ # specific language governing permissions and limitations # under the License. -from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import copy -from conans import tools +from conans import CMake, ConanFile, tools import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - test_type = "explicit" - - def layout(self): - cmake_layout(self) - - def requirements(self): - self.requires(self.tested_reference_str) - - def generate(self): - tc = CMakeToolchain(self) - tc.cache_variables["TEST_FRAMEWORK"] = self.options["celix"].build_framework - tc.cache_variables["TEST_HTTP_ADMIN"] = self.options["celix"].build_http_admin - tc.cache_variables["TEST_LOG_SERVICE"] = self.options["celix"].build_log_service - tc.cache_variables["TEST_SYSLOG_WRITER"] = self.options["celix"].build_syslog_writer - tc.cache_variables["TEST_RSA"] = self.options["celix"].build_remote_service_admin - tc.cache_variables["TEST_RSA_DFI"] = self.options["celix"].build_rsa_remote_service_admin_dfi - tc.cache_variables["TEST_RSA_SHM_V2"] = self.options["celix"].build_rsa_remote_service_admin_shm_v2 - tc.cache_variables["TEST_RSA_RPC_JSON"] = self.options["celix"].build_rsa_json_rpc - tc.cache_variables["TEST_RSA_DISCOVERY_CONFIGURED"] = self.options["celix"].build_rsa_discovery_configured - tc.cache_variables["TEST_RSA_DISCOVERY_ETCD"] = self.options["celix"].build_rsa_discovery_etcd - tc.cache_variables["TEST_RSA_DISCOVERY_ZEROCONF"] = self.options["celix"].build_rsa_discovery_zeroconf - tc.cache_variables["TEST_SHELL"] = self.options["celix"].build_shell - if self.options["celix"].build_shell: - tc.cache_variables["TEST_CXX_SHELL"] = self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14 - tc.cache_variables["TEST_REMOTE_SHELL"] = self.options["celix"].build_remote_shell - tc.cache_variables["TEST_SHELL_TUI"] = self.options["celix"].build_shell_tui - tc.cache_variables["TEST_SHELL_WUI"] = self.options["celix"].build_shell_wui - tc.cache_variables["TEST_ETCD_LIB"] = self.options["celix"].build_celix_etcdlib - tc.cache_variables["TEST_LAUNCHER"] = self.options["celix"].build_launcher - tc.cache_variables["TEST_PROMISES"] = self.options["celix"].build_promises - tc.cache_variables["TEST_PUSHSTREAMS"] = self.options["celix"].build_pushstreams - tc.cache_variables["TEST_LOG_HELPER"] = self.options["celix"].build_log_helper - tc.cache_variables["TEST_LOG_SERVICE_API"] = self.options["celix"].build_log_service_api - tc.cache_variables["TEST_CXX_REMOTE_SERVICE_ADMIN"] = self.options["celix"].build_cxx_remote_service_admin - tc.cache_variables["TEST_SHELL_API"] = self.options["celix"].build_shell_api - tc.cache_variables["TEST_CELIX_DFI"] = self.options["celix"].build_celix_dfi - tc.cache_variables["TEST_UTILS"] = self.options["celix"].build_utils - tc.cache_variables["TEST_COMPONENTS_READY_CHECK"] = self.options["celix"].build_components_ready_check - # the following is workaround https://github.com/conan-io/conan/issues/7192 - for dep in self.dependencies.host.values(): - for ld in dep.cpp_info.libdirs: - copy(self, "*", ld, os.path.join(self.build_folder, "lib")) - tc.cache_variables["CMAKE_BUILD_RPATH"] = os.path.join(self.build_folder, "lib") - tc.user_presets_path = False - tc.generate() + generators = "cmake_paths", "cmake_find_package" + # requires = "celix/2.3.0@docker/test" def build(self): cmake = CMake(self) + cmake.definitions["TEST_FRAMEWORK"] = self.options["celix"].build_framework + cmake.definitions["TEST_HTTP_ADMIN"] = self.options["celix"].build_http_admin + cmake.definitions["TEST_LOG_SERVICE"] = self.options["celix"].build_log_service + cmake.definitions["TEST_SYSLOG_WRITER"] = self.options["celix"].build_syslog_writer + cmake.definitions["TEST_RSA"] = self.options["celix"].build_remote_service_admin + cmake.definitions["TEST_RSA_DFI"] = self.options["celix"].build_rsa_remote_service_admin_dfi + cmake.definitions["TEST_RSA_SHM_V2"] = self.options["celix"].build_rsa_remote_service_admin_shm_v2 + cmake.definitions["TEST_RSA_RPC_JSON"] = self.options["celix"].build_rsa_json_rpc + cmake.definitions["TEST_RSA_DISCOVERY_CONFIGURED"] = self.options["celix"].build_rsa_discovery_configured + cmake.definitions["TEST_RSA_DISCOVERY_ETCD"] = self.options["celix"].build_rsa_discovery_etcd + cmake.definitions["TEST_RSA_DISCOVERY_ZEROCONF"] = self.options["celix"].build_rsa_discovery_zeroconf + cmake.definitions["TEST_SHELL"] = self.options["celix"].build_shell + if self.options["celix"].build_shell: + cmake.definitions["TEST_CXX_SHELL"] = self.options["celix"].celix_cxx17 or self.options["celix"].celix_cxx14 + cmake.definitions["TEST_REMOTE_SHELL"] = self.options["celix"].build_remote_shell + cmake.definitions["TEST_SHELL_TUI"] = self.options["celix"].build_shell_tui + cmake.definitions["TEST_SHELL_WUI"] = self.options["celix"].build_shell_wui + cmake.definitions["TEST_ETCD_LIB"] = self.options["celix"].build_celix_etcdlib + cmake.definitions["TEST_LAUNCHER"] = self.options["celix"].build_launcher + cmake.definitions["TEST_PROMISES"] = self.options["celix"].build_promises + cmake.definitions["TEST_PUSHSTREAMS"] = self.options["celix"].build_pushstreams + cmake.definitions["TEST_LOG_HELPER"] = self.options["celix"].build_log_helper + cmake.definitions["TEST_LOG_SERVICE_API"] = self.options["celix"].build_log_service_api + cmake.definitions["TEST_CXX_REMOTE_SERVICE_ADMIN"] = self.options["celix"].build_cxx_remote_service_admin + cmake.definitions["TEST_SHELL_API"] = self.options["celix"].build_shell_api + cmake.definitions["TEST_CELIX_DFI"] = self.options["celix"].build_celix_dfi + cmake.definitions["TEST_UTILS"] = self.options["celix"].build_utils + cmake.definitions["TEST_COMPONENTS_READY_CHECK"] = self.options["celix"].build_components_ready_check + cmake.definitions["CMAKE_PROJECT_test_package_INCLUDE"] = os.path.join(self.build_folder, "conan_paths.cmake") + # the following is workaround https://github.com/conan-io/conan/issues/7192 + if self.settings.os == "Linux": + cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,--unresolved-symbols=ignore-in-shared-libs" + elif self.settings.os == "Macos": + cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,-undefined -Wl,dynamic_lookup" cmake.configure() cmake.build() @@ -136,4 +123,4 @@ def test(self): self.run("./use_utils", run_environment=True) if self.options["celix"].build_components_ready_check: self.run("./use_components_ready_check", - cwd=os.path.join("deploy", "use_components_ready_check"), run_environment=True) \ No newline at end of file + cwd=os.path.join("deploy", "use_components_ready_check"), run_environment=True) diff --git a/examples/conan_test_package_v2/conanfile.py b/examples/conan_test_package_v2/conanfile.py index dce06ae12..3eaabd65b 100644 --- a/examples/conan_test_package_v2/conanfile.py +++ b/examples/conan_test_package_v2/conanfile.py @@ -19,7 +19,6 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.build import can_run from conan.tools.files import chdir -from conan.tools.files import copy import os @@ -66,10 +65,10 @@ def generate(self): tc.cache_variables["TEST_UTILS"] = celix_options.build_utils tc.cache_variables["TEST_COMPONENTS_READY_CHECK"] = celix_options.build_components_ready_check # the following is workaround https://github.com/conan-io/conan/issues/7192 - for dep in self.dependencies.host.values(): - for ld in dep.cpp_info.libdirs: - copy(self, "*", ld, os.path.join(self.build_folder, "lib")) - tc.cache_variables["CMAKE_BUILD_RPATH"] = os.path.join(self.build_folder, "lib") + if self.settings.os == "Linux": + tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,--unresolved-symbols=ignore-in-shared-libs" + elif self.settings.os == "Macos": + tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,-undefined -Wl,dynamic_lookup" tc.user_presets_path = False tc.generate()