elf-audio / ofxCppSketch

cppsketch for openFrameworks - see here: https://github.com/elf-audio/cppsketch
BSD 3-Clause "New" or "Revised" License
23 stars 1 forks source link

Lazy Symbol Binding Failed Error on Build #2

Closed lisajamhoury closed 4 years ago

lisajamhoury commented 4 years ago

Thank you so much for this amazing addon! I am new to OF so this really helps in debugging and sketching more quickly.

I have it working with a simple sketch that just changes the bg color, but when I add the addon ofxassimpModelLoader I get the following error after the success loading message:

✅✅✅ Success loading ✅✅✅
Compile took 2451ms
dyld: lazy symbol binding failed: Symbol not found: __Z12ofBackgroundiiii
  Referenced from: /tmp/ofApp.dylib
  Expected in: flat namespace

dyld: Symbol not found: __Z12ofBackgroundiiii
  Referenced from: /tmp/ofApp.dylib
  Expected in: flat namespace

The names of the addons are in the addons.make file. Here's the full stack trace.

I'm running Catalina version 10.15.5 (19F101) and XCode Version 11.5 (11E608c).

mazbox commented 4 years ago

Hey Lisa

Sorry about that, thanks for reporting - I just noticed that if you turn off dead code stripping THEN use the project generator to add an addon, it will turn on the dead code stripping again (I guess because it's rewriting the xcode project) - so after adding ofxAssimpModelLoader, you will probably have to turn it on again. I've now updated the README to reflect that, thanks!

Also, there was a bug in ofxCppSketch specifically to do with ofxAssimpModelLoader to do with it not liking templates (I don't really understand what the problem was, but I seem to have fixed it somehow) - I've commmited that now, so please update ofxCppSketch also.

Please let me know if it works for you!

lisajamhoury commented 4 years ago

Yes it's working! Thanks so much.

mazbox commented 4 years ago

Ah great! Please let me know if you find any other problems.

lisajamhoury commented 4 years ago

I was just looking at this with @ofZach and we realized that the addon only works at a specific folder height. It works perfectly when the new project is created at apps/myApps/myProject. If the project is created at apps/myApps/aFolder/myProject I get the following error:

2020-07-22 10:40:33.316854-0500 cppSketchTest1Debug[8235:331481] Metal API Validation Enabled
Couldn't open dir
No such file or directory
ofxCppSketch
Couldn't open dir
No such file or directory
Precompiling headers: g++ -std=c++11 -x c++-header -stdlib=libc++  -I/Users/lisajamhoury/sites/of_v0.11.0_osx_release/apps/rtp_homework/09_final/cppSketchTest1/../../../libs/openFrameworks  -I/Users/lisajamhoury/sites/of_v0.11.0_osx_release/apps/rtp_homework/09_final/cppSketchTest1/../../../libs/rtAudio/include 

I think this is user error on my part because it is standard to have projects at apps/myApps/ level, but @ofZach thought that there may also be a path name hardcoded somewhere that could be causing the error.

Thanks again!

mazbox commented 4 years ago

Ah, yeah, I assumed that it would be in the standard folder, and hardcoded it (in the bottom of ofxCppSketch.h), but I just updated the repo to allow you to add a line in your Project.xcconfig so that the build process can tell ofxCppSketch where to find it automatically - basically, just put

GCC_PREPROCESSOR_DEFINITIONS = OF_ROOT=\"$(OF_PATH)\"

at the bottom of your Project.xcconfig - you will need to update your copy of ofxCppSketch for this to work.

Please let me know if it works for you.

lisajamhoury commented 4 years ago

Works perfectly. Thank you!