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

Make build issues #32

Open
bangnoise opened this issue Jul 13, 2016 · 17 comments
Open

Make build issues #32

bangnoise opened this issue Jul 13, 2016 · 17 comments
Assignees

Comments

@bangnoise
Copy link
Collaborator

ofxSyphon source isn't being compiled for Makefile builds

Running make in example-Basic gives (shortened):

HOST_OS=Darwin
Compiling OF library for Release
HOST_OS=Darwin
HOST_OS=Darwin
HOST_OS=Darwin
Done!


Compiling example-Basic for Release
HOST_OS=Darwin
cat: obj/osx/Release/.compiler_flags: No such file or directory
Compiling /Users/tom/Development/OpenFrameworks/of_v0.9.3_osx_release/addons/ofxSyphon/example-Basic/src/main.cpp
...
Compiling /Users/tom/Development/OpenFrameworks/of_v0.9.3_osx_release/addons/ofxSyphon/example-Basic/src/ofApp.cpp
...
Linking bin/example-Basic for osx
...
Undefined symbols for architecture x86_64:
  "ofxSyphonClient::set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonClient::draw(float, float)", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonClient::setup()", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonClient::ofxSyphonClient()", referenced from:
      _main in main.o
  "ofxSyphonClient::~ofxSyphonClient()", referenced from:
      ofApp::~ofApp() in ofApp.o
      ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
  "ofxSyphonServer::publishScreen()", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonServer::publishTexture(ofTexture*)", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonServer::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonServer::ofxSyphonServer()", referenced from:
      _main in main.o
  "ofxSyphonServer::~ofxSyphonServer()", referenced from:
      _main in main.o
      ofApp::~ofApp() in ofApp.o
      ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
  "_glutDragEventFunc", referenced from:
      ofAppGlutWindow::setup(ofGLWindowSettings const&) in libopenFrameworks.a(ofAppGlutWindow.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/example-Basic] Error 1
make: *** [Release] Error 2
@bangnoise
Copy link
Collaborator Author

@arturoc I wonder if you could comment on how this ought to work. I thought files in addons/ofxSyphon/src should be compiled automatically..?

@bangnoise bangnoise self-assigned this Jul 13, 2016
@bangnoise
Copy link
Collaborator Author

Possibly because files are .mm (Objective C++) rather than .cpp.

@samkuhn
Copy link

samkuhn commented Jul 29, 2016

I'm also having the same issue and no luck finding a solution so far..
please god don't make me have to open xcode! ;)

@jeraman
Copy link

jeraman commented Jun 9, 2017

I was able to partially compile the file using:

make LDFLAGS="-arch i386"

However, the resulting binary doesn't run and no frameworks are linked it. Tried to manually link Syphon framework (as well as all others required by OF) using LDFLAGS, with no success so far.

Would anyone have a direction on how to solve this issue?

@ThomasLengeling
Copy link

@jeraman I just compiled the project code, I didn't add that flag.

But I did change the the ofMain to this:

int main( ){    
    ofSetupOpenGL(640, 360, OF_WINDOW); 
    ofRunApp( new ofApp());
}

If you create a new project with the addon, make sure you copy the Syphon.framework to the project and to the bin directory

@jeraman
Copy link

jeraman commented Jun 26, 2017

Thanks for the update, @ThomasLengeling!

I tried your suggestion but the problem persists. Maybe I'm missing something?

What OS X version are you on? And what oF version are you using?

@ThomasLengeling
Copy link

I'ma using the GitHub release, and mac osx 10.12, what is your error output?

@jeraman
Copy link

jeraman commented Jun 26, 2017

Thanks for the info! I'm on OS X 10.11.6 and oF 0.9.8. I'll try to test in a setup similar to yours to see what happens.

My output is exactly the same as the one posted by @bangnoise:

Undefined symbols for architecture x86_64:
  "ofxSyphonClient::set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonClient::draw(float, float)", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonClient::setup()", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonClient::ofxSyphonClient()", referenced from:
      _main in main.o
  "ofxSyphonClient::~ofxSyphonClient()", referenced from:
      ofApp::~ofApp() in ofApp.o
      ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
  "ofxSyphonServer::publishScreen()", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonServer::publishTexture(ofTexture*)", referenced from:
      ofApp::draw() in ofApp.o
  "ofxSyphonServer::setName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      ofApp::setup() in ofApp.o
  "ofxSyphonServer::ofxSyphonServer()", referenced from:
      _main in main.o
  "ofxSyphonServer::~ofxSyphonServer()", referenced from:
      _main in main.o
      ofApp::~ofApp() in ofApp.o
      ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
      non-virtual thunk to ofApp::~ofApp() in ofApp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/example-Basic] Error 1
make: *** [Release] Error 2

@ThomasLengeling
Copy link

strange, make sure the .framework is linked to the project. I what I did, I created a new project with the projectGenerator and then included the .framework to the Xcode project, change the ofmain.cpp and included the .framework to the project bin directory. Hope that helps
Thomas

@jeraman
Copy link

jeraman commented Jun 26, 2017

included the .framework to the Xcode project

Oh, but the basic example compiles fine inside XCode, this is not my issue.

The issue appears when I'm compiling it without XCode, by using a makefile.

Is this what you're able to do?

@timredfern
Copy link

I managed to get a Makefile build with ofxSyphon

I had to change the extension of the .m and .mm files in ofxSyphon/src and ofxSyphon/libs/Syphon/src and to .cpp - I can't work out why $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk isn't picking up the m's

I copied the Syphon framework into /Frameworks in my project and then added

PROJECT_LDFLAGS = -FFrameworks -framework Syphon

I had to copy the framework into bin/my.app/Contents/Frameworks to run it

(The examples in ofxSyphon don't build with recent OF because they use GLUT)

@bigfish247
Copy link

Hi, is there any solution for visual code c++ complier?
The error messages showed up same as @jeraman.
I think the problem is mm file, but I couldn't modify it correctly.

@bangnoise
Copy link
Collaborator Author

Looks like OpenFrameworks' compile.addon.mk needs to add support for .m and .mm files in addons.

@bangnoise
Copy link
Collaborator Author

Will require this PR be merged openframeworks/openFrameworks#6652 - plus a change to copy the Syphon framework to the built app's Frameworks directory during builds, matching the behaviour of Xcode builds.

@danomatika
Copy link
Contributor

danomatika commented Sep 16, 2022

As a followup, building is working for me with the oF 0.11.2 release and Xcode 13.2 on macOS 11.6.7 but runtime linking fails due to the missing framework:

 % make RunRelease
dyld: Library not loaded: @loader_path/../Frameworks/Syphon.framework/Versions/A/Syphon
  Referenced from: /Users/danomatika/src/of/of_v0.11.2_osx_release/addons/ofxSyphon/example-Basic/bin/example-Basic.app/Contents/MacOS/./example-Basic
  Reason: image not found
/bin/sh: line 1: 35286 Abort trap: 6           ./example-Basic
make: *** [RunRelease] Error 134

It seems the Copy Frameworks step works fine when building with Xcode but either isn;t called or doesn't exist when using the Makefile build. This is strange as I thought the oF makefile build just invokes xcode build using the same project.

The workaround is to manually copy the Framework into the app bundle but I would think it should be done automatically...?

@danomatika
Copy link
Contributor

danomatika commented Sep 16, 2022

plus a change to copy the Syphon framework to the built app's Frameworks directory during builds, matching the behaviour of Xcode builds.

Ah sorry, I see y'all are aware of this already. An approach we took for installing libtensorflow dylibs into project app bundles for ofxTensorFlow2 is a script which is called with a custom makefile build target or during the Xcode build run script phase: https://github.com/zkmkarlsruhe/ofxTensorFlow2/blob/main/scripts/macos_install_libs.sh This is less than ideal though, because it requires manually adding this step after generating the project files: https://github.com/zkmkarlsruhe/ofxTensorFlow2#macos. I am working on an additional script to automate these steps but, still, not as nice as 1. generate project files & 2. make.

@danomatika
Copy link
Contributor

danomatika commented Sep 27, 2022

I have my approach working in a client project which uses ofxSyphon:

https://git.zkm.de/Hertz-Lab/Research/intelligent-museum/YoloOSC/-/commit/399a9efca1c04c4fce74a180445634f95fd62e91

I basically follow the same model as ofxTensorflow2: script to install the framework into the bundle and special makefile targets to run this after generating the app.

UPDATE: I'm pretty sure this breaks the code-signing but it's enough for the app to run on the build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants