Thread overview
Unable to build deimos/libX11 with ldc2
Aug 19, 2013
Paul Z. Barsan
Aug 19, 2013
David Nadlinger
Aug 19, 2013
Paul Z. Barsan
Aug 19, 2013
Adam D. Ruppe
Aug 19, 2013
Paul Z. Barsan
August 19, 2013
   I got ldc2 from github and built it following this tutorial: http://wiki.dlang.org/Building_LDC_from_source . The ldc build and install went fine but when I try to build libX11 with it, I get the following errors:

$make -j2
sh: arch: command not found
Makefile:159: warning: overriding recipe for target `install'
Makefile:156: warning: ignoring old recipe for target `install'
ldc2 -O -d -m64 -L-ldl -m64  -c deimos/X11/Xlibint.d -ofbuild/deimos/X11/Xlibint.o
sh: arch: command not found
ldc2 -O -d -m64 -L-ldl -m64  -c deimos/X11/keysym.d -ofbuild/deimos/X11/keysym.o
sh: arch: command not found
ldc2 -O -d -m64 -L-ldl -m64  -c deimos/X11/Xproto.d -ofbuild/deimos/X11/Xproto.o
sh: arch: command not found
deimos/X11/Xlibint.d(895): Error: Function type does not match previously declared function with the same mangled name: Data
make: *** [build/deimos/X11/Xlibint.o] Error 1
make: *** Waiting for unfinished jobs....

Any clues ?
August 19, 2013
On Monday, 19 August 2013 at 18:05:41 UTC, Paul Z. Barsan wrote:
> deimos/X11/Xlibint.d(895): Error: Function type does not match previously declared function with the same mangled name: Data

Without having looked at the libX11 sources at all, the error message implies that there are multiple "extern(C)" function declarations named Data that have different types. This is likely an issue with the libX11 bindings and should be fixed there.

DMD doesn't care about that, but in LDC we would have to specifically work around a related LLVM "restriction" to be able to accept that code.

Oh, and in the future, you might want to post similar questions to digitalmars.D.learn.

David
August 19, 2013
Oh, sorry for using the wrong forum section.

I used the dmd compiler and the build went fine. Is pretty weird though because ldc2 is the default compiler used to build libX11. I filed an issue report for deimos/libX11 on their project page.
August 19, 2013
BTW what do you plan to do with the libx11? You might find my simpledisplay.d (also depends on color.d) interesting from my miscellaneous github:

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

It provides a class called SimpleWindow that supports basic drawing and some input stuff (input is in the middle of an overhaul right now, I'm fixing a lot of bugs and will be posting that new code online in a few days, but even right now it still works for checking ascii keys at least), on top of Xlib, with equivalent code for Windows in there too so your same program can compile cross platform.

Though I've never tried to compile it on ldc either, I did my own xlib bindings (included in the same simpledisplay.d file) so it might work; surely won't have the *same* bugs at least.
August 19, 2013
On Monday, 19 August 2013 at 19:25:03 UTC, Adam D. Ruppe wrote:
> BTW what do you plan to do with the libx11?

It's a dependency for Cairo. I want to use Cairo for drawing stuff on the screen. This library is also used by GTK 3 to render all their widgets.Besides that, it supports multiple platforms :).

I started my widget toolkit project on github: https://github.com/tyrolite/wkd and I'll make an anouncement on the other thread once I have the code to draw a button. I'll probably get faster there using parts of your code.

Thanks !