February 18, 2019
On Sat, 2019-02-16 at 16:28 +0000, Ron Tarrant via Digitalmars-d-learn wrote:
> 
> […]

Apologies for the delay in replying.

> 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.

Personally I use aptitude for all Debian package management – Ubuntu and Mint are the same as Debian really in this but with different package repositories. Some people use apt and some apt-get, etc. For me the advantage of aptitude is that it has a curses-based GUI as well as command line.

> 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.

|> aptitude search gtkd
i A libgtkd-3-0                        - GTK+ graphical user interface library
- D bin
i A libgtkd-3-dev                      - GTK+ graphical user interface library
- devel
p   libgtkd3-67                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-68                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-69                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-70                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-71                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-72                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-73                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-74                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-75                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-76                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-77                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-78                        - gtkd3 for dmd2 (runtime
library)
p   libgtkd3-79                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-80                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-81                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-82                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-83                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-84                        - GtkD3 for DMD2 (runtime
library)
p   libgtkd3-dev                       - GtkD3 for DMD2 (development
files)
i   libgtkd3-doc                       - GtkD3 for DMD2 (documentation and
examples)
p   libgtkdatabox-dev                  - Gtk+ library to display large amounts
of nume
p   libgtkdatabox-doc                  - Gtk+ library to display large amounts
of nume
p   libgtkdatabox0                     - Gtk+ library to display large amounts
of nume
p   libgtkdatabox0-glade               - Gtk+ library to display large amounts
of nume
p   libgtkdatabox0-libglade            - Gtk+ library to display large amounts
of nume
p   libgtkdsv-3-0                      - GTK+ syntax highlighting widget - D
bindings
p   libgtkdsv-3-dev                    - GTK+ syntax highlighting widget -
development

I am using the GtkD package created by the D Debian package people. This is created using LDC rather than DMD. All the other libgtkd3 packages are ones build by Jordi Sayol on D-Apt. If you want to use DMD, it is probably best to install them. Me, I am an LDC oriented person so am happy with the standard Debian packaged GtkD.

The libgtkd-3-0 package contains just the runtime libraries, or library in this case. This being Linux libraries are always shared objects (aka DLLs):

> dpkg -L libgtkd-3-0
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libgtkd-3.so.0.8.5
/usr/share
/usr/share/doc
/usr/share/doc/libgtkd-3-0
/usr/share/doc/libgtkd-3-0/changelog.Debian.gz
/usr/share/doc/libgtkd-3-0/changelog.gz
/usr/share/doc/libgtkd-3-0/copyright
/usr/lib/x86_64-linux-gnu/libgtkd-3.so.0

The  libgtkd-3-dev  package contains all the files needed to build code against GtkD.

 |> dpkg -L libgtkd-3-dev
/.
/usr
/usr/include
/usr/include/d
/usr/include/d/gtkd-3
…
[all the GtkD sources.]
…
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/gtkd-3.pc
/usr/share
/usr/share/doc
/usr/share/doc/libgtkd-3-dev
/usr/share/doc/libgtkd-3-dev/changelog.Debian.gz
/usr/share/doc/libgtkd-3-dev/changelog.gz
/usr/share/doc/libgtkd-3-dev/copyright
/usr/lib/x86_64-linux-gnu/libgtkd-3.so

The last file here is crucial since it is the file you link your code against to get the version currently on this system.  The file:

/usr/lib/x86_64-linux-gnu/pkgconfig/gtkd-3.pc

is critical since it tells the compiler where to look for stuff.

|> more /usr/lib/x86_64-linux-gnu/pkgconfig/gtkd-3.pc
Name: GtkD
Description: A D binding and OO wrapper for GTK+.
Version: 3.8.5
Libs: -L-L/usr/lib/x86_64-linux-gnu/ -L-lgtkd-3 -L-ldl
Cflags: -I/usr/include/d/gtkd-3/

> 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.

In this situation, I tend to use SCons as a build manager. I also use Meson, but the /usr/lib/x86_64-linux-gnu/pkgconfig/gtkd-3.pc is, sadly, inconsistent with the way Meson works, so you have to use a bit of a hideous hack to get things working. That is for later not now.

So here is a "Hello World in D" project I have:

|> tree
.
├── cmake-d -> /home/users/russel/Repositories/Git/Forks/CMake-D/cmake-d
├── CMakeLists.txt
├── dub.sdl
├── dub.selections.json
├── meson.build
├── SConstruct
└── source
    ├── gtkd_button.d
    ├── gtkd_label.d
    ├── qtd.d
    ├── SConscript
    └── text.d

1 directory, 11 files

The CMake-D build is broken, so we have to ignore that.

The QtD is a work in progress, that isn't actually progressing.

Let me point you at https://bitbucket.org/russel/helloworld/src/default/D/
rather than cut and past the SCons files here. The summary is a SCons file is a Python script (Python 3.7 in my case) that calculates a build ADG and then actions any needed changes. The result in this case:

|> scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
ldc2 -I=. -O -release -I/usr/include/d/gtkd-3/ -c -of=Build_SCons/gtkd_button.o source/gtkd_button.d
ldc2 -of=Build_SCons/gtkd_button -L-L/usr/lib/x86_64-linux-gnu/ Build_SCons/gtkd_button.o -L-lgtkd-3 -L-ldl
ldc2 -I=. -O -release -I/usr/include/d/gtkd-3/ -c -of=Build_SCons/gtkd_label.o source/gtkd_label.d
ldc2 -of=Build_SCons/gtkd_label -L-L/usr/lib/x86_64-linux-gnu/ Build_SCons/gtkd_label.o -L-lgtkd-3 -L-ldl
ldc2 -I=. -O -release -c -of=Build_SCons/text.o source/text.d
ldc2 -of=Build_SCons/text Build_SCons/text.o
scons: done building targets.

The calls to pkg-config have picked up the needed -L-L and -L-l options in order for it to build.

I had thought the Dub build worked, but it doesn't. :-(

> 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?

Sort of. Using the Debian packages, things get updated when the packagers update things. They are usually pretty quick. Using Dub, you have to bit more hands on given the dependency version in the dub.sdl file.

> Sorry if I sound ungrateful or cranky, but I have a lot on my plate ATM and I'm getting frustrated.

Hopefully the above has helped, do feel free to ask further questions. I am a day-in, day-out Debian Sid user and so may still be making assumptions tht aren't working for you…

-- 
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 18, 2019
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

Being an old linux user, I prefer make to dub, however, I do use dub to build GtkD and then I just use dmd to build my application program.  Here is a transcript of building and running the first tutorial exercise on my computer that runs LinuxMint.  It all works nicely, when pointing the DMD compiler to the generated gtkd bindings and the linker to the dub-built library file.

peterj@helmholtz ~/work/play/dlang/GtkD $ dub clean
Cleaning package at /home/peterj/work/play/dlang/GtkD...
peterj@helmholtz ~/work/play/dlang/GtkD $ dub build
Performing "debug" build using /usr/bin/dmd for x86_64.
gtk-d:gtkd ~master: building configuration "library"...
generated/gtkd/glib/Spawn.d(305,3): Deprecation: foreach: loop index implicitly converted from size_t to int
gtk-d:gstreamer ~master: building configuration "library"...
gtk-d:peas ~master: building configuration "library"...
gtk-d:sv ~master: building configuration "library"...
gtk-d:vte ~master: building configuration "library"...
peterj@helmholtz ~/work/play/dlang/GtkD $ cd ../gtkd-example/
peterj@helmholtz ~/work/play/dlang/gtkd-example $ make
dmd -w -g -debug -I=../GtkD/generated/gtkd \
	-oftest_rig_imperative test_rig_imperative.d \
	-L../GtkD/libgtkd-3.a
peterj@helmholtz ~/work/play/dlang/gtkd-example $ ./test_rig_imperative
Hello GtkD Imperative
Bye.
peterj@helmholtz ~/work/play/dlang/gtkd-example $ dmd --version
DMD64 D Compiler v2.085.0-beta.1
Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright

February 18, 2019
On Saturday, 16 February 2019 at 19:11:03 UTC, Antonio Corbi wrote:

> 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):

> Antonio

Thanks, Antonio. That's very helpful.
February 18, 2019
On Sunday, 17 February 2019 at 14:19:35 UTC, Jordi Sayol wrote:

> To add this repository to your Linux Mint just run this two lines from command line:

> Jordi

Thanks, Jordi. This is going straight into my notes. You've saved me a ton of time and effort.
February 18, 2019
On Monday, 18 February 2019 at 13:34:22 UTC, Ron Tarrant wrote:
> You've saved me a ton of time and effort.

This can be interpreted as: flailing about, bashing my shell against the terminal.
February 18, 2019
On Monday, 18 February 2019 at 06:29:54 UTC, Russel Winder wrote:

> Hopefully the above has helped, do feel free to ask further questions. I am a day-in, day-out Debian Sid user and so may still be making assumptions tht aren't working for you…

I really appreciate all the time and effort you put into that reply, Russell. That is a ton of info there.

I didn't realize how soft (dare I say: micro-soft) Windows had made me over the last decade or so. Coming back to UNIX-like and POSIX OSs, I'm feeling like a complete newbie again.

But some day I shall reclaim my Super Cow Powers. :)
February 18, 2019
On Monday, 18 February 2019 at 13:55:41 UTC, Ron Tarrant wrote:

> But some day I shall reclaim my Super Cow Powers. :)

Oh, I guess I misspelled 'seardh.' That may explain why my attempt to run aptitude was 'put out to pasture.'

February 18, 2019
On Monday, 18 February 2019 at 10:38:10 UTC, Peter Jacobs wrote:

> Being an old linux user, I prefer make to dub, however, I do use dub to build GtkD and then I just use dmd to build my application program.

This appeals to me, too.

> dub clean
> dub build

Got this bit working after generating an sdl file. But I think I'm missing something from this next approach:

> make
> dmd -w -g -debug -I=../GtkD/generated/gtkd \
> 	-oftest_rig_imperative test_rig_imperative.d \
> 	-L../GtkD/libgtkd-3.a
> ./test_rig_imperative

It's been literally decades since I used a makefile. Did I miss the part where you the makefile was written/generated?

I'd also like to take this opportunity to express my deepest gratitude to all you guys for all this help. Getting back up and running in Linux has had its challenges and over the weekend, I admit I almost gave up after just trying to get a desktop sorted out. I won't bore you with off-topic details, but suffice to say, my Focusrite audio interface has a mind of its own.

But to wake up this morning to this outpouring of help made me feel tons better about it all. I have a build process [or five :) ] now and all the discouragement of the weekend is draining away.

Thanks, guys! Seriously. Thank you.


February 18, 2019
On Saturday, 16 February 2019 at 19:11:03 UTC, Antonio Corbi wrote:

> /+
>  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>.
> */

This is cool. And I even made it work. Again, thanks.
February 19, 2019
On Monday, 18 February 2019 at 14:24:46 UTC, Ron Tarrant wrote:
> On Monday, 18 February 2019 at 10:38:10 UTC, Peter Jacobs wrote:
>
>> Being an old linux user, I prefer make to dub, however, I do use dub to build GtkD and then I just use dmd to build my application program.
>
> This appeals to me, too.
>
>> dub clean
>> dub build
>
> Got this bit working after generating an sdl file. But I think I'm missing something from this next approach:
>
>> make
>> dmd -w -g -debug -I=../GtkD/generated/gtkd \
>> 	-oftest_rig_imperative test_rig_imperative.d \
>> 	-L../GtkD/libgtkd-3.a
>> ./test_rig_imperative
>
> It's been literally decades since I used a makefile. Did I miss the part where you the makefile was written/generated?
>

Yes, you did miss that part because I didn't write it in, thinking that the echo of the command would be sufficient.  Sorry.  Anyway, here is the single rule in my makefile.  I tend to use makefiles as a memory aid so they are often quite simple.

test_rig_imperative: test_rig_imperative.d
	dmd -w -g -debug -I=../GtkD/generated/gtkd \
		-oftest_rig_imperative test_rig_imperative.d \
		-L../GtkD/libgtkd-3.a

Cheers,
Peter J.

1 2
Next ›   Last »