www.digitalmars.com         C & C++   DMDScript  

D.gnu - Trouble compiling DUI with GDC - is it supposed to work?

reply Anders Runesson <anders runesson.info> writes:
Hi there
I decided to give DUI/leds a try today, but I can't manage to get dui to 
  compile with gdc 0.9.

I modified the makefile just a little bit, since gdc needs "-lgc -ldl" 
to be happy, and moved some flags that appear in several places to 
variables. It's nicer this way I think, it's a lot easier to make 
changes to the flags now. Take a look at 
http://www.runesson.info/anders/Makefile.DUI if you like.

When I run make, I get a whole bunch of error messages about 
EventHandlerXX templates in dui/Widget.d and EventHandler.d. Here's a 
snippet of the output from gdc:

dui/Widget.d:372: template instance EventHandlerR!(Widget ,EventButton ) 
forward reference to template
dui/Widget.d:373: template instance EventHandlerR!(Widget ,EventButton ) 
forward reference to template
...
dui/Widget.d:462: variable dui.Widget.Widget.onMouseButtonPress voids 
have no value
dui/Widget.d:463: template instance EventHandlerR!(Widget ,EventButton ) 
is used as a type
dui/Widget.d:463: variable dui.Widget.Widget.onMouseButtonRelease voids 
have no value
...
dui/ObjectG.d: In member function `dump':
dui/ObjectG.d:145: error: DotTypeExp::toElem: don't know what to do 
(this.Object)
dui/ObjectG.d:145: confused by earlier errors, bailing out
make: *** [dui_COMP] Fel 1


The function dump from the last bit looks like:
	public: void dump()
	{

		printf("\n%.*s", Object.toString());
		printf("\tg_type_instance %X\n",Object.g_type_instance);
		printf("\tref_count %d\n",gObject.ref_count);
		printf("\tqdata* %X\n",gObject.qdata);
	}

And the error goes away if the line with
printf("\n%.*s", Object.toString());
is removed.

The other stuff I don't know how to fix. It's in class widget in 
Widget.d, which is structured as(line numbers in comments) :

public class Widget: DUIObject {
	...
	private import dui.Event;
	private import dui.EventHandler;
	...
/*372*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonPress;
/*373*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonRelease;
	...
/*462*/ OnMouseButtonPress onMouseButtonPress;
/*463*/ OnMouseButtonRelease onMouseButtonRelease;
	...
}

EventHandlerX is defined in EventHandler.d like so:
class EventHandlerX(TWidget, TEvent) {
...
}

If I remove the "import EventHandler"-line in Widget I get "symbol not 
defined"-errors in stead, so the declarations are seen when compiling 
Widget.

Am I missing something? Is it supposed to build with gdc at all? Has 
anyone managed to get it done?

/Anders Runesson
Jan 06 2005
next sibling parent =?UTF-8?B?QW5kZXJzIEYgQmrDtnJrbHVuZA==?= <afb algonet.se> writes:
Anders Runesson wrote:

 I decided to give DUI/leds a try today, but I can't manage to get dui to 
  compile with gdc 0.9.
[...]
 Am I missing something? Is it supposed to build with gdc at all? Has 
 anyone managed to get it done?
This might help: http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_id=97723&atid=618893 Haven't tried DUI with 0.9 yet, since it doesn't work on OS X anyway. --anders
Jan 06 2005
prev sibling parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Anders Runesson wrote:
 Hi there
 I decided to give DUI/leds a try today, but I can't manage to get dui to 
  compile with gdc 0.9.
 
 I modified the makefile just a little bit, since gdc needs "-lgc -ldl" 
 to be happy, and moved some flags that appear in several places to 
 variables. It's nicer this way I think, it's a lot easier to make 
 changes to the flags now. Take a look at 
 http://www.runesson.info/anders/Makefile.DUI if you like.
 
 When I run make, I get a whole bunch of error messages about 
 EventHandlerXX templates in dui/Widget.d and EventHandler.d. Here's a 
 snippet of the output from gdc:
 
 dui/Widget.d:372: template instance EventHandlerR!(Widget ,EventButton ) 
 forward reference to template
 dui/Widget.d:373: template instance EventHandlerR!(Widget ,EventButton ) 
 forward reference to template
 ...
 dui/Widget.d:462: variable dui.Widget.Widget.onMouseButtonPress voids 
 have no value
 dui/Widget.d:463: template instance EventHandlerR!(Widget ,EventButton ) 
 is used as a type
 dui/Widget.d:463: variable dui.Widget.Widget.onMouseButtonRelease voids 
 have no value
 ...
 dui/ObjectG.d: In member function `dump':
 dui/ObjectG.d:145: error: DotTypeExp::toElem: don't know what to do 
 (this.Object)
 dui/ObjectG.d:145: confused by earlier errors, bailing out
 make: *** [dui_COMP] Fel 1
 
 
 The function dump from the last bit looks like:
     public: void dump()
     {

         printf("\n%.*s", Object.toString());
         printf("\tg_type_instance %X\n",Object.g_type_instance);
         printf("\tref_count %d\n",gObject.ref_count);
         printf("\tqdata* %X\n",gObject.qdata);
     }
 
 And the error goes away if the line with
 printf("\n%.*s", Object.toString());
 is removed.
 
 The other stuff I don't know how to fix. It's in class widget in 
 Widget.d, which is structured as(line numbers in comments) :
 
 public class Widget: DUIObject {
     ...
     private import dui.Event;
     private import dui.EventHandler;
     ...
 /*372*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonPress;
 /*373*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonRelease;
     ...
 /*462*/ OnMouseButtonPress onMouseButtonPress;
 /*463*/ OnMouseButtonRelease onMouseButtonRelease;
     ...
 }
 
 EventHandlerX is defined in EventHandler.d like so:
 class EventHandlerX(TWidget, TEvent) {
 ...
 }
 
 If I remove the "import EventHandler"-line in Widget I get "symbol not 
 defined"-errors in stead, so the declarations are seen when compiling 
 Widget.
 
 Am I missing something? Is it supposed to build with gdc at all? Has 
 anyone managed to get it done?
 
 /Anders Runesson
I have built earlier versions of DUI after rearranging/removing import statements. What platform are you using? It shouldn't be necessary to use "-lgc". David
Jan 06 2005
next sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Thu, 06 Jan 2005 22:04:04 -0500, David Friedman wrote:

 Anders Runesson wrote:
 Hi there
 I decided to give DUI/leds a try today, but I can't manage to get dui to 
  compile with gdc 0.9.
 
 I modified the makefile just a little bit, since gdc needs "-lgc -ldl" 
 to be happy, and moved some flags that appear in several places to 
 variables. It's nicer this way I think, it's a lot easier to make 
 changes to the flags now. Take a look at 
 http://www.runesson.info/anders/Makefile.DUI if you like.
 
 When I run make, I get a whole bunch of error messages about 
 /Anders Runesson
I have built earlier versions of DUI after rearranging/removing import statements.
are those the one on the patch at http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_id=97723&atid=618893 ? let me know, I'll include it on the main development branch. Ant
 
 What platform are you using?  It shouldn't be necessary to use "-lgc".
 
 David
Jan 06 2005
parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Ant wrote:
 On Thu, 06 Jan 2005 22:04:04 -0500, David Friedman wrote:
 
 
Anders Runesson wrote:

Hi there
I decided to give DUI/leds a try today, but I can't manage to get dui to 
 compile with gdc 0.9.

I modified the makefile just a little bit, since gdc needs "-lgc -ldl" 
to be happy, and moved some flags that appear in several places to 
variables. It's nicer this way I think, it's a lot easier to make 
changes to the flags now. Take a look at 
http://www.runesson.info/anders/Makefile.DUI if you like.

When I run make, I get a whole bunch of error messages about 
/Anders Runesson
I have built earlier versions of DUI after rearranging/removing import statements.
are those the one on the patch at http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_id=97723&atid=618893 ? let me know, I'll include it on the main development branch. Ant
As it turns out, the changes I made aren't needed with the current DMD code. That patch is all that is needed now. The 'DotTypeExp' error is a gdc bug and fix for that will be out soon. David
What platform are you using?  It shouldn't be necessary to use "-lgc".

David
Jan 08 2005
parent reply Anders Runesson <anders runesson.info> writes:
 are those the one on the patch at
 http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_
d=97723&atid=618893 

 ?

 let me know, I'll include it on the main development branch.

 Ant
As it turns out, the changes I made aren't needed with the current DMD code. That patch is all that is needed now. The 'DotTypeExp' error is a gdc bug and fix for that will be out soon. David
Here are the changes I made to get past the errors I met so far, for src/dui/ObjectG.d and src/event/EventHandler.d. The patch in the link Anders F supplied doesn't apply(at least not with my limited experience with patch/diff) but I applied the changes manually and made diff's against the latest tarball. The patch for src/dui/ObjectG.d is for one of those DotTypeExp-errors, so if it's gonna be fixed in gdc I suppose it's unnecessary. But it only removes a printf, so I thought it was harmless enough to use. I ran into some more DotTypeExp-errors(*grr*) after getting past the other errors, in src/ggl. Suppose I'll have to wait a little longer still.. /Anders Runesson
Jan 08 2005
parent reply Ant <duitoolkit yahoo.ca> writes:
On Sat, 08 Jan 2005 15:24:34 +0100, Anders Runesson wrote:

 are those the one on the patch at
 http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_
d=97723&atid=618893 

 ?

 let me know, I'll include it on the main development branch.

 Ant
As it turns out, the changes I made aren't needed with the current DMD code. That patch is all that is needed now. The 'DotTypeExp' error is a gdc bug and fix for that will be out soon. David
Here are the changes I made to get past the errors I met so far, for src/dui/ObjectG.d and src/event/EventHandler.d.
Thank you both. I'll try the keep DUI compatible with GDC from now on (or at least I'll try to report problems here). Ant
Jan 08 2005
parent David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Ant wrote:
 On Sat, 08 Jan 2005 15:24:34 +0100, Anders Runesson wrote:
 
 
are those the one on the patch at
http://sourceforge.net/tracker/index.php?func=detail&aid=1001314&group_
d=97723&atid=618893 

?

let me know, I'll include it on the main development branch.

Ant
As it turns out, the changes I made aren't needed with the current DMD code. That patch is all that is needed now. The 'DotTypeExp' error is a gdc bug and fix for that will be out soon. David
Here are the changes I made to get past the errors I met so far, for src/dui/ObjectG.d and src/event/EventHandler.d.
Thank you both. I'll try the keep DUI compatible with GDC from now on (or at least I'll try to report problems here). Ant
Here are a few things a discovered after actually trying to run the test programs: 1. In order to produce working code, DUI must be compiled with the "-fall-sources" flag. This makes GDC work like DMD when it produces multiple object file in one run. The EventHandler patch is not needed when this flag is ued. 2. The DUITests program uses nested functions for event handlers like this: void gtkDemo(Notebook notebook) { void showTTextView() { new TTextView(); } ... Button button = new Button("Text View", &showTTextView); ... } This crashes when the button is clicked. The problem is that GCC doesn't implement nested the same way as DMD. This could be fixed, but would require some significant changes to the GCC code. OTOH, I might be able to handle cases like these specially. A "static" nested function would work now, but that would require a wrapper to make it a delegate. David
Jan 09 2005
prev sibling parent reply Anders Runesson <anders runesson.info> writes:
David Friedman wrote:
 Anders Runesson wrote:
 
 Hi there
 I decided to give DUI/leds a try today, but I can't manage to get dui 
 to  compile with gdc 0.9.

 I modified the makefile just a little bit, since gdc needs "-lgc -ldl" 
 to be happy, and moved some flags that appear in several places to 
 variables. It's nicer this way I think, it's a lot easier to make 
 changes to the flags now. Take a look at 
 http://www.runesson.info/anders/Makefile.DUI if you like.

 When I run make, I get a whole bunch of error messages about 
 EventHandlerXX templates in dui/Widget.d and EventHandler.d. Here's a 
 snippet of the output from gdc:

 dui/Widget.d:372: template instance EventHandlerR!(Widget ,EventButton 
 ) forward reference to template
 dui/Widget.d:373: template instance EventHandlerR!(Widget ,EventButton 
 ) forward reference to template
 ...
 dui/Widget.d:462: variable dui.Widget.Widget.onMouseButtonPress voids 
 have no value
 dui/Widget.d:463: template instance EventHandlerR!(Widget ,EventButton 
 ) is used as a type
 dui/Widget.d:463: variable dui.Widget.Widget.onMouseButtonRelease 
 voids have no value
 ...
 dui/ObjectG.d: In member function `dump':
 dui/ObjectG.d:145: error: DotTypeExp::toElem: don't know what to do 
 (this.Object)
 dui/ObjectG.d:145: confused by earlier errors, bailing out
 make: *** [dui_COMP] Fel 1


 The function dump from the last bit looks like:
     public: void dump()
     {

         printf("\n%.*s", Object.toString());
         printf("\tg_type_instance %X\n",Object.g_type_instance);
         printf("\tref_count %d\n",gObject.ref_count);
         printf("\tqdata* %X\n",gObject.qdata);
     }

 And the error goes away if the line with
 printf("\n%.*s", Object.toString());
 is removed.

 The other stuff I don't know how to fix. It's in class widget in 
 Widget.d, which is structured as(line numbers in comments) :

 public class Widget: DUIObject {
     ...
     private import dui.Event;
     private import dui.EventHandler;
     ...
 /*372*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonPress;
 /*373*/ alias EventHandlerR!(Widget, EventButton) OnMouseButtonRelease;
     ...
 /*462*/ OnMouseButtonPress onMouseButtonPress;
 /*463*/ OnMouseButtonRelease onMouseButtonRelease;
     ...
 }

 EventHandlerX is defined in EventHandler.d like so:
 class EventHandlerX(TWidget, TEvent) {
 ...
 }

 If I remove the "import EventHandler"-line in Widget I get "symbol not 
 defined"-errors in stead, so the declarations are seen when compiling 
 Widget.

 Am I missing something? Is it supposed to build with gdc at all? Has 
 anyone managed to get it done?

 /Anders Runesson
I have built earlier versions of DUI after rearranging/removing import statements. What platform are you using? It shouldn't be necessary to use "-lgc". David
I'm on gentoo. I used to get a bunch of linker errors without -lgc, but now I tried and I don't get them anymore. Probably just some stupidity on my part.. :) I'll look into the imports, thanks for the tip /Anders Runesson
Jan 08 2005
parent reply Anders Runesson <anders runesson.info> writes:
Anders Runesson wrote:
 I have built earlier versions of DUI after rearranging/removing import 
 statements.

 What platform are you using?  It shouldn't be necessary to use "-lgc".

 David
I'm on gentoo. I used to get a bunch of linker errors without -lgc, but now I tried and I don't get them anymore. Probably just some stupidity on my part.. :)
Oops, was a little to hasty there.. Seems I do need -lgc to link into executables, or I get errors like: 625: undefined reference to `GC_arrays' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_ ep.o)(.text+0xac4): In function `GC_print_address_map': /var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3228: undefined reference to `GC_err_puts' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_dep.o)(.text+0xb13):/var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3234: undefined reference to `GC_err_write' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_dep.o)(.text+0xb27):/var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3237: undefined reference to `GC_err_puts' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_ ep.o)(.text+0x2e5): In function `GC_default_push_other_roots': /var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:1668: undefined reference to `GC_push_all_stacks #gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,objc --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib --enable-__cxa_atexit --enable-clocale=generic Thread model: posix gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6) #gdc -v>gdc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: ./configure --prefix=/usr --enable-shared --enable-threads=posix --enable-languages=d Thread model: posix gcc version 3.3.4 Are there any steps one should take to not have to give -lgc? Did I miss something? It's not a big deal really, mostly curious.. /Anders Runesson
Jan 08 2005
parent David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Anders Runesson wrote:
 Anders Runesson wrote:
 
 I have built earlier versions of DUI after rearranging/removing 
 import statements.

 What platform are you using?  It shouldn't be necessary to use "-lgc".

 David
I'm on gentoo. I used to get a bunch of linker errors without -lgc, but now I tried and I don't get them anymore. Probably just some stupidity on my part.. :)
Oops, was a little to hasty there.. Seems I do need -lgc to link into executables, or I get errors like: 625: undefined reference to `GC_arrays' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_ ep.o)(.text+0xac4): In function `GC_print_address_map': /var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3228: undefined reference to `GC_err_puts' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_dep.o)(.text+0xb13):/var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3234: undefined reference to `GC_err_write' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_dep.o)(.text+0xb27):/var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:3237: undefined reference to `GC_err_puts' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/../../../libphobos.a(d_os_ ep.o)(.text+0x2e5): In function `GC_default_push_other_roots': /var/tmp/portage/phobos-0.9/work/gcc-3.3.4/gcc/d/phobos/boehm gc/d_os_dep.c:1668: undefined reference to `GC_push_all_stacks #gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,objc --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib --enable-__cxa_atexit --enable-clocale=generic Thread model: posix gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6) #gdc -v>gdc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: ./configure --prefix=/usr --enable-shared --enable-threads=posix --enable-languages=d Thread model: posix gcc version 3.3.4 Are there any steps one should take to not have to give -lgc? Did I miss something? It's not a big deal really, mostly curious.. /Anders Runesson
My best guess is that d_os_dep.c is not being created properly. The phobos makefile creates this by patching boehm-gc/os_dep.c and effectively cuts out half of the file. There should not be references to lines numbers past about 1450. David
Jan 08 2005