celix: celix_ShellCxx extraction error

Hi,

I don’t think this is related to #642 so I’m opening another issue.

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 (https://github.com/apache/celix/commit/e1d7fc1b544bc2c43cbcdb6b76f1b66fffccad96, 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 in my recipe:

  requires = (
        "celix/2.3.0",
    )

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

    def layout(self):
        cmake_layout(self)

    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:

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

# Patch mentioned in #642 
target_link_libraries(TestCelixContainer
    PRIVATE
        libzip::zip
)

When running the container in release, I get:

[2023-09-17T16:46:56] [  error] [celix_framework] [celix_framework_utils_extractBundlePath:217] No such file or directory(0x2): "Could not extract bundle zip file `bundles/celix_ShellCxx.zip` to `.cache/bundle1/resources`";
 Cause: No such file or directory
[2023-09-17T16:46:56] [  error] [celix_framework] [celix_bundleArchive_extractBundle:164] Failed to initialize archive. Failed to extract bundle zip to revision directory.
[2023-09-17T16:46:56] [  error] [celix_framework] [celix_bundleArchive_createCacheDirectory:198] Failed to initialize archive. Failed to extract bundle.
[2023-09-17T16:46:56] [  error] [celix_framework] [celix_bundleArchive_create:322] No such file or directory(0x2): "Could not create archive.";
 Cause: Failed to initialize archive or create manifest.
[2023-09-17T16:46:56] [  error] [celix_framework] [celix_bundleCache_createArchive:222] No such file or directory(0x2): Failed to create archive.
[2023-09-17T16:46:56] [  error] [celix_framework] [celix_framework_installBundleInternalImpl:686] No such file or directory(0x2): Could not install bundle
[2023-09-17T16:46:56] [  error] [celix_framework] [framework_autoInstallConfiguredBundlesForList:538] Could not install bundle from location 'celix_ShellCxx.zip'.
[2023-09-17T16:46:56] [  error] [celix_framework] [framework_start:471] Could not auto start or install all configured bundles
-> [2023-09-17T16:46:56] [   info] [celix_framework] [framework_start:476] Celix framework started
[2023-09-17T16:46:56] [   info] [celix_framework] Framework error event received -> registering framework.error condition service

In debug however, the container works like a charm. In can see no obvious difference between the release and debug folder. beside the fact that the bundles have a -Debug suffix. Even more puzzling to me, in the .cache or the release, I see a bundle2 folder, does that mean that the shell TUI bundle was extracted just fine?

Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hello,

I was able to track the problem in a RelWithDebInfo build. I did purge the whole Conan just in case (remove and cache clean to be safe) and re-exported Celix after pulling to get latest commits.

Celix commit:

3710082906a1847f0594729ccc247db7301aec13

Debug:

libs/utils/src/celix_file_utils.c:224 => celix_utils_writeOrCreateString returns ".cache/bundle1/resources/libShellCxx.so.2"
libs/utils/src/celix_file_utils.c:230 => the if is false, celix_utils_createDirectory is not called, no resources folder
libs/utils/src/celix_file_utils.c:234 => resources folder missing, fopen errors out


Note that it is working correctly for bundle 2 (TUI I believe). 
In bundle 2, ".cache/bundle2/resources/META-INF/" is the path returned by celix_utils_writeOrCreateString on the first iteration, which triggers the if and the folder creation.

Also, manually creating the resources folder in bundle 1 right before the fopen fixes the issue. 

Not sure why the order is different, but ensuring the destination folder is created first looks like it would fix the problem.

PS: I also added the CMake edits to the project.