www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Compiling the hello world example fails

reply "chmike" <christophe meessen.net> writes:
I installed dmd and dwt on my linux 13.04 PC. I also installed 
all the dependencies. I successfully compiled dwt. But compiling 
the main.d fails with an ld error.

I created the main.d file inside the dwt clone directory so that 
the command I execute from with the dwt directory is

dmd main.d -I./imp -J./org.eclipse.swt.gtk.linux.x86/res 
-L-L./lib -L-lorg.eclipse.swt.gtk.linux.x86 -L-ldwt-base

This is the error I get which means the libraries can't be found:

/usr/bin/ld: ne peut trouver -lorg.eclipse.swt.gtk.linux.x86
/usr/bin/ld: ne peut trouver -ldwt-base
collect2: erreur: ld a retourné 1 code d'état d'exécution
--- errorlevel 1

But I checked, there are a dwt-base.a and 
org.eclipse.swt.gtk.linux.x86.a file in ./lib. They are just 
archives and not lib files. Could this be the problem ?
Aug 23 2013
next sibling parent reply "chmike" <christophe meessen.net> writes:
On Friday, 23 August 2013 at 15:11:32 UTC, chmike wrote:
 dmd main.d -I./imp -J./org.eclipse.swt.gtk.linux.x86/res 
 -L-L./lib -L-lorg.eclipse.swt.gtk.linux.x86 -L-ldwt-base
adding -v I can see that everything compiles without error until the gcc command which is the following: gcc main.o -o main -m64 -L./lib -lorg.eclipse.swt.gtk.linux.x86 -ldwt-base -L/usr/lib/x86_64-linux-gnu -L/usr/lib/i386-linux-gnu -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -l:libphobos2.a -lpthread -lm -lrt The command looks Ok. Checking with gcc --help and other help variants I don't see any -Lxxx or -lxxx command line options.
Aug 23 2013
next sibling parent reply "chmike" <christophe meessen.net> writes:
Could it be that the dwt libraries are i386 while I'm trying to 
compile for an amd64 distro ?
Aug 23 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-08-23 18:16, chmike wrote:
 Could it be that the dwt libraries are i386 while I'm trying to compile
 for an amd64 distro ?
DWT is currently only for 32bit platforms. -- /Jacob Carlborg
Aug 23 2013
prev sibling parent reply "Olivier Pisano" <olivier.pisano laposte.net> writes:
Hi Christophe, welcome to D !

I suspect a 32bit/64bit link mismatch.
Aug 23 2013
parent reply "chmike" <christophe meessen.net> writes:
Adding -Wl,--verbose to see the linker verbose output I see that 
there is an error in the compilation command line. We should 
specify -L-l:org.eclipse.swt.gtk.linux.x86.a -L-l:dwt-base.a 
instead of -L-lorg.eclipse.swt.gtk.linux.x86 -L-ldwt-base

Otherwise it looks for a file named  
liborg.eclipse.swt.gtk.linux.x86.a or 
liborg.eclipse.swt.gtk.linux.x86.so.

With this change I see the the linker succeeds to open 
org.eclipse.swt.gtk.linux.x86 but then does nothing with it.

As you suggest Olivier, it could be explained if this file 
contains i386 code instead amd64 code.

I used the provided rdmd command to build dwt. Is there a special 
thing to do to build a amd64 version of the library ?
Aug 23 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-08-23 18:45, chmike wrote:
 Adding -Wl,--verbose to see the linker verbose output I see that there
 is an error in the compilation command line. We should specify
 -L-l:org.eclipse.swt.gtk.linux.x86.a -L-l:dwt-base.a instead of
 -L-lorg.eclipse.swt.gtk.linux.x86 -L-ldwt-base
What exact errors do you see?
 I used the provided rdmd command to build dwt. Is there a special thing
 to do to build a amd64 version of the library ?
DWT is currently only available as 32bit. -- /Jacob Carlborg
Aug 23 2013
parent "Olivier Pisano" <olivier.pisano laposte.net> writes:
On Friday, 23 August 2013 at 20:19:25 UTC, Jacob Carlborg wrote:
 DWT is currently only available as 32bit.
Ok then chmike you should add -m32 to the compile command line to produce a 32 bit executable.
Aug 24 2013
prev sibling parent reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Friday, 23 August 2013 at 15:11:32 UTC, chmike wrote:
 I installed dmd and dwt on my linux 13.04 PC. I also installed 
 all the dependencies. I successfully compiled dwt. But 
 compiling the main.d fails with an ld error.
It is a incompatibility with 32/64 bit, you likely will have dependency conflicts if you attempt to install the 32bit versions of your libraries. Jacob, what are your thoughts about 64 bit support. Should the Java API be changed to use size_t or should there be a conversion (probably near the call into the library)?
Aug 23 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-08-24 03:19, Jesse Phillips wrote:

 Jacob, what are your thoughts about 64 bit support. Should the Java API
 be changed to use size_t or should there be a conversion (probably near
 the call into the library)?
I would say, first stay as close to the native libraries as possible, use the correct types and so on. Second, stay as close to the SWT/Java code. I guess that would mean use size_t. -- /Jacob Carlborg
Aug 24 2013
parent reply "chmike" <christophe meessen.net> writes:
Excuse my naive question. Why can't we have a 64bit version of 
the library ?
Aug 24 2013
next sibling parent "Olivier Pisano" <olivier.pisano laposte.net> writes:
On Saturday, 24 August 2013 at 12:48:20 UTC, chmike wrote:
 Excuse my naive question. Why can't we have a 64bit version of 
 the library ?
I suggest you read the thread “What's the status on Linux/amd64 ?” in this forum. Cheers, Olivier
Aug 24 2013
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-08-24 14:48, chmike wrote:
 Excuse my naive question. Why can't we have a 64bit version of the
 library ?
No reason, it just that someone need to make any necessary changes and make sure everything works. If the native types are used I don't think it will be any problems. The Java code uses int/long for pointers, they have a script converting between these. -- /Jacob Carlborg
Aug 24 2013
parent reply "chmike" <christophe meessen.net> writes:
Sorry for the delay. I was busy.

Unfortunately adding -m32 doesn't help. The linker fails by 
spitting many references. This is probably unresolved references 
since I'm running a 64bit linux.

I can't spent more time investigating this. I hope a 64bit 
compatible version of the library will be made available some day.

I would be helpful to specify somewhere that the dwt library is 
only 32bit. If it was there I missed the information.
Aug 30 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-08-30 13:59, chmike wrote:
 Sorry for the delay. I was busy.

 Unfortunately adding -m32 doesn't help. The linker fails by spitting
 many references. This is probably unresolved references since I'm
 running a 64bit linux.
Yes, you will get unresolved symbols. You need to install 32bit versions of the libraries that are needed. -- /Jacob Carlborg
Aug 31 2013