FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

building gtkD on OS X

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
obijohn



Joined: 07 Feb 2006
Posts: 24

PostPosted: Tue Mar 03, 2009 9:03 am    Post subject: building gtkD on OS X Reply with quote

I'm hoping someone can shed some light on what's going wrong for me. This may be a DSS bug (see below), but since gtkD is being used on OS X I thought I'd ask here first to see if anyone else encountered this and what to do about it.

I'm also using LDC, though I don't think that's the problem either, since gtkD is listed as building successfully with LDC. I have the LDC-supplied rebuild configuration file ("ldc-posix-tango") set up, and I've got "Tango" defined in my DFLAGS.

The first thing that happens when trying to build gtkD is a complaint about a sed command:
Code:
sed: 1: "/^.*$/ { N; s/\n\[/\n&/ }": bad flag in substitute command: '}'
sed: 1: "/^\[.*/ { s/^./#&/; :a; ...": unexpected EOF (pending }'s)


Next come several "Creating imports for DO-atk" and so on. But then the first file it tries to compile (atk.d), rebuild stops, complaining "module stdio cannot read file 'std/stdio.d'"

Well, I know what that error means. It means that the Tango version flag didn't get passed through rebuild and so ldc is looking for phobos which it can't find. When I run rebuild directly, it picks up the flag, so I know the problem is not with my rebuild config.

To me it looks like maybe DSSS is using sed to parse DFLAGS, and since sed doesn't like the command it's being fed, the flags don't get passed on.

I've tried this on Tiger (10.4.11) and Leopard (10.5.6), and I get the exact same errors on both.
Back to top
View user's profile Send private message
obijohn



Joined: 07 Feb 2006
Posts: 24

PostPosted: Tue Mar 03, 2009 10:31 am    Post subject: Reply with quote

Well, I'm not sure where the sed thing comes in, because I went directly into the gtkd/src directory and tried "dsss build" there. Now there is no sed error, but I still get the erro:
gtkc/atk.d(29): module stdio cannot read file 'std/stdio.d'
Command /usr/bin/rebuild returned with code 256, aborting.

I've tried DSSS on a simple project and it works pulling in the Tango flag, so I'm still stuck trying to figure out why it's not working with gtkD.
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Tue Mar 03, 2009 1:36 pm    Post subject: Reply with quote

The sed errors probably come from trunk/demos/demoselect.sh this shouldn't be a big problem.
demoselect.sh sets up the dsss.conf for the demos, you can do this manually or build the demos separately.

As for the error with std.stdio, it look like version Tango is not set.
Back to top
View user's profile Send private message
obijohn



Joined: 07 Feb 2006
Posts: 24

PostPosted: Tue Mar 03, 2009 2:16 pm    Post subject: Reply with quote

Mike Wey wrote:
The sed errors probably come from trunk/demos/demoselect.sh this shouldn't be a big problem.
demoselect.sh sets up the dsss.conf for the demos, you can do this manually or build the demos separately.

Right. The problem there was with the OS X version of sed, which isn't GNU sed. I replaced sed and that error went away. Unforunately, it still won't compile and stops at the first version(Tango) block.
Quote:
As for the error with std.stdio, it look like version Tango is not set.

Well, I *do* have version Tango set in DFLAGS. I've created a couple of test cases with version(Tango) blocks and used DSSS and rebuild both, and they work on these.

In fact, I just tried a manual build of atk.d (from the 'src' directory, with 'ldc -c gtkc/atk.d') and it built without any errors. Assuming this is a problem with DSSS on OS X, can I build gtkD without it? I know it will be tedious, but at this point I just want to get it built. What would the build procedure be?
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Wed Mar 04, 2009 2:43 pm    Post subject: Reply with quote

There is a makefile attached to ticket #31 that might be of some use.

http://www.dsource.org/projects/gtkd/attachment/ticket/31/GNUmakefile.2
Back to top
View user's profile Send private message
obijohn



Joined: 07 Feb 2006
Posts: 24

PostPosted: Wed Mar 04, 2009 6:28 pm    Post subject: Reply with quote

Thanks for pointing out that Makefile. I was able to build gtkD using GDC with it almost as-is (after updating it to match the current source). A few edits and I was able to use LDC (finally!).

There were a couple of components missing (gio and glade, maybe another), and the TestWindow demo is in it's own subdirectory now so that part can be simplified in the Makefile.

Below is my updated Makefile for use with LDC in case anyone is interested and runs into the same kinds of problems with DSSS that I did. This version doesn't include the rest of the demos, and I'm sure it could be improved further.

Do "make libs" then "sudo make install" first. To compile the test, use "DFLAGS=-d-version=Tango make test" because the demo uses some Phobos functions like writefln in a debug block, not a Tango block (I'm sure there's a way to take out the -d-debug flag just for the test block in the Makefile, but I couldn't figure it out).
Code:

SHELL=/bin/sh
prefix=/usr/local

OS=$(shell uname || uname -s)
ARCH=$(shell arch || uname -m)

# make gtkD libs
all: libs

DC?=ldc
DFLAGS?=-O2 -g -d-debug -d-version=Tango

AR=ar
RANLIB=ranlib

#######################################################################

LIBNAME_GTKD = libgtkd.a
SOURCES_GTKD = $(shell find \
        src/atk \
        src/cairo \
        src/gdk \
        src/gdkpixbuf \
        src/gio \
        src/glade \
        src/glib \
        src/gobject \
        src/gthread \
        src/gtk \
        src/gtkc \
        src/pango \
        -name '*.d' )
OBJECTS_GTKD = $(shell echo $(SOURCES_GTKD) | sed -e 's/\.d/\.o/g')

BINNAME_DEMO = TestWindow
SOURCES_DEMO = $(shell find \
        demos/gtkD/TestWindow \
        -name '*.d' )
OBJECTS_DEMO = $(shell echo $(SOURCES_DEMO) | sed -e 's/\.d/\.o/g')


#######################################################################

libs: $(LIBNAME_GTKD)

$(LIBNAME_GTKD): $(OBJECTS_GTKD)
   $(AR) rcs $@ $^
   $(RANLIB) $@

#######################################################################

test: $(BINNAME_DEMO)

$(BINNAME_DEMO): $(OBJECTS_DEMO) $(LIBNAME_GTKD)
   $(DC) $(DFLAGS) $^ -of=$@ $(LDFLAGS) -L-lgtkd


%.o : %.d
   $(DC) $(DFLAGS) -Isrc -Idemos/gtkD/TestWindow -c $< -of=$@

#######################################################################

install: $(LIBNAME_GTKD)
   install -d $(DESTDIR)$(prefix)/include/d
   (cd src; echo $(SOURCES_GTKD) | sed -e s,src/,,g | xargs tar c) | (cd $(DESTDIR)$(prefix)/include/d; tar xv)
   install -d $(DESTDIR)$(prefix)/lib
   install -m 644 $(LIBNAME_GTKD) $(DESTDIR)$(prefix)/lib

#######################################################################

clean:
   -rm $(LIBNAME_GTKD) $(OBJECTS_GTKD)
   -rm $(BINNAME_DEMO) $(OBJECTS_DEMO)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group