Jump to page: 1 2
Thread overview
Compiling the hello world example fails
Aug 23, 2013
chmike
Aug 23, 2013
chmike
Aug 23, 2013
chmike
Aug 23, 2013
Jacob Carlborg
Aug 23, 2013
Olivier Pisano
Aug 23, 2013
chmike
Aug 23, 2013
Jacob Carlborg
Aug 24, 2013
Olivier Pisano
Aug 24, 2013
Jesse Phillips
Aug 24, 2013
Jacob Carlborg
Aug 24, 2013
chmike
Aug 24, 2013
Olivier Pisano
Aug 24, 2013
Jacob Carlborg
Aug 30, 2013
chmike
Aug 31, 2013
Jacob Carlborg
August 23, 2013
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 ?
August 23, 2013
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.
August 23, 2013
Could it be that the dwt libraries are i386 while I'm trying to compile for an amd64 distro ?
August 23, 2013
Hi Christophe, welcome to D !

I suspect a 32bit/64bit link mismatch.
August 23, 2013
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 ?
August 23, 2013
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
August 23, 2013
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
August 24, 2013
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)?
August 24, 2013
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.
August 24, 2013
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
« First   ‹ Prev
1 2