[Unison-hackers] Help building OSX GUI

Alan Schmitt alan.schmitt at polytechnique.org
Wed May 6 05:28:56 EDT 2009


On 5 mai 09, at 15:14, Martin von Gagern wrote:

> I'm on using ocaml as built with fink, and rebuilding ocaml just to
> allow developing unison doesn't sound too attractive. Without
> modifications, I get this error:
>
> Undefined symbols:
>  "_chmod$UNIX2003", referenced from:
>      _setFileInfos in unison-blob.o
>      _setFileInfos in unison-blob.o
>
> The reference to that symbol is present in osxsupport.o as well, so  
> it's
> the C compiler invoked by ocamlopt that's introducing this reference.
> The symbol is part of the OS X 10.5 SDK, but not the 10.4 SDK.

Yes, this is correct.

> Alan Schmitt wrote:
>> Right now, everything is set to compile for both 10.4 and 10.5, but
>> requires a specially built ocaml (which is simply a line to add in a
>> configuration file in godi). The reason for this is that I don't have
>> access to Tiger machines anymore and I want to provide a single  
>> binary
>> for our users.
>
> You shouldn't have to rebuild ocaml just to get a certain command line
> argument passed on to the C compiler. The -ccopt flag does that. It
> might be that code compiled from ocaml source files does introduce
> additional dependencies if you don't rebuild ocaml, but as this hasn't
> been a problem for me, I'll not worry about it here.

The problem is the following: to provide a binary that work on both  
10.4 and 10.5, one needs to say so when compiling both unison and  
ocaml. If you use a Leopard-only ocaml when building a Tiger+Leopard  
Unison, you get the above error (because ocaml libraries use Leopard- 
only symbols). So you actually need to rebuild ocaml to get Tiger 
+Leopard ocaml libraries. (Now you probably don't care if you don't  
want a version that works with both.)

>> We could try to do some tweaking to allow different compilation  
>> options,
>> but I would first need to find out how to change the target SDK  
>> from the
>> command line (right now I only know how to do it in XCode).
>
> On my system there is a -sdk command line flag to xcodebuild.  
> Specifying
> a value like macos10.5 for it will select the corresponding SDK,  
> falling
> back to the project configured SDK if the selected one isn't  
> available.
>
> The attached patch takes care of both these approaches: specifying the
> SDK to xcodebuild and passing -mmacosx-version-min to the C compiler.
> Both are controlled using the single MINOSXVERSION variable in the
> makefile. So in theory "make MINOSXVERSION=10.4" should give you a
> binary ready to run anywhere, while "make MINOSXVERSION=10.5" will  
> give
> you a version making use of all the latest features, or whatever.
>
> Both of these builds compile for me, while the unmodified build failed
> with the unresolved reference quoted in the beginning. I would like to
> see the patch included.
>
> Greetings,
> Martin von Gagern
> === modified file 'src/Makefile.OCaml'
> --- src/Makefile.OCaml	2009-05-05 08:28:15 +0000
> +++ src/Makefile.OCaml	2009-05-05 12:54:21 +0000
> @@ -157,6 +157,10 @@
> endif
>
> MINOSXVERSION=10.5
> +XCODEFLAGS=-sdk macosx$(MINOSXVERSION)
> +ifeq ($(OSARCH),osx)
> +  CAMLFLAGS+=-ccopt -mmacosx-version-min=$(MINOSXVERSION)
> +endif
>
> # NOTE: the OCAMLLIBDIR is not getting passed correctly?
> # The two cases for cltool are needed because Xcode 2.1+
> @@ -164,7 +168,7 @@
> .PHONY: macexecutable
> macexecutable: $(NAME)-blob.o
> #	sed -e's/@@VERSION@@/$(VERSION)/' $(UIMACDIR)/Info.plist.template  
> > $(UIMACDIR)/Info.plist
> -	(cd $(UIMACDIR); xcodebuild OCAMLLIBDIR="$(OCAMLLIBDIR)"  
> SYMROOT=build)
> +	(cd $(UIMACDIR); xcodebuild $(XCODEFLAGS) OCAMLLIBDIR="$ 
> (OCAMLLIBDIR)" SYMROOT=build)
> 	if [ -e $(UIMACDIR)/build/Default ]; then \
> 	  gcc -mmacosx-version-min=$(MINOSXVERSION) $(UIMACDIR)/cltool.c -o  
> $(UIMACDIR)/build/Default/Unison.app/Contents/MacOS/cltool - 
> framework Carbon; \
> 	else \

You were able to build a 10.4 build with a 10.5 ocaml? If so there is  
probably something wrong somewhere. In any case, the approach is sound  
and I would agree to incorporate the patch, as soon as doing a "make  
MINOSXVERSION=10.4" fails with the undefined symbols above if using a  
10.5 ocaml.

Alan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20090506/e937257a/PGP.sig


More information about the Unison-hackers mailing list