Page 1 of 1

Can't build GrowlTcl extension as universal binary

Posted: Thu Nov 30, 2006 3:48 am
by kevin_walzer
I'm having trouble building Growl's Tcl bindings as a universal binary.

Here are the steps I've taken:

1. Downloaded the source code for Growl 0.7.4.
2. cd to Bindings/tcl.
3. Edit the makefile to add -arch args to the CFLAGS. (CFLAGS = -Wall -DUSE_TCL_STUBS -arch ppc -arch i386)
4. Run make.

(Running Xcode 2.4.1 on OS X 10.4.8, iBook G3)

This is the output:

gcc -Wall -DUSE_TCL_STUBS -arch ppc -arch i386 -c -o GrowlApplicationBridge.o GrowlApplicationBridge.m
GrowlApplicationBridge.m:14:27: error: NSURLAdditions.h: No such file or directory
GrowlApplicationBridge.m:15:29: error: CFGrowlAdditions.h: No such file or directory
GrowlApplicationBridge.m:16:33: error: GrowlDefinesInternal.h: No such file or directory
GrowlApplicationBridge.m:17:26: error: GrowlPathUtil.h: No such file or directory
GrowlApplicationBridge.m:18:25: error: GrowlPathway.h: No such file or directory
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge notifyWithDictionary:]':
GrowlApplicationBridge.m:237: error: 'NSImage' undeclared (first use in this function)
GrowlApplicationBridge.m:237: error: (Each undeclared identifier is reported only once
GrowlApplicationBridge.m:237: error: for each function it appears in.)
GrowlApplicationBridge.m:239: error: 'icon' undeclared (first use in this function)
GrowlApplicationBridge.m:256: error: cannot find protocol declaration for 'GrowlNotificationProtocol'
GrowlApplicationBridge.m:257: error: cannot find protocol declaration for 'GrowlNotificationProtocol'
GrowlApplicationBridge.m:258: warning: no '-postNotificationWithDictionary:' method found
GrowlApplicationBridge.m:258: warning: (Messages without a matching method signature
GrowlApplicationBridge.m:258: warning: will be assumed to return 'id' and accept
GrowlApplicationBridge.m:258: warning: '...' as arguments.)
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge isGrowlInstalled]':
GrowlApplicationBridge.m:298: error: 'GrowlPathUtil' undeclared (first use in this function)
GrowlApplicationBridge.m:299: warning: control reaches end of non-void function
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge registrationDictionaryByFillingInDictionary:restrictToKeys:]':
GrowlApplicationBridge.m:405: error: 'NSImage' undeclared (first use in this function)
GrowlApplicationBridge.m:406: error: parse error before ')' token
GrowlApplicationBridge.m:416: error: 'GROWL_APP_LOCATION' undeclared (first use in this function)
GrowlApplicationBridge.m:418: warning: implicit declaration of function 'copyCurrentProcessURL'
GrowlApplicationBridge.m:418: warning: initialization makes pointer from integer without a cast
GrowlApplicationBridge.m:420: warning: 'NSURL' may not respond to '-dockDescription'
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge _applicationIconDataForGrowlSearchingRegistrationDictionary:]':
GrowlApplicationBridge.m:476: warning: initialization makes pointer from integer without a cast
GrowlApplicationBridge.m:477: warning: implicit declaration of function 'copyIconDataForURL'
GrowlApplicationBridge.m:477: warning: invalid receiver type 'int'
GrowlApplicationBridge.m:14:27: error: NSURLAdditions.h: No such file or directory
GrowlApplicationBridge.m:15:29: error: CFGrowlAdditions.h: No such file or directory
GrowlApplicationBridge.m:16:33: error: GrowlDefinesInternal.h: No such file or directory
GrowlApplicationBridge.m:17:26: error: GrowlPathUtil.h: No such file or directory
GrowlApplicationBridge.m:18:25: error: GrowlPathway.h: No such file or directory
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge _launchGrowlIfInstalledWithRegistrationDictionary:]':
GrowlApplicationBridge.m:606: error: 'GrowlPathUtil' undeclared (first use in this function)
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge notifyWithDictionary:]':
GrowlApplicationBridge.m:237: error: 'NSImage' undeclared (first use in this function)
GrowlApplicationBridge.m:237: error: (Each undeclared identifier is reported only once
GrowlApplicationBridge.m:237: error: for each function it appears in.)
GrowlApplicationBridge.m:239: error: 'icon' undeclared (first use in this function)
GrowlApplicationBridge.m:256: error: cannot find protocol declaration for 'GrowlNotificationProtocol'
GrowlApplicationBridge.m:257: error: cannot find protocol declaration for 'GrowlNotificationProtocol'
GrowlApplicationBridge.m:258: warning: no '-postNotificationWithDictionary:' method found
GrowlApplicationBridge.m:258: warning: (Messages without a matching method signature
GrowlApplicationBridge.m:258: warning: will be assumed to return 'id' and accept
GrowlApplicationBridge.m:258: warning: '...' as arguments.)
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge isGrowlInstalled]':
GrowlApplicationBridge.m:298: error: 'GrowlPathUtil' undeclared (first use in this function)
GrowlApplicationBridge.m:299: warning: control reaches end of non-void function
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge registrationDictionaryByFillingInDictionary:restrictToKeys:]':
GrowlApplicationBridge.m:405: error: 'NSImage' undeclared (first use in this function)
GrowlApplicationBridge.m:406: error: parse error before ')' token
GrowlApplicationBridge.m:416: error: 'GROWL_APP_LOCATION' undeclared (first use in this function)
GrowlApplicationBridge.m:418: warning: implicit declaration of function 'copyCurrentProcessURL'
GrowlApplicationBridge.m:418: warning: initialization makes pointer from integer without a cast
GrowlApplicationBridge.m:420: warning: 'NSURL' may not respond to '-dockDescription'
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge _applicationIconDataForGrowlSearchingRegistrationDictionary:]':
GrowlApplicationBridge.m:476: warning: initialization makes pointer from integer without a cast
GrowlApplicationBridge.m:477: warning: implicit declaration of function 'copyIconDataForURL'
GrowlApplicationBridge.m:477: warning: invalid receiver type 'int'
GrowlApplicationBridge.m: In function '+[GrowlApplicationBridge _launchGrowlIfInstalledWithRegistrationDictionary:]':
GrowlApplicationBridge.m:606: error: 'GrowlPathUtil' undeclared (first use in this function)
lipo: can't figure out the architecture type of: /var/tmp//ccmkpRnQ.out
make: *** [GrowlApplicationBridge.o] Error 1

I have no idea what's going on here. Do I need to build the Growl frameworks before I build the bindings? I didn't think that was the case, because I *did* successfully build the same extension from Growl 0.6.2, but that won't run on MacTel (even though it built as a UB and lipo says there is i386 bits there as well).

The one odd thing here is that in the source code tree, GrowlApplicationBridge.h, GrowlApplicationBridge.m, and GrowlDefines.h are symlinked--not actually present in the Bindings/tcl directory. Not sure if that makes a difference or not.

Posted: Thu Nov 30, 2006 9:46 am
by The_Tick
We no longer have a Tcl maintainer. Sorry, but I don't know of anyone on the team who can help with this.

Re: Can't build GrowlTcl extension as universal binary

Posted: Thu Nov 30, 2006 10:28 am
by bgannin
kevin_walzer wrote:The one odd thing here is that in the source code tree, GrowlApplicationBridge.h, GrowlApplicationBridge.m, and GrowlDefines.h are symlinked--not actually present in the Bindings/tcl directory. Not sure if that makes a difference or not.
If they are symlinked and built into the product then they need to be present (and GAB itself is a gateway to a large portion of the Growl core code.) You should generally use the entire source base, not a subset, when building to insure you have all components.

Also, when creating UBs, make sure all components are built for both architectures.

Posted: Thu Nov 30, 2006 2:37 pm
by tomhennigan
Here's the build script we at aMSN use. It was made by David Luyer. We don't have any problems with it or it's products on PPC or Intel.

Code: Select all

#!/bin/sh
cd ~/Tools/
# Build libgrowl.
if [ ! -f Growl/Growl-0.7.4/Bindings/tcl/libgrowl.dylib ]
then
    mkdir -p Growl
    cd Growl
    curl --retry 5 -R -z Growl-0.7.4-src.tar.bz2 http://www.growl.info/files/source/Growl-0.7.4-src.tar.bz2 -o Growl-0.7.4-src.tar.bz2
    rm -rf Growl-0.7.4
    tar xjf Growl-0.7.4-src.tar.bz2
    cd Growl-0.7.4/Bindings/tcl
    patch Makefile <<\EOF
@@ -7,16 +7,26 @@
 DESTDIR =
 PREFIX = /Library/Tcl/growl1.0
 
-OBJS = GrowlApplicationBridge.o TclGrowler.o growl.o
+OBJS = GrowlPathUtil.o GrowlApplicationBridge.o CFGrowlAdditions.o TclGrowler.o growl.o NSURLAdditions.o
 TARGET = libgrowl.dylib
 
-CC = gcc
-CFLAGS = -Wall -DUSE_TCL_STUBS
-FRAMEWORKS = -framework Cocoa -framework Tcl -ltclstub8.4
-LDFLAGS = -dynamiclib -install_name $(PREFIX)/$(TARGET)
+CC = gcc --std=c99 -fconstant-cfstrings
+ARCH=-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
+CFLAGS = -Wall -DUSE_TCL_STUBS $(ARCH) -I../../Common/Source -I../../Core/Source
+FRAMEWORKS = -framework Cocoa -framework Tcl
+LDFLAGS = -dynamiclib $(ARCH) -Wl,-single_module
 
 all: $(TARGET)
 
+CFGrowlAdditions.c:
+	ln -s ../../Common/Source/CFGrowlAdditions.c
+
+GrowlPathUtil.m:
+	ln -s ../../Common/Source/GrowlPathUtil.m
+
+NSURLAdditions.m:
+	ln -s ../../Common/Source/NSURLAdditions.m
+
 $(TARGET): $(OBJS)
 	$(CC) $(LDFLAGS) $(FRAMEWORKS) $(OBJS) -o $@

EOF
    make
fi
# Done libgrowl build.

Posted: Thu Nov 30, 2006 9:23 pm
by kevin_walzer
Tom,

This script did the trick! Thank you so much. It was exactly what I needed--my app no longer crashes on Mactel. Please thank the script author for his great work.

Best,
Kevin

Posted: Thu Nov 30, 2006 11:00 pm
by tomhennigan
kevin_walzer wrote:Tom,

This script did the trick! Thank you so much. It was exactly what I needed--my app no longer crashes on Mactel. Please thank the script author for his great work.

Best,
Kevin
Cool :cool:.

Posted: Fri Dec 01, 2006 10:19 pm
by The_Tick
So I'm concerned about continuing to ship the Tcl bindings without someone to actively maintain them. We lost maintainership on the Tcl bindings and the irssi script. Any thoughts?

Posted: Sat Dec 02, 2006 1:40 am
by kevin_walzer
What's involved with maintaining the bindings?

Posted: Sat Dec 02, 2006 2:44 am
by The_Tick
kevin_walzer wrote:What's involved with maintaining the bindings?
Making sure they don't break, things like that. Keeping up with features is nice but at least keeping it so that they send notifications out on whatever platform is supposed to be supported is the main thing.

Posted: Sat Dec 02, 2006 2:56 am
by bgannin
Thus a firm knowledge of tcl and a solid understanding of Growl.

Posted: Mon Dec 04, 2006 5:10 am
by kevin_walzer
I have a pretty good knowledge of Tcl (it's my main programming language), rudimentary experience with its C API (and C itself--I've coded a very simple Tcl extension in C), and almost no knowledge of Objective C/Cocoa or Growl's internals.

Does this make me sound at least minimally qualified to maintain the Growl Tcl bindings?

I'm willing to invest a little time to improve my knowledge of C, and also to learn Objective C, at least at a basic level. This would help my other projects, as well as my skills in general.

If someone from Amsn steps up, I'll defer to them--but I'm willing if no one else is. I don't want the Tcl-Growl bindings to disappear.

Posted: Mon Dec 04, 2006 6:40 am
by bgannin
You don't need to learn Objective C (though it is fun and helpful), just gaining a grasp on how Growl functions [i.e., bindings send message through bridge, bridge posts notification to growl helper app, gha displays message] at a macro level and a firm knowledge of how the tcl bindings is built and work. (for this I'd pull the source code and study it, asking for clarifications as needed)

I plan on making sure the wiki is fully update to date in the future, but it's got some great gems there already so I'd check that out as well.

Posted: Mon Dec 04, 2006 7:00 am
by kevin_walzer
OK, count me in then. I'll be the Tcl-Growl maintainer.

Posted: Mon Dec 04, 2006 7:20 am
by bgannin
kevin_walzer wrote:OK, count me in then. I'll be the Tcl-Growl maintainer.
Start studying :)

Also, you'll want to get in the habit of periodically building and using the trunk, not just a tagged release, to verify the functionality of the bindings in the pending release.