-
Notifications
You must be signed in to change notification settings - Fork 947
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] Packaging NuttX libs with circular dependencies #16283
Comments
Should I combine all of the NuttX static libs into one static lib? |
I tried modifying the components example as follows: diff --git a/examples/conanfile/package_info/components/test_package/CMakeLists.txt b/examples/conanfile/package_info/components/test_package/CMakeLists.txt
index 9863ebf..dd7b2f0 100644
--- a/examples/conanfile/package_info/components/test_package/CMakeLists.txt
+++ b/examples/conanfile/package_info/components/test_package/CMakeLists.txt
@@ -5,7 +5,11 @@ find_package(game-engine REQUIRED COMPONENTS algorithms network ai rendering)
add_executable(example src/example.cpp)
-target_link_libraries(example algorithms
- network
- ai
- rendering)
+target_link_libraries(example
+ -Wl,--start-group
+ algorithms
+ network
+ ai
+ rendering
+ -Wl,--end-group
+)
diff --git a/examples/conanfile/package_info/components/test_package/conanfile.py b/examples/conanfile/package_info/components/test_package/conanfile.py
index c0cd8d4..fba39a2 100644
--- a/examples/conanfile/package_info/components/test_package/conanfile.py
+++ b/examples/conanfile/package_info/components/test_package/conanfile.py
@@ -20,7 +20,7 @@ class game_engineTestConan(ConanFile):
def build(self):
cmake = CMake(self)
cmake.configure()
- cmake.build()
+ cmake.build(cli_args=["-v"])
def layout(self):
cmake_layout(self) This is the resulting link behaviour in the ...
[100%] Linking CXX executable example
/usr/bin/cmake -E cmake_link_script CMakeFiles/example.dir/link.txt --verbose=1
/usr/bin/c++ -m64 -O3 -DNDEBUG -m64 CMakeFiles/example.dir/src/example.cpp.o -o example -L/home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib -Wl,-rpath,/home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib -Wl,--start-group -Wl,--end-group /home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib/libnetwork.a /home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib/libai.a /home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib/librendering.a /home/sstel/.conan2/p/b/game-b7d96689c1423/p/lib/libalgorithms.a
... As you can see, the link group |
Solved with an alternative approach in #16340. |
Hi @sastel Sorry this wasn't responded back then, though we try our best to support quickly, the activity in the multiple repos can be too high and some tickets might fall through the cracks. Don't hesitate to ping or comment in the threads as necessary to resurface the tickets in our inboxes. Many thanks! |
@memsharded no worries. Next time I'll ping. 😄 |
See also: #6530 |
What is your question?
Hi! I have a question about the recommended way to deal with a set of imported CMake libs with circular dependencies in Conan. I'm building the NuttX project as a set of lib*.a files using NuttX makefiles, then treating them as imported targets in cmake. It appears that when you do this in NuttX you have to link your executable with the
--start-group, --end-group
flags around the set of libs to resolve all of the circular dependencies. This is how the NuttXmake export
target is used in an example in the documentation, and is also how the PX4 project links the NuttX libs.I haven't been able to figure out how to get a consuming package to link my package (
nuttxbsp::nuttxbsp
) such that the NuttX libs are inside a link group. The code below shows my workaround, which was to place the list of libs in the exelinkflags.This workaround is no good, because any lib that depends on the NuttX libs also needs to be part of the link group or be set in front of the link group in the linker command. I haven't been able to figure out how to get Conan to put the link group last in the linker command.
The
package_info
method from my NuttX packageconanfile.py
:What is the recommended way to solve this problem?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: