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

Macos Building failed #7047

Open
Nikotecnology opened this issue Dec 10, 2024 · 2 comments
Open

Macos Building failed #7047

Nikotecnology opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage

Comments

@Nikotecnology
Copy link

Bug Description

When trying to build an application on macos i get this error even on a fresh project:
dyld[5202]: Library not loaded: /Users/develop/CLionProjects/test/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib
Referenced from: <7A3BC1C3-8FD5-34D8-9C8F-CEB300D1A19F> /Users/develop/Downloads/slint-cpp-template-main/cmake-build-debug/my_application
Reason: tried: '/Users/develop/CLionProjects/test/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/develop/CLionProjects/test/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file), '/Users/develop/CLionProjects/test/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file)

Reproducible Code (if applicable)

CMAKE USED:
cmake_minimum_required(VERSION 3.21)
project(my_application LANGUAGES CXX)

find_package(Slint QUIET)
if (NOT Slint_FOUND)
  message("Slint could not be located in the CMake module search path. Downloading it from Git and building it locally")
  include(FetchContent)
  FetchContent_Declare(
    Slint
    GIT_REPOSITORY https://github.com/slint-ui/slint.git
    # `release/1` will auto-upgrade to the latest Slint >= 1.0.0 and < 2.0.0
    # `release/1.0` will auto-upgrade to the latest Slint >= 1.0.0 and < 1.1.0
    GIT_TAG release/1
    SOURCE_SUBDIR api/cpp
  )
  FetchContent_MakeAvailable(Slint)
endif (NOT Slint_FOUND)

add_executable(my_application src/main.cpp)
target_link_libraries(my_application PRIVATE Slint::Slint)
slint_target_sources(my_application ui/app-window.slint)
# On Windows, copy the Slint DLL next to the application binary so that it's found.
if (WIN32)
    add_custom_command(TARGET my_application POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:my_application> $<TARGET_FILE_DIR:my_application> COMMAND_EXPAND_LISTS)
endif()

Environment Details

  • Slint Version: 1.8.0
  • Platform/OS: Macos Squoia
  • Programming Language: C++
  • Backend/Renderer: Slint

Product Impact

No response

@Nikotecnology Nikotecnology added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Dec 10, 2024
@tronical
Copy link
Member

Hm, I can't reproduce that. Same macOS version here, Xcode 16.1.

Could you try the following?

  1. Clone https://github.com/slint-ui/slint-cpp-template
  2. cd slint-cpp-template
  3. cmake -B build
  4. cmake --build build
  5. ./build/my_application

Running otool -L ./build/my_application produces something like this for me:

./build/my_application:
	/Users/simon/src/slint-cpp-template/build/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

Could you try the same on your binary? (otool -L /Users/develop/Downloads/slint-cpp-template-main/cmake-build-debug/my_application)

@Nikotecnology
Copy link
Author

I tried all the two things here's the results:
❯ ./build/my_application
dyld[68818]: Library not loaded: /Users/sviluppo/CLionProjects/DigitalHMI/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib
Referenced from: <3A5CF3E0-3940-3D01-B833-A7ADC72D2674> /Users/sviluppo/CLionProjects/slint-cpp-template/build/my_application
Reason: tried: '/Users/sviluppo/CLionProjects/DigitalHMI/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sviluppo/CLionProjects/DigitalHMI/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file), '/Users/sviluppo/CLionProjects/DigitalHMI/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib' (no such file)
zsh: abort ./build/my_application

second command:
❯ otool -L /Users/sviluppo/Downloads/slint-cpp-template-main/cmake-build-debug/my_application
/Users/sviluppo/Downloads/slint-cpp-template-main/cmake-build-debug/my_application:
/Users/sviluppo/CLionProjects/DigitalHMI/cppbuild/./cargo/build/aarch64-apple-darwin/debug/deps/libslint_cpp.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1800.101.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage
Projects
None yet
Development

No branches or pull requests

2 participants