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

Conan V2 CMake dependencies #642

Closed
SkyWhiteEagle opened this issue Sep 17, 2023 · 3 comments · Fixed by #644
Closed

Conan V2 CMake dependencies #642

SkyWhiteEagle opened this issue Sep 17, 2023 · 3 comments · Fixed by #644

Comments

@SkyWhiteEagle
Copy link

Hi,

I am trying to make a project using Celix. I am using Conan V2 and CMake to build the project.

I locally exported the Conan recipe from the master branch (e1d7fc1, as far as I can tell, the previous release is not Conan V2 compatible) and required it in my consumer recipe. I set the following options:

    default_options = {
        "celix/*:build_framework": True,
        "celix/*:build_shell_tui": True,
        "celix/*:build_shell_wui": True,
    }

I have the following generators:

    def generate(self):
        # This generates "conan_toolchain.cmake" in self.generators_folder
        tc = CMakeToolchain(self)
        tc.generate()

        # This generates "foo-config.cmake" and "bar-config.cmake" in self.generators_folder
        deps = CMakeDeps(self)
        deps.generate()

In my CMake I have:

find_package(Celix)

add_celix_container(TestCelixContainer CXX
    BUNDLES
        Celix::ShellCxx
        Celix::shell_tui
)

Running CMake, I get the warning following warning, but the build files are written nonetheless.

CMake Warning at build/Debug/generators/libuuidTargets.cmake:25 (message):
  Target name 'LibUUID::LibUUID' already exists.

I then proceed to build and get warning: libzip.so.5, needed by followed by undefined from libzip.

Manually adding the following to the CMake fixes the issue:

find_package(libzip)

target_link_libraries(TestCelixContainer
    PRIVATE
        libzip::zip
)

I don't think this is the intended behavior, is there maybe a way for the Celix recipe or helper function to add the missing link?

@PengZheng
Copy link
Contributor

PengZheng commented Sep 18, 2023

It is a known Conan bug: conan-io/conan#7192
Note that libzip::zip is a private dependency of Celix::utils.

We also encountered this in Celix, so a workaround is adopted: https://github.com/apache/celix/blob/master/conanfile.py#L424-L428
This workaround only ignores this particular link time error. At runtime, dynamic loader should be able to find all dependencies.

@PengZheng
Copy link
Contributor

I'll close it now. If the issue remains, feel free to reopen it.

@SkyWhiteEagle
Copy link
Author

Thanks, not sure where GitHub notifications are going.

I think I'll keep the explicit link workaround for now since I understand it better. I looked around the documents file, seeing if I could add note just to find I had missed the already existing section. Sorry.

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

Successfully merging a pull request may close this issue.

2 participants