View previous topic :: View next topic |
Author |
Message |
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Wed Nov 14, 2007 1:03 am Post subject: GtkD Problems |
|
|
Hi,
I have Kubuntu 7.04.
I have a problem with the 'helloworld' code that I found in this page:
http://www.dsource.org/projects/dui/wiki/CodeExamples
When I attempt to compile it returns me this.
Someone can help me?
Thank you very much |
|
Back to top |
|
|
Erihel
Joined: 19 Jun 2007 Posts: 3
|
Posted: Wed Nov 14, 2007 3:33 am Post subject: |
|
|
It's a linking problem. Basically the linker knows what functions to call but doesn't know where to find them as you didn't give him the info. You have to add "-ldl -lgtkd" to gcc (before -lphobos) so linker will know what libraries to link with your program.
Based on what you posted it'll be:
Code: | gcc helloworld.o -o helloworld -m32 -ldl -lgtkd -lphobos -lpthread -lm |
Info http://www.dsource.org/projects/dui/wiki/GettingStarted |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Wed Nov 14, 2007 6:39 am Post subject: |
|
|
Thanks for the answer.
However it returns me this now:
Code: |
~/prgd/gtkD/src$ gcc helloworld.o -o helloworld -m32 -ldl -lgtkd -lphobos -lpthread -lm
/usr/bin/ld: cannot find -lgtkd
collect2: ld returned 1 exit status
|
Maybe there is something wrong... |
|
Back to top |
|
|
Erihel
Joined: 19 Jun 2007 Posts: 3
|
Posted: Wed Nov 14, 2007 11:38 am Post subject: |
|
|
You didn't install gtkD in gcc/dmd directory or somewhere where gcc checks ? Then you have to tell gcc which dir is it. You do this by using -L<path> (without space!!) eg. -L/usr/src (just put a dir where libduit.lib or something like that is). Just add it to the rest or params.
You don't need it now but there is also -I<path> to tell which directory to check when looking for .d files (or .h files in c/c++). |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Thu Nov 15, 2007 3:08 am Post subject: |
|
|
I installed GtkD some weeks ago, so I didn't remember that I had an installation problem. I will post it in the night (GMT +1).
Thanks. |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Thu Nov 15, 2007 4:48 am Post subject: |
|
|
Yep, only it's libgtkd.a on linux and gtkd.lib on windows.
Other than that, do what he says and it'll work. |
|
Back to top |
|
|
kaarna
Joined: 03 Apr 2006 Posts: 92 Location: Finland
|
Posted: Thu Nov 15, 2007 6:02 am Post subject: |
|
|
Just to give you another option for installing with DSSS and for easy compiling:
http://www.dsource.org/projects/dui/wiki/BuildingWithDSSS
So, after installing gtkD with DSSS, you create the following dsss.conf file into the same dir, where you have your helloworld.d:
Code: | name = hello
requires = gtkD
[helloworld.d]
type = binary
target = helloworld
buildflags = -I/usr/local/include/d/src -L-ldl
|
Then you just run
As always with my tips, I can't test this because of not having my computer available today. But it should work... |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Thu Nov 15, 2007 4:06 pm Post subject: |
|
|
I'm starting installing GtkD via dsss and installation seems to go well.
Then I build helloworld and it returns me a long out put. Something went wrong and it ended this:
Code: |
build => DD-build
+ /usr/bin/rebuild -Idsss_imports/ -I. -S./ -I/usr/include/d -S/usr/lib/ -I/usr/include/d -S/usr/lib -I/home/provolik/d/include/d -S/home/provolik/d/lib -oqdsss_objs/D -explicit -lib build/duit.d -oflibDD-build.a
build/duit.d(181): module Duit cannot read file 'gtk/Duit.d'
Command /usr/bin/rebuild returned with code 256, aborting.
Error: Command failed, aborting.
|
I think I have a wrong installation :-\ |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Fri Nov 16, 2007 5:02 am Post subject: |
|
|
It hasn't been called Duit in a long while and you're trying to use the old duit.d file, which doesn't exist any more.
I would recommend you download the latest GtkD, either from SVN or from the homepage, and install with the included scripts.
To compile Hello World afterwords, just run dmd helloworld.d and you should be good. |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Fri Nov 16, 2007 4:54 pm Post subject: |
|
|
I tried to compile launching ./makeAll.sh but, after a long output, it returns this:
Code: |
ExecutorSync.execute=
gcc obj/demos/gda/TestGda.o -o gdaTest -m32 -L.. -L. -L/home/provolik/prgd/gtkD -L/home/provolik/prgd/gtkD -L/home/provolik/prgd/gtkD -lgda -lgtkd -ldl -lstdc++ -lphobos -lgtkd -ldl -lgtkd -ldl -lstdc++ -lphobos -g -m32 -lphobos -lpthread -lm
./libgtkd.a(Pixbuf.o):(.data+0x8c): undefined reference to `_D9gdkpixbuf12PixbufFormat12__ModuleInfoZ'
collect2: ld returned 1 exit status
./makeAll.sh: 15: ./compdGladetest.sh: not found
|
|
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Fri Nov 16, 2007 5:04 pm Post subject: |
|
|
Okay, I renamed the file ./compdGladeTest.sh in ./compdGladetest.sh and then I re-launch ./makeAll.sh
It returns this, after a long output:
Code: |
ExecutorSync.execute=
gcc obj/demos/glade/testGlade.o -o gladeTest -m32 -L.. -L. -L/home/provolik/prgd/gtkD -L/home/provolik/prgd/gtkD -lgtkd -ldl -lstdc++ -lphobos -lgtkd -ldl -g -m32 -lphobos -lpthread -lm
obj/demos/glade/testGlade.o:(.data+0x40): undefined reference to `_D5glade5Glade12__ModuleInfoZ'
obj/demos/glade/testGlade.o: In function `_Dmain':
/home/provolik/prgd/gtkD/demos/glade/testGlade.d:26: undefined reference to `_D5glade5Glade5Glade7__ClassZ'
/home/provolik/prgd/gtkD/demos/glade/testGlade.d:26: undefined reference to `_D5glade5Glade5Glade5_
ctorMFAaAaAaZC5glade5Glade5Glade'
./libgtkd.a(Pixbuf.o):(.data+0x8c): undefined reference to `_D9gdkpixbuf12PixbufFormat12__ModuleInfoZ'
collect2: ld returned 1 exit status
|
|
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Sat Nov 17, 2007 6:20 am Post subject: |
|
|
you don't NEED to run the makeAll.sh. You can get away with just running compdGtkD.sh and it'll be fine. |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Sat Nov 17, 2007 6:28 am Post subject: |
|
|
Okay, I run only compdGtkD.sh and it runs well without error...
However if I attempt to compile helloworld.d it returns thus:
Code: |
pk-linux:~/prgd/gtkD/src$ gcc helloworld.o -o helloworld -m32 -ldl -lgtkd -lphobos -lpthread -lm
/usr/bin/ld: cannot find -lgtkd
collect2: ld returned 1 exit status
|
Now I am at the starting point... |
|
Back to top |
|
|
ShprotX
Joined: 28 Aug 2007 Posts: 24 Location: Ukraine
|
Posted: Sat Nov 17, 2007 6:49 am Post subject: |
|
|
darthsight wrote: | Code: | pk-linux:~/prgd/gtkD/src$ gcc helloworld.o -o helloworld -m32 -ldl -lgtkd -lphobos -lpthread -lm
/usr/bin/ld: cannot find -lgtkd
collect2: ld returned 1 exit status
| Now I am at the starting point... |
What does "find /lib /usr/lib /usr/local/lib -name libgtkd.a" say? I think you don't have libgtkd.a installed. |
|
Back to top |
|
|
darthsight
Joined: 13 Nov 2007 Posts: 16
|
Posted: Sat Nov 17, 2007 7:01 am Post subject: |
|
|
It returns nothing.
How can I install it? |
|
Back to top |
|
|
|