Sign up

Can't build gtkD

Hello,

I am trying to run a Hello World program but I have trouble setting up gtkD. I first tried building gtkD the manual way (following the wiki) by downloading it from GitHub (commit 317b811) and running rdmd Build.d. While I can make a Build.exe, running it results in this error:

generated/gtkd\pango\c\types.d(2159): Error: struct pango.c.types.PangoCairoFontMap conflicts with struct pango.c.types.PangoCairoFontMap at generated/gtkd\pango\c\types.d(1217)

When I try the 64-bits version rdmd -m64 Build.d it gives this error:

Error: can't run '\bin\link.exe', check PATH

I also tried putting it in my DUB dependencies:

"dependencies": {
	"gtk-d": "~>3.6.5"
},

But then when I run dub build --force it gives this output:

Linking...
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
..\..\..\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\.dub\build\library-debug-windows-x86-dmd_2074-96367D1AA4D5586A22A54E9A562624C0\gtk-d.lib
 Warning 178: .LIB pagesize exceeds 512
..\..\..\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\.dub\build\library-debug-windows-x86-dmd_2074-96367D1AA4D5586A22A54E9A562624C0\gtk-d.lib
 Error 7: Out of Memory
Error: linker exited with status 1
dmd failed with exit code 1.

How do I fix this?

Re: Can't build gtkD

On 05/31/2017 06:17 PM, Dennis wrote:

Hello,

I am trying to run a Hello World program but I have trouble setting up gtkD. I first tried building gtkD the manual way (following the wiki) by downloading it from GitHub (commit 317b811) and running rdmd Build.d. While I can make a Build.exe, running it results in this error:

generated/gtkd\pango\c\types.d(2159): Error: struct pango.c.types.PangoCairoFontMap conflicts with struct pango.c.types.PangoCairoFontMap at generated/gtkd\pango\c\types.d(1217)

master seems to be broken, but the latest release should work:
https://github.com/gtkd-developers/GtkD/releases/tag/v3.6.5
https://gtkd.org/Downloads/sources/GtkD-3.6.5.zip

When I try the 64-bits version rdmd -m64 Build.d it gives this error:

Error: can't run '\bin\link.exe', check PATH

For 64bit builds on Windows dmd needs the Windows SDK, and the paths to
the SDK to be properly set in sc.ini. The dmd installer should do this
automatically if the SDK is installed.

More information here:
https://wiki.dlang.org/InstallingDMDon64-bitWindows7(COFF-compatible)

I also tried putting it in my DUB dependencies:

"dependencies": {
	"gtk-d": "~>3.6.5"
},

But then when I run dub build --force it gives this output:

Linking...
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
..\..\..\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\.dub\build\library-debug-windows-x86-dmd_2074-96367D1AA4D5586A22A54E9A562624C0\gtk-d.lib
  Warning 178: .LIB pagesize exceeds 512
..\..\..\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\.dub\build\library-debug-windows-x86-dmd_2074-96367D1AA4D5586A22A54E9A562624C0\gtk-d.lib
  Error 7: Out of Memory
Error: linker exited with status 1
dmd failed with exit code 1.

How do I fix this?

Due to a dmd/optlink bug we can't build debug builds of GtkD on Windows.
Pass --build=plain to dub so it does a regular build.

Re: Can't build gtkD

On 05/31/2017 07:11 PM, Mike Wey wrote:

master seems to be broken, but the latest release should work:
https://github.com/gtkd-developers/GtkD/releases/tag/v3.6.5
https://gtkd.org/Downloads/sources/GtkD-3.6.5.zip

Also fixed in master:
https://github.com/gtkd-developers/GtkD/commit/b97dd5ae73799b2d40c5bd94580e93f50c9e6a99

Re: Can't build gtkD

Thanks for your response.

I can now compile and build an executable, but running it gives a pop-up saying (translated):

Can't find entry point of procedure FT_Get_BDF_Property in DLL C:\Program Files\Gtk-Runtime\bin\libfontcongif-1.dll.

When I run it via Eclipse it outputs to the console:

object.Exception@......\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\generated\gtkd\gtkd\Loader.d(125): Library load failed (libgdk-3-0.dll): The specified module could not be found.

Re: Can't build gtkD

On 05/31/2017 07:32 PM, Dennis wrote:

Thanks for your response.

I can now compile and build an executable, but running it gives a pop-up saying (translated):

Can't find entry point of procedure FT_Get_BDF_Property in DLL C:\Program Files\Gtk-Runtime\bin\libfontcongif-1.dll.

When I run it via Eclipse it outputs to the console:

object.Exception@......\AppData\Roaming\dub\packages\gtk-d-3.6.5\gtk-d\generated\gtkd\gtkd\Loader.d(125): Library load failed (libgdk-3-0.dll): The specified module could not be found.

It looks like you are using the 64bit version of the Gtk Runtime, did
you compile gtkD and the executable as 64bit?

Re: Can't build gtkD

On Wed, 31 May 2017 22:22:15 +0200, Mike Wey wrote:

It looks like you are using the 64bit version of the Gtk Runtime, did
you compile gtkD and the executable as 64bit?

I made an error in copying the error text. The DLL is not in:
C:\Program Files\Gtk-Runtime\bin\libfontcongif-1.dll
But in:
C:\Program Files (x86)\Gtk-Runtime\bin\libfontcongif-1.dll

Both of those directories exist though, I installed both the 32-bit version and the 64-bit version of the runtime. I also tried to compile both the 32-bit and 64-bit version, I don't know which version dub uses.

Trying manual again

I uninstalled the 64-bit runtime, cloned the repo and built without the -m64 flag. The build was successful this time, but I'm not sure about this step:

4. Copy GtkDExtractionDir\src to dmddir\src\gtkd

I copied the src folder from C:\D\GtkD\src\, but it says:

dmd hello.d -Lgtkd.lib
hello.d(1): Error: module MainWindow is in file 'gtk\MainWindow.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
import path[2] = C:\D\dmd2\windows\bin\..\..\src\gtkd

MainWindow.d is in C:\D\GtkD\generated\gtkd\gtk which I didn't copy, so I copied \generated\gtkd\ as well. I replaced the files that were in conflict with the already existing files. Running dmd hello.d -Lgtkd.lib gives:

OPTLINK : Warning 9: Unknown Option : NOIGTKD.LIB
hello.obj(hello)
 Error 42: Symbol Undefined _D3gtk5Label5Label6__ctorMFAyabZC3gtk5Label5Label
hello.obj(hello)
 Error 42: Symbol Undefined _D3gtk10MainWindow10MainWindow7__ClassZ
hello.obj(hello)

Demos

I tried dub run --build=plain on the demos in the repo:

DemoActions: The function you are calling is not pressent in your version of GTK+.
DemoCustomList: ..\..\..\generated\gtkd\gtkd\Implement.d(351,2): Warning: statement is not reachable
DemoMultiCellRenderer: works
DemoMultithread: works
TestWindow: works, but outputs errors:

failed (libatk-1.0-0.dll) atk_document_get_current_page_number
failed (libatk-1.0-0.dll) atk_object_get_object_locale
(...) ~1700 lines
failed (libpango-1.0-0.dll) pango_renderer_get_alpha
failed (libpango-1.0-0.dll) pango_renderer_set_alpha

(TestWindow.exe:6516): Gtk-CRITICAL **: gtk_menu_attach: assertion 'left_attach < right_attach' failed

(...) more such errors after interacting with widgets

Re: Can't build gtkD

On 06/01/2017 12:28 AM, Dennis wrote:

On Wed, 31 May 2017 22:22:15 +0200, Mike Wey wrote:

It looks like you are using the 64bit version of the Gtk Runtime, did
you compile gtkD and the executable as 64bit?

I made an error in copying the error text. The DLL is not in:
C:\Program Files\Gtk-Runtime\bin\libfontcongif-1.dll
But in:
C:\Program Files (x86)\Gtk-Runtime\bin\libfontcongif-1.dll

Both of those directories exist though, I installed both the 32-bit version and the 64-bit version of the runtime. I also tried to compile both the 32-bit and 64-bit version, I don't know which version dub uses.

I think dub defaults to 32bit on Windows.

Trying manual again

I uninstalled the 64-bit runtime, cloned the repo and built without the -m64 flag. The build was successful this time, but I'm not sure about this step:

4. Copy GtkDExtractionDir\src to dmddir\src\gtkd

Sorry, that is some outdated info. You should move generated\gtkd.

I copied the src folder from C:\D\GtkD\src\, but it says:

dmd hello.d -Lgtkd.lib
hello.d(1): Error: module MainWindow is in file 'gtk\MainWindow.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
import path[2] = C:\D\dmd2\windows\bin\..\..\src\gtkd

MainWindow.d is in C:\D\GtkD\generated\gtkd\gtk which I didn't copy, so I copied \generated\gtkd\ as well. I replaced the files that were in conflict with the already existing files. Running dmd hello.d -Lgtkd.lib gives:

OPTLINK : Warning 9: Unknown Option : NOIGTKD.LIB
hello.obj(hello)
  Error 42: Symbol Undefined _D3gtk5Label5Label6__ctorMFAyabZC3gtk5Label5Label
hello.obj(hello)
  Error 42: Symbol Undefined _D3gtk10MainWindow10MainWindow7__ClassZ
hello.obj(hello)

The linkers used differ between the 32 and 64 bit versions of dmd. Which
unfortunately use different flags to link with a library.

It's -L+gtkd.lib when building a 32bit application and -Lgtkd.lib
for 64bit. (I've updated the wiki to hopefully make that clearer)

Demos

I tried dub run --build=plain on the demos in the repo:

DemoActions: The function you are calling is not pressent in your version of GTK+.
DemoCustomList: ..\..\..\generated\gtkd\gtkd\Implement.d(351,2): Warning: statement is not reachable
DemoMultiCellRenderer: works
DemoMultithread: works
TestWindow: works, but outputs errors:

failed (libatk-1.0-0.dll) atk_document_get_current_page_number
failed (libatk-1.0-0.dll) atk_object_get_object_locale
(...) ~1700 lines
failed (libpango-1.0-0.dll) pango_renderer_get_alpha
failed (libpango-1.0-0.dll) pango_renderer_set_alpha

(TestWindow.exe:6516): Gtk-CRITICAL **: gtk_menu_attach: assertion 'left_attach < right_attach' failed

(...) more such errors after interacting with widgets

While the TestWindow demo will always print a list of functions that
couldn't be loaded as it does this explicitly. Mostly linux only functions.

Most of these errors would indicate you are using an old version of Gtk+
or at least GtkD finds some old version that is still installed someware.

The gtk_menu_attach: assertion 'left_attach < right_attach' failed for
example was fixed in Gtk+ 3.18, while the latest installer on gtkd.org
is for Gtk+ 3.22.

Re: Can't build gtkD

On Thu, 1 Jun 2017 20:39:31 +0200, Mike Wey wrote:

The linkers used differ between the 32 and 64 bit versions of dmd. Which
unfortunately use different flags to link with a library.
It's -L+gtkd.lib when building a 32bit application and -Lgtkd.lib
for 64bit. (I've updated the wiki to hopefully make that clearer)

Using -L+gtkd.lib I could succesfully compile and run a hello world program.

It turns out that the Can't find entry point of procedure FT_Get_BDF_Property in DLL C:\Program Files (x86)\Gtk-Runtime\bin\libfontcongif-1.dll happens when I run the .exe in a folder containing libfontcongif-1.dll. That file was still there from when I tried DLangUI I think.

Most of these errors would indicate you are using an old version of Gtk+
or at least GtkD finds some old version that is still installed someware.

The gtk_menu_attach: assertion 'left_attach < right_attach' failed for
example was fixed in Gtk+ 3.18, while the latest installer on gtkd.org
is for Gtk+ 3.22.

I have "Gtk+ Runtime version 3.8.1-2" published by "GtkD Developers" installed on "30-May-17". I don't believe I got it from gtkd.org so I might run the demo again after reinstalling it from there.

Anyway thanks for the help, I can now compile and run the hello world program both with dub and dmd -L+gtkd.lib so I'll try making a simple application this weekend. :)