SLS Exported VSCode Template Project - Runtime Error - dyld[92608]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2

What do you want to achieve?

I would like to be able to run the executable generated in the SLS VSCode Template project without this SDL2 Runtime error.

I have not changed anything in the template itself, just did the vscode export and have attempted to build and run.

$sqrline_cij_template_proj_vscode - ./build/SquareLine_Project_vscode
dyld[93399]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
  Referenced from: <CDB6704D-6A89-3999-8057-A97757B88BF9> /Users/ianlaue/prospr/sqrline_cij_template_proj_vscode/build/SquareLine_Project_vscode
  Reason: no LC_RPATH's found
zsh: abort      ./build/SquareLine_Project_vscode

What have you tried so far?

Searched through every single forum that had any error close to the one I have found (at least ~100).
Double checked my SDL2 install brew install sdl2.
Debugged the CMakeLists.txt to make sure the include DIRS for SDL2 were correct.
Did a clean build.

Screenshot or video

SDL is enabled in lv_conf.h

#ifndef USE_SDL
# define USE_SDL 	1

For the SDL drivers, I cloned the entire lv_drivers from the LVGL repo

git clone


  • SquareLine Studio version: 1.3.4
  • Operating system: MacOS Sonoma 14.2.1
  • Target hardware: Only simulation for now


I just noticed that the INFO button in the project settings config in SLS links to the lv_port_pc_eclipse so maybe vscode isn’t supported out of the box?

It seems there are several issues with the 1.0.1 VScode board-template: lv_drivers folder is not included and you need to copy/clone, as you mentioned. The other culprit might be the default lv_conf.h which has duplicate definitions of LV_LAYER_SIMPLE_BUF_SIZE and LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE and that throws a lot of warnings, you can simply delete or comment out the latter of those. I didn’t try on macOS but on Linux there is a problem (freezing due to missing lv_tick_inc() call that LV_CUSTOM_TICK is needed to be set to 1 and LV_TICK_CUSTOM_INCLUDE to be set "SDL2/SDL.h" and LV_TICK_CUSTOM_SYS_TIME_EXPR to be set to (SDL_GetTicks()) in order for the timed main loop to work. And many times runtime-freezes can be prevented even better by setting LV_MEM_CUSTOM to 1 too.
This is a kind of runtime problem but I’m not sure about your runtime problem. Maybe try to set the above mentioned stuff in lv_conf.h and give another try. The board-template files will have a major update/expansion soon on our GitHub repo, will have more, better and more up-to-date templates.
If not solved by the above, LC_RPATH has something to do with relative/absolute path of the SDL runtime library. Maybe you need to copy the SDL library beside your generated executable or do some macOS related path or environment-variable settings, just a quick search on LC_RPATH vs CMake:

One more thing: VScode has a good CMake integration so when asked it’s better to let CMake decide on the build-tools and not try an user guess first… (These CMake based VScode projects are typically buildable outside of VScode in plain commandline by ‘cmake’ and ‘make’ command.)

1 Like

First off, thank you for the detailed response! ~~ TLDR; I got it working!

Step #1

  • Made updates to lv_conf.h file
    • Set LV_CUSTOM_TICK == 1
    • LV_MEM_CUSTOM == 1

For a detailed view please use this git diff

This helped get rid of all/most warnings during the build.
This was required to get a working build with SDL2.

Step #2

  • Added the solution from CMake forum detailed above
    • In CMakeLists.txt added after add_executable and before target_link_libraries
set_target_properties(${PROJECT_NAME} PROPERTIES BUILD_RPATH "/Library/Frameworks/" )

From what I understand, this now sets @rpath == /Library/Frameworks/ which is then prepended to SDL2.framework/Headers which CMake knows exists because find_package(SDL2 REQUIRED SDL2).

Resulting in /Library/Frameworks/SDL2.framework/Headers

Step #3

Also, I can see how MacOS users can get frustrated after using the CMake config that is recommend by the SDL2 install and then getting this @rpath issue.

After I solved the @rpath issue, my OS gave me a warning pop-up “SDL2.framework” can’t be opened because Apple cannot check it for malicious software.

 sqrline_cij_template_proj_vscode/build ✝️ /sqrline_cij_template_proj_vscode/build/SquareLine_Project_vscode
 dyld[85576]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
  Referenced from: <D0D5E4A5-ECA0-30D5-BB60-EBAF588736C2> /sqrline_cij_template_proj_vscode/build/SquareLine_Project_vscode
  Reason: tried: '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (code signature in <B2708AD2-6DD5-3F10-A549-A747A6814A62> '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' not valid for use in process: library load disallowed by system policy), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file), '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (code signature in <B2708AD2-6DD5-3F10-A549-A747A6814A62> '/Library/Frameworks/SDL2.framework/Versions/A/SDL2' not valid for use in process: library load disallowed by system policy), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file)

I had to allow SDL2 to be used by via MacOS System Settings because it is not from an identified develop. I’m only allowed 2 links as a new user, so just google “stackoverflow how-do-i-override-the-malicious-software-check-for-the-sdl2-framework-on-mac”

1 Like