jothepro / djinni-library-template

A template for a Djinni library that can be used in Java/Kotlin, ObjC/Swift and C#
https://jothepro.github.io/djinni-library-template/cpp/
MIT License
11 stars 1 forks source link

Conan Install issue #2

Open princegeovision opened 2 years ago

princegeovision commented 2 years ago

First of all, thank you for this template.

ERROR: Profile not found: debug

My Conan profile (default)

Configuration for profile default:

[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]
jothepro commented 2 years ago

Thx for giving the template a try! It's the result of a hobby project of mine and I'm sharing it with others to get feedback about what could be improved! So if anything seems unclear or broken to you, pls keep asking! 😊

To answer your question: My guess is that you don't have a debug profile defined.

You can create it by running conan profile new --detect debug. The new profile will be created in ~/.conan/profiles. You'll then need to adjust the build_type in the new profile to "Debug" like so: conan profile update settings.build_type=Debug debug.

This link might help you to understand how profiles in Conan work. There is also a section dedicated to the new profile:build and profile:host arguments.

If you are new to Conan I'd recommend you to get used to it in a more trivial setup for a few hours before getting your hands dirty on this repository. From my experience there is a lot things that can go wrong, especially once you are trying to add other dependencies. Getting everything right with all the cross-compiling to multiple different platforms is still causing me lot's of headaches, even after stabbing at it for about a year now. 🙈

princegeovision commented 2 years ago

Thank you for reply this detail information. I will looking into it.:smiley:

andr-ggn commented 8 months ago

Thank's for the project! I have a problem and it would be great if you can:


CMake Error at cmake/modules/djinni-cmake/Djinni.cmake:170 (file):
  file STRINGS file
  "/Users/_user_/security/djinni-library-template-test/build/lib/djinni-generated-files.txt"
  cannot be read.
Call Stack (most recent call first):
  lib/CMakeLists.txt:6 (add_djinni_library)

CMake Error at lib/CMakeLists.txt:15 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  MyDjinniLibraryCore

CMake Error at lib/CMakeLists.txt:22 (target_compile_features):
  Cannot specify compile features for target "MyDjinniLibraryCore" which is
  not built by this project.

-- [djinni] 
-- [djinni] Generating Gluecode for OBJC
CMake Error at cmake/modules/djinni-cmake/Djinni.cmake:170 (file):
  file STRINGS file
  "/Users/_user_/security/djinni-library-template-test/build/lib/platform/darwin/djinni-generated-files.txt"
  cannot be read.
Call Stack (most recent call first):
  lib/platform/darwin/CMakeLists.txt:11 (add_djinni_library)

CMake Error at lib/platform/darwin/CMakeLists.txt:18 (target_link_libraries):
  Cannot specify link libraries for target "MyDjinniLibrary" which is not
  built by this project.

-- Configuring incomplete, errors occurred!```

Happy New Year!
jothepro commented 8 months ago

Can you provide me all steps that you did until getting this error message?

djinni-generated-files.txt seems to be missing, which leads me to the assumption that Djinni might not be installed correctly or an error might have occurred during the code generation.

andr-ggn commented 8 months ago
  1. conan profile new --detect debug
  2. conan profile update settings.build_type=Debug debug
  3. conan install --profile:build=default --install-folder=build .
    
    Configuration (profile_host):
    [settings]
    arch=x86_64
    arch_build=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=14
    os=Macos
    os_build=Macos
    [options]
    [build_requires]
    [env]

Configuration (profile_build): [settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=apple-clang compiler.libcxx=libc++ compiler.version=14 os=Macos os_build=Macos [options] [build_requires] [env]

conanfile.py (my_djinni_library/2.0.0): Installing package Requirements catch2/2.13.4 from 'conancenter' - Cache Packages catch2/2.13.4:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache Build requirements djinni-generator/1.3.0 from 'conancenter' - Cache Build requirements packages djinni-generator/1.3.0:46f53f156846659bf39ad6675fa0ee8156e859fe - Cache

Installing (downloading, building) binaries... catch2/2.13.4: Already installed! djinni-generator/1.3.0: Already installed! conanfile.py (my_djinni_library/2.0.0): Applying build-requirement: djinni-generator/1.3.0 conanfile.py (my_djinni_library/2.0.0): Applying build-requirement: catch2/2.13.4 conanfile.py (my_djinni_library/2.0.0): Generator 'CMakeToolchain' calling 'generate()' conanfile.py (my_djinni_library/2.0.0): Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release' conanfile.py (my_djinni_library/2.0.0): If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/Users/qua5ar/AF/djinni-library-template/build/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release' conanfile.py (my_djinni_library/2.0.0): Generator 'CMakeDeps' calling 'generate()' conanfile.py (my_djinni_library/2.0.0): Generator txt created conanbuildinfo.txt conanfile.py (my_djinni_library/2.0.0): Aggregating env generators conanfile.py (my_djinni_library/2.0.0): Generated conaninfo.txt conanfile.py (my_djinni_library/2.0.0): Generated graphinfo

andr-ggn commented 8 months ago
  1. conan build --build-folder=build .
    
    Using lockfile: '/Users/qua5ar/AF/djinni-library-template/build/conan.lock'
    Using cached profile from lockfile
    conanfile.py (my_djinni_library/2.0.0): Calling build()
    conanfile.py (my_djinni_library/2.0.0): WARN: **** The 'from conans import CMake' helper is deprecated. Please update your code and remove it. ****
    -- [get_version] reading version from VERSION file
    -- [djinni] 
    -- [djinni] Generating Gluecode for CPP
    CMake Error at cmake/modules/djinni-cmake/Djinni.cmake:170 (file):
    file STRINGS file
    "/Users/qua5ar/AF/djinni-library-template/build/lib/djinni-generated-files.txt"
    cannot be read.
    Call Stack (most recent call first):
    lib/CMakeLists.txt:6 (add_djinni_library)

CMake Error at lib/CMakeLists.txt:15 (set_target_properties): set_target_properties Can not find target to add properties to: MyDjinniLibraryCore

CMake Error at lib/CMakeLists.txt:22 (target_compile_features): Cannot specify compile features for target "MyDjinniLibraryCore" which is not built by this project.



Q: Which module generates `djinni-generated-files.txt`? I don't have this file. Also tried on another laptop - same error..
andr-ggn commented 8 months ago

I think this line doesn't work for me: tool_requires = [ "djinni-generator/1.3.0" ]

jothepro commented 7 months ago

djinni-generated-files.txt is produced by djinni during code generation. It reports a list of code files that have been generated, so CMake can pick them up. The CMake configuration fails because it does not find the file and therefore cannot configure the target. Likely the source files have also not been generated because djinni-generator recipe failed to install djinni.

Did you install the Conan version specified in requirements.txt? It is very much possible that the djinni-generator Conan recipe is broken in later versions of Conan, and unfortunately it is not actively updated anymore.

FYI I am currently working on replacing djinni, djinni-library-template and djinni_build with a new project that unites everything in one neat Python tool: https://github.com/pydjinni/pydjinni It is still very WIP though, so I cannot (yet) recommend to use it.