Thread overview | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 16, 2019 Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Hi guys, I finally got a Linux Mint installation happening (very impressed, BTW) and did the usual HelloWorld.d compile with dmd, but I'm having trouble working out how to link to GtkD. dmd -de -w -m64 -L+gtkd hello_gtkd_world.d says it can't find MainWindow which tells me the gtkd libraries are not installed, are not included in the path, or some other oversight on my part. I tried using whereis to find gtkd, but to no avail. Questions: 1. Am I using the right syntax in the above command line? 2. How to search for things on Linux Mint The recommendations I've found so far are for the gnome search tool which spits out an error: Package gnome-search-tool is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source |
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Saturday, 16 February 2019 at 13:35:57 UTC, Ron Tarrant wrote: > Hi guys, > > I finally got a Linux Mint installation happening (very impressed, BTW) and did the usual HelloWorld.d compile with dmd, but I'm having trouble working out how to link to GtkD. > > dmd -de -w -m64 -L+gtkd hello_gtkd_world.d > > says it can't find MainWindow which tells me the gtkd libraries are not installed, are not included in the path, or some other oversight on my part. > > I tried using whereis to find gtkd, but to no avail. > > Questions: > > 1. Am I using the right syntax in the above command line? > > 2. How to search for things on Linux Mint > > The recommendations I've found so far are for the gnome search tool which spits out an error: > > Package gnome-search-tool is not available, but is referred to by another package. > This may mean that the package is missing, has been obsoleted, or > is only available from another source if you do it manually you will have to compile gtkd using the Makefile, move the library stuff to somewhere and add -I/path/to/gtkd/src" somewhere. You will also need to `apt install libgtk-3-dev` Maintaining GtkD with compiler and gtk updates will be kind of a pain, I recommend using dub instead to manage it all for you (except the apt install part) If you don't want to manually compile gtkd with any update breaking it, you can also use the d-apt (https://d-apt.sourceforge.io/) and `apt install libgtkd3-nn libgtkd3-dev libgtkd3-doc` But I still recommend using dub instead, you don't need to make a manual build file or remember the build command with it, you just run `dub` and it fetches and compiles GtkD if it's out of date or the compiler updated :) |
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant Attachments:
| On Sat, 2019-02-16 at 13:35 +0000, Ron Tarrant via Digitalmars-d-learn wrote: > Hi guys, > > I finally got a Linux Mint installation happening (very impressed, BTW) and did the usual HelloWorld.d compile with dmd, but I'm having trouble working out how to link to GtkD. > > dmd -de -w -m64 -L+gtkd hello_gtkd_world.d The Debian/Ubuntu/Mint way of doing things is either to just use Dub, or to install libgtkd-3-dev and then use pgk-config to determine all the correct options – I usually use the packaged libgtkd-3 since it a shared object so you don't have to suffer the static linking on every build. But I also only use LDC I don't use DMD. The commands: pkg-config --cflags gtkd-3 pkg-config --libs gtkd-3 deliver up the flags and libs specifications for use with dmd and ldmd2. > says it can't find MainWindow which tells me the gtkd libraries are not installed, are not included in the path, or some other oversight on my part. > > I tried using whereis to find gtkd, but to no avail. > > Questions: > > 1. Am I using the right syntax in the above command line? 'Fraidn not. > 2. How to search for things on Linux Mint It's all down to pkg-config for querying for flags and options for installed libraries. > The recommendations I've found so far are for the gnome search tool which spits out an error: > > Package gnome-search-tool is not available, but is referred to by > another package. > This may mean that the package is missing, has been obsoleted, or > is only available from another source Pass, sorry. -- Russel. =========================================== Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk |
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Saturday, 16 February 2019 at 13:35:57 UTC, Ron Tarrant wrote:
>
> dmd -de -w -m64 -L+gtkd hello_gtkd_world.d
>
DMD's -L switch means "pass the following flag to the linker". Linker arguments are system-dependent. The + is what you use on Windows to specify the library path when running DMD with the default 32-bit linker (optlink). On Linux, it's actually -L, so you should be specifying -L-Lgtkd.
Assuming, of course, gtkd is the path and not the library name.
|
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote:
> Pass, sorry.
Thanks for the replies, guys...
I quoted the above line because it's just about the only thing I understood. Let me explain...
It's been almost 20 years since I used Linux and my notes are long gone. A ton of things have changed. Like, for instance, it found all my hardware this time, without me getting involved. But also the software installation managers and lots of other things are completely unrecognizable. On top of that, my brain has (unfortunately) been molded into the Windows/Microsoft way of thinking.
I guess what I'm hoping for is a step-by-step, full-on-hand-holding, large-print with pictures tutorial for how to get GtkD and (I guess) dub working. I know the stuff you wrote is probably helpful, but I'm not well-enough versed in Linux or any flavour of UNIX ATM to understand it, pick which option I should use, and to put these commands in proper order.
So far, as I said, dmd is working. Up until now, I've avoided dub because, with so many code examples (more than 70 at present) dub would bring in a lot of file/directory clutter.
But you're saying that dub will make it easier to keep up with future changes/updates in all the various bits and bobs, so if that means I finally have to do dub, perhaps someone could point me at a good tutorial for that?
Sorry if I sound ungrateful or cranky, but I have a lot on my plate ATM and I'm getting frustrated.
|
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote:
> On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote:
>
>> Pass, sorry.
>
> Thanks for the replies, guys...
>
> I quoted the above line because it's just about the only thing I understood. Let me explain...
>
> It's been almost 20 years since I used Linux and my notes are long gone. A ton of things have changed. Like, for instance, it found all my hardware this time, without me getting involved. But also the software installation managers and lots of other things are completely unrecognizable. On top of that, my brain has (unfortunately) been molded into the Windows/Microsoft way of thinking.
>
> I guess what I'm hoping for is a step-by-step, full-on-hand-holding, large-print with pictures tutorial for how to get GtkD and (I guess) dub working. I know the stuff you wrote is probably helpful, but I'm not well-enough versed in Linux or any flavour of UNIX ATM to understand it, pick which option I should use, and to put these commands in proper order.
>
> So far, as I said, dmd is working. Up until now, I've avoided dub because, with so many code examples (more than 70 at present) dub would bring in a lot of file/directory clutter.
>
> But you're saying that dub will make it easier to keep up with future changes/updates in all the various bits and bobs, so if that means I finally have to do dub, perhaps someone could point me at a good tutorial for that?
>
> Sorry if I sound ungrateful or cranky, but I have a lot on my plate ATM and I'm getting frustrated.
Create a file sample1.d with following content
#!/usr/bin/env dub
/+ dub.sdl:
dependency "vibe-d" version="~>0.8.0"
+/
void main()
{
import vibe.d;
listenHTTP(":8080", (req, res) {
res.writeBody("Hello, World: " ~ req.path);
});
runApplication();
}
Replace the dependency with the gtkd dependency and the main coding with the gtkd coding.
To start the application you can use one of these commands
dub sample1.d
dub sample1
./sample1
Kind regards
Andre
|
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andre Pany | On Saturday, 16 February 2019 at 16:37:17 UTC, Andre Pany wrote: > On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote: >> [...] > > Create a file sample1.d with following content > > #!/usr/bin/env dub > /+ dub.sdl: > dependency "vibe-d" version="~>0.8.0" > +/ > void main() > { > import vibe.d; > listenHTTP(":8080", (req, res) { > res.writeBody("Hello, World: " ~ req.path); > }); > runApplication(); > } > > Replace the dependency with the gtkd dependency and the main coding with the gtkd coding. > > To start the application you can use one of these commands > > dub sample1.d > dub sample1 > ./sample1 > > Kind regards > Andre The dependency should be dependency "gtk-d" version="~>3.8.5" You can get this into from here http://code.dlang.org/packages/gtk-d Kind regards Andre |
February 16, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote: > On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote: > >> Pass, sorry. > > Thanks for the replies, guys... > > I quoted the above line because it's just about the only thing I understood. Let me explain... > > It's been almost 20 years since I used Linux and my notes are long gone. A ton of things have changed. Like, for instance, it found all my hardware this time, without me getting involved. But also the software installation managers and lots of other things are completely unrecognizable. On top of that, my brain has (unfortunately) been molded into the Windows/Microsoft way of thinking. > > I guess what I'm hoping for is a step-by-step, full-on-hand-holding, large-print with pictures tutorial for how to get GtkD and (I guess) dub working. I know the stuff you wrote is probably helpful, but I'm not well-enough versed in Linux or any flavour of UNIX ATM to understand it, pick which option I should use, and to put these commands in proper order. > > So far, as I said, dmd is working. Up until now, I've avoided dub because, with so many code examples (more than 70 at present) dub would bring in a lot of file/directory clutter. > > But you're saying that dub will make it easier to keep up with future changes/updates in all the various bits and bobs, so if that means I finally have to do dub, perhaps someone could point me at a good tutorial for that? > > Sorry if I sound ungrateful or cranky, but I have a lot on my plate ATM and I'm getting frustrated. Hi Ron, For one-file programs, dub usage is very easy. Placing a minimal comment-header between /+ +/ symbol comments, gets your job done like in this example ( I think the gtkd code is from one of your examples in the blog): /+ dub.sdl: -------- name "gtkhello" dflags "-dip25" "-dip1000" dependency "gtk-d:gtkd" version="~>3.8.0" +/ /* dub run --single gtkhello.d dub build --single gtkhello.d. dub gtkhello.d <arguments to hello>. */ module gtkhello; import std.stdio; import gtk.MainWindow; import gtk.Main; import gtk.Widget; import gtk.Layout; import gtk.Button; import gdk.Event; void main(string[] args) { Main.init(args); TestRigWindow myTestRig = new TestRigWindow("Test Rig"); myTestRig.showAll(); Main.run(); } // main() class TestRigWindow : MainWindow { this(string title) { // window super(title); addOnDestroy(delegate void(Widget w) { quitApp(); } ); auto myButton = new MyButt("Button Name"); auto myOtherButton = new MyOtherButt("Other Button Name"); // layout auto myLayout = new MyLayout(myButton, myOtherButton); add(myLayout); } // this() CONSTRUCTOR void quitApp() { writeln("Bye."); Main.quit(); } // quitApp() } // class myAppWindow class MyLayout : Layout { this(MyButt myButton, MyOtherButt otherButton) { super(null, null); put(myButton, 10, 20); put(otherButton, 10, 60); } // this() } // class MyLayout class MyButt : Button { this(string labelText) { super(labelText); addOnButtonRelease(&doSomething); } // this() bool doSomething(Event e, Widget w) { writeln("Something was done."); return(true); } // doSomething() } // class MyButt class MyOtherButt : Button { this(string labelText) { super(labelText); string message = "Something other than that was done."; addOnClicked(delegate void(_) { doSomething(message); } ); } // this() void doSomething(string messageText) { writeln(messageText); } // doSomething() } --- Antonio |
February 17, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | El 16/2/19 a les 14:35, Ron Tarrant via Digitalmars-d-learn ha escrit: > Hi guys, > > I finally got a Linux Mint installation happening (very impressed, BTW) and did the usual HelloWorld.d compile with dmd, but I'm having trouble working out how to link to GtkD. > > dmd -de -w -m64 -L+gtkd hello_gtkd_world.d > > says it can't find MainWindow which tells me the gtkd libraries are not installed, are not included in the path, or some other oversight on my part. > > I tried using whereis to find gtkd, but to no avail. > > Questions: > > 1. Am I using the right syntax in the above command line? > > 2. How to search for things on Linux Mint > > The recommendations I've found so far are for the gnome search tool which spits out an error: > > Package gnome-search-tool is not available, but is referred to by another package. > This may mean that the package is missing, has been obsoleted, or > is only available from another source > Hello Ron, There is "d-apt" <https://d-apt.sourceforge.io/> where there are dmd and gtkd deb for Linux Mint. To add this repository to your Linux Mint just run this two lines from command line: $ sudo wget https://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list $ sudo apt-get update --allow-insecure-repositories && sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && sudo apt-get update After that you can install all the packages on "d-apt". To install dmd compiler, dmd doc, gtkd devel and gtkd doc packages just run the next line: $ sudo apt-get install dmd-compiler dmd-doc libgtkd3-dev libgtkd3-doc Then you can compile/run a GtkD example contained on gtkd doc archive. To do that just run the next line: $ dmd `pkg-config --cflags --libs gtkd-3` -run /usr/share/libgtkd3-doc/demos/gtkD/TestWindow/*.d -ofTestWindow To run the compiled example just type: $ ./TestWindow There are more examples at /usr/share/libgtkd3-doc/demos/ Hope this help you. Jordi |
February 17, 2019 Re: Linux & DMD & GtkD | ||||
---|---|---|---|---|
| ||||
El 17/2/19 a les 15:19, Jordi Sayol ha escrit: > Then you can compile/run a GtkD example contained on gtkd doc archive. To do that just run the next line: > > $ dmd `pkg-config --cflags --libs gtkd-3` -run /usr/share/libgtkd3-doc/demos/gtkD/TestWindow/*.d -ofTestWindow Sorry, do not run at compile time. Just remove "-run" to properly compile the example: $ dmd `pkg-config --cflags --libs gtkd-3` /usr/share/libgtkd3-doc/demos/gtkD/TestWindow/*.d -ofTestWindow > > > To run the compiled example just type: > > $ ./TestWindow Regards, Jordi |
Copyright © 1999-2021 by the D Language Foundation