openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.91k stars 2.55k forks source link

local addons errors, make, osx #4763

Open thomasgeissl opened 8 years ago

thomasgeissl commented 8 years ago

I try to use local addons in osx, using the makefile. I have the following directory structure.

Thomass-MacBook-Pro-4:networkTcpClientExample thomasgeissl$ pwd
/Users/thomasgeissl/programming/of/ofTG/apps/localAddonsTest/networkTcpClientExample
Thomass-MacBook-Pro-4:networkTcpClientExample thomasgeissl$ ls 
Makefile    addons.make bin     local_addons    obj     src
Thomass-MacBook-Pro-4:networkTcpClientExample thomasgeissl$ cat addons.make 
./local_addons/ofxNetwork
Thomass-MacBook-Pro-4:networkTcpClientExample thomasgeissl$ ls local_addons/
ofxNetwork

when I try to compile, I get duplicate symbols errors:

duplicate symbol __ZN12ofxTCPClient10receiveRawEv in:
    obj/osx/Release/local_addons/ofxNetwork/src/ofxTCPClient.o
    /Users/thomasgeissl/programming/of/ofTG/apps/localAddonsTest/networkTcpClientExample/obj/osx/Release/addons/ofxNetwork/src/ofxTCPClient.o

This happens also when i try to compile opencvExample with ofxOpenCv included, I havent tested others. Trying to compile oscReceiveExample with ofxOsc locally, it includes ofxOsc/libs/oscpack/src/ip/win32/*

/Users/thomasgeissl/programming/of/ofTG/apps/localAddonsTest/oscReceiveExample/local_addons/ofxOsc/libs/oscpack/src/ip/win32/NetworkingUtils.cpp:39:10: fatal error: 'winsock2.h' file not found
#include <winsock2.h>   // this must come first to prevent errors with MSVC7
thomasgeissl commented 8 years ago

I just came across this again, it can be solved by adding this line to a config.make. PROJECT_EXCLUSIONS=$(PROJECT_ROOT)/local_addons% This also solves the windows includes for ofxOsc.

It would be nice if local addons get excluded automatically.

Another little note: PROJECT_EXCLUSIONS should be PROJECT_EXCLUDES. We use already ADDON_LIBS_EXCLUDE and ADDON_INCLUDES_EXCLUDES.

thomasgeissl commented 8 years ago

Could not we exclude everything but src (and libs) by default?

arturoc commented 8 years ago

mmh, yes i think the makefiles, and the PG? include every folder in the project as source but probably it shouldn't be doing that and only include src which would solve this

thomasgeissl commented 8 years ago

The PG excludes local addons, but it probably adds everything inside addon_root to the sources. Qbs behaves like the makefiles and includes local addons twice.

I think only src should be added automatically. And maybe libs could be added automatically too, the same way as for addons.