Hi dear list,
I am using GEM for several months for my own experimentation and some artists friends. I've tried to do a GEM external on OSX but I've failed. I've used the same process that works on Linux, and I've ended with similar results to the ones Sebastian posted on the list few days ago (see Sebastian's message at the end of this message).
If someone has by the past succeeded in making an external on OSX, could he help Sebastian and I ? Do we forgot a fundamental step ?
By the way, as a workaround, I was thinking in compiling the whole GEM from the Xcode project file that comes with the GEM source. But I miss the GemLibs folder that is available only for NT and Linux. Where could I find GemLibs for OSX ?
In advance, thank you very much for any help or any suggestion.
Pierre
____ Sebastian's message:
Hello,
i am pretty new to PD and GEM but i love it and i want to use it form some project i am going to work on. so, lets get to the point. i have to write an external for PD which uses GEM to make some image processing. i managed to write a simple external for PD which was not very hard. but i could not yet get a GEM external up and running. i am working on macosx and windows.
my latest work ended up in a lot of unresolved externals while PD is trying to load my external. i simply took the pix_blur class, changed it minimally and tried to compile it using the following lines:
g++ -o pix_myblur.o -c pix_myblur.cpp -I../src g++ -bundle -undefined suppress -flat_namespace -o pix_myblur.pd_darwin pix_myblur.o
running "./pd -lib Gem -lib pix_myblur" results in the following:
dyld: ./pd Undefined symbols: __ZN11imageStruct5clearEv __ZN7GemBase11setModifiedEv __ZN7GemBase17obj_setupCallbackEP6_class __ZN7GemBase17realStopRenderingEv __ZN7GemBaseD2Ev __ZN9CPPExtern16setCPPObjectNameEPc __ZN9CPPExtern8m_holderE __ZN9GemPixObj10postrenderEP8GemState __ZN9GemPixObj12processImageER11imageStruct __ZN9GemPixObj14setPixModifiedEv __ZN9GemPixObj15processRGBImageER11imageStruct __ZN9GemPixObj17obj_setupCallbackEP6_class __ZN9GemPixObj6renderEP8GemState __ZN9GemPixObjC2Ev __ZTV9GemPixObj __ZnwmPvS_ Trace/BPT trap
well, what did i forget? if somebody has a little makefile or hint, i would be very thankful. how can i load the Gem.pd_darwin symbols in my external, or do i have to do it? Thank you in advance.
Sebastian
On Feb 1, 2005, at 2:32 PM, Pierre Laborde wrote:
By the way, as a workaround, I was thinking in compiling the whole GEM from the Xcode project file that comes with the GEM source. But I miss the GemLibs folder that is available only for NT and Linux. Where could I find GemLibs for OSX ?
You need to download and build them from source. I think freetype2 and FTGL are the ones required for text on OSX, but you can simply exclude the objects that need them from your build.
running "./pd -lib Gem -lib pix_myblur" results in the following:
dyld: ./pd Undefined symbols: __ZN11imageStruct5clearEv __ZN7GemBase11setModifiedEv __ZN7GemBase17obj_setupCallbackEP6_class __ZN7GemBase17realStopRenderingEv __ZN7GemBaseD2Ev __ZN9CPPExtern16setCPPObjectNameEPc __ZN9CPPExtern8m_holderE __ZN9GemPixObj10postrenderEP8GemState __ZN9GemPixObj12processImageER11imageStruct __ZN9GemPixObj14setPixModifiedEv __ZN9GemPixObj15processRGBImageER11imageStruct __ZN9GemPixObj17obj_setupCallbackEP6_class __ZN9GemPixObj6renderEP8GemState __ZN9GemPixObjC2Ev __ZTV9GemPixObj __ZnwmPvS_ Trace/BPT trap
I don't have an exact answer, but it looks like your external didn't link properly or maybe GEM was not loaded already.
Can you build your object as a regular external and not a lib? I think then GEM would already be loaded and the external would find the needed base classes when loaded. That's purely speculation though.
cgc
On Feb 1, 2005, at 3:32 PM, Pierre Laborde wrote:
By the way, as a workaround, I was thinking in compiling the whole GEM from the Xcode project file that comes with the GEM source. But I miss the GemLibs folder that is available only for NT and Linux. Where could I find GemLibs for OSX ?
...GemLibs is also in cvs, and needs to be checked out like Gem was...however, you only really need freetype-2.1.9 and FTGL, and you can install them anywhere as long as you tell Xcode about it (via cmd-I "get info" on the red colored names)
g++ -o pix_myblur.o -c pix_myblur.cpp -I../src g++ -bundle -undefined suppress -flat_namespace -o pix_myblur.pd_darwin pix_myblur.o
running "./pd -lib Gem -lib pix_myblur" results in the following:
dyld: ./pd Undefined symbols: __ZN11imageStruct5clearEv
...actually, doesn't look like you're missing anything except for a patched version of pd :-)
http://sourceforge.net/tracker/index.php? func=detail&aid=1083495&group_id=55736&atid=478072
...this patch hasn't made it into miller's version (I'll commit it to the devel branches in cvs), but essentially solves yr problem...long ago we had a problem with loading externals that had similarly named symbols (ie. cyclone's prepend vs. maxlib's prepend): this is known as the dreaded "namespace" problem...
...on linux and windoze, the behavior is that the "first symbol loaded wins", which means that if you wanted maxlib's prepend, you'd have to include it before cyclone in pd's flag list of loading libs
...on osx, there is an artificial partitioning of libraries into their own namespaces: this was done several years ago because otherwise, if you tried to load two libraries with symbol's of the same name, pd would crash...the down side of this was that it prevented libraries from accessing symbols in other loaded libs, and this is what you're seeing: you're "pix_myblur" can't access any of GEM's symbols...
...however, I found a way around this when I as trying to get the pdp2gem bridge to work, very simple...this patch only affects bundle/library loading on osx, and prevents crashing on multiple symbols (instead, it prints out a warning)...it also behaves like the other platforms as far as library precedence...
l8r, jamie
Hello everybody,
So as suggested Jamie, I've patched my pd from the cvs. And there is some progress but it's not enough. As you can compare the console log when pd load my external :
Now :
__ZNSt8ios_base4InitC1Ev __ZNSt8ios_base4InitD1Ev __ZTVN10__cxxabiv117__class_type_infoE __ZTVN10__cxxabiv120__si_class_type_infoE __ZdlPv __Znwm ___gxx_personality_v0
Before :
__ZN7GemBase11setModifiedEv __ZN7GemBase17obj_setupCallbackEP6_class __ZN7GemBase17realStopRenderingEv __ZN7GemBaseC2Ev __ZN7GemBaseD2Ev __ZN9CPPExtern16setCPPObjectNameEPc __ZN9CPPExtern8m_holderE __ZNSt8ios_base4InitC1Ev __ZNSt8ios_base4InitD1Ev __ZTVN10__cxxabiv117__class_type_infoE __ZTVN10__cxxabiv120__si_class_type_infoE __ZdlPv __Znwm __ZnwmPvS_ ___gxx_personality_v0
Anyway, thanks to Sebastian, I've got now a way to compile my externals (with some "extern "C" " for the setup methods) which work fine. I shall try later to figure out what is exactly the issue with externals on osx. To continue...
Thanks for all your messages that have really helped me,
Pierre
On Feb 1, 2005, at 10:25 PM, james tittle wrote:
On Feb 1, 2005, at 3:32 PM, Pierre Laborde wrote:
By the way, as a workaround, I was thinking in compiling the whole GEM from the Xcode project file that comes with the GEM source. But I miss the GemLibs folder that is available only for NT and Linux. Where could I find GemLibs for OSX ?
...GemLibs is also in cvs, and needs to be checked out like Gem was...however, you only really need freetype-2.1.9 and FTGL, and you can install them anywhere as long as you tell Xcode about it (via cmd-I "get info" on the red colored names)
g++ -o pix_myblur.o -c pix_myblur.cpp -I../src g++ -bundle -undefined suppress -flat_namespace -o pix_myblur.pd_darwin pix_myblur.o
running "./pd -lib Gem -lib pix_myblur" results in the following:
dyld: ./pd Undefined symbols: __ZN11imageStruct5clearEv
...actually, doesn't look like you're missing anything except for a patched version of pd :-)
http://sourceforge.net/tracker/index.php? func=detail&aid=1083495&group_id=55736&atid=478072
...this patch hasn't made it into miller's version (I'll commit it to the devel branches in cvs), but essentially solves yr problem...long ago we had a problem with loading externals that had similarly named symbols (ie. cyclone's prepend vs. maxlib's prepend): this is known as the dreaded "namespace" problem...
...on linux and windoze, the behavior is that the "first symbol loaded wins", which means that if you wanted maxlib's prepend, you'd have to include it before cyclone in pd's flag list of loading libs
...on osx, there is an artificial partitioning of libraries into their own namespaces: this was done several years ago because otherwise, if you tried to load two libraries with symbol's of the same name, pd would crash...the down side of this was that it prevented libraries from accessing symbols in other loaded libs, and this is what you're seeing: you're "pix_myblur" can't access any of GEM's symbols...
...however, I found a way around this when I as trying to get the pdp2gem bridge to work, very simple...this patch only affects bundle/library loading on osx, and prevents crashing on multiple symbols (instead, it prints out a warning)...it also behaves like the other platforms as far as library precedence...
l8r, jamie
On Feb 2, 2005, at 3:32 PM, Pierre Laborde wrote:
So as suggested Jamie, I've patched my pd from the cvs. And there is some progress but it's not enough. As you can compare the console log when pd load my external :
Now :
__ZNSt8ios_base4InitC1Ev __ZNSt8ios_base4InitD1Ev __ZTVN10__cxxabiv117__class_type_infoE __ZTVN10__cxxabiv120__si_class_type_infoE __ZdlPv __Znwm ___gxx_personality_v0
...sorry, guess I overlooked these...there may be a couple of things to look for here:
1. are you using the same version of gcc to compile both pd and gem? 2. are you including libstdc++? or -lobjc? 3. did you build gem or pd with zerolink on? if so, it won't run as a standalone...
...so, try turning off zerolink in xcode, and possibly adding libstdc++...
jamie