Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

WinXP/DMD. D2. Just doesn't link with my "Hello, world" in debug mode (DEBUG = 1) #8

Open
egslava opened this Issue · 11 comments

2 participants

Slava Egorenkov jacob-carlborg
Slava Egorenkov

Hello! Sorry for my English. And I'm noob (double kill :) ).
I downloaded your lib (thanks a lot!), install Ruby. With help of Rake I built it:

C:\D\dmd2\src\dwt>rake DEBUG=1 base swt

C:/D/dmd2/src/dwt/rakefile:19: Use RbConfig instead of obsolete and deprecated Config.
Debug Building dwt-base
workdir=>C:\D\dmd2\src\dwt\base\src
Debug Building org.eclipse.swt.win32.win32.x86
workdir=>C:\D\dmd2\src\dwt\org.eclipse.swt.win32.win32.x86\src

Well! Since this moment I have di-files and libs.
I need two libs for Hello World compilation: dwt-base.lib and org.eclipse.swt.win32.win32.x86.lib. That files I copy from dwt/lib to dmd2/windows/lib.
Folders java (with port of java std lib) and org (with eclipse swt) I copy to folder of my project. That means, that my main.d, java and org are locating in same folder.
Whhooh! Let's build! :)

C:\MyD\ConsoleApp3\ConsoleApp3>dmd main.d dwt-base.lib org.eclipse.swt.win32.win32.x86.lib  -debug
main.exe

Yeeeeeeeeeh!!! :) That's work!!! :) And I'm realy glad, but... For debugging in D-IDE I should to generate debug info

C:\MyD\ConsoleApp3\ConsoleApp3>dmd main.d dwt-base.lib org.eclipse.swt.win32.win32.x86.lib  -debug -gc
--- errorlevel 1

Same with "-g" :( I just can't debug :(

That is verbose compilation log:
http://www.everfall.com/paste/id.php?7a6wqq94pysh

And this is "Hello, world'' code:

import std.stdio, std.cstream;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

void main(string[] args)
{
    Display display = new Display ();
    Shell shell = new Shell(display);
    shell.open ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose (); 
}

Should I to do?

Slava Egorenkov

In addition: there is a strange behavior:
org.eclipse.swt.win32.win32.x86.lib is generates every time of different size!
In first time rake generated 12 150 kb file,
second time it was already 12 151 kb
third time it was 12 154 rb!!!

It is realy strange!

And yes, error in org.eclipse.swt.win32.win32.x86.lib lib. I tried to build with dwt-base without org.eclipse.* and it compiles fine. :(

Slava Egorenkov

http://rghost.ru/39550561.view
Screenshot of error.

jacob-carlborg

The error in the screenshot you posted is a known issue with the linker DMD uses. It happens on rare occasions and is extremely hard to debug. Optlink (the linker) is written in assembly which makes it even harder to debug.

I don't fully understand, is it one error or two? When do you get the error from the screenshot and when do you get the other one.

Slava Egorenkov

Okay, but what I should to do to be able programming?

It happens on rare occasions

My english is bad, but it happens always, when I tried to build. Does you means, that I should just reinstall OS?

I don't fully understand, is it one error or two?

it is one error. optlink throws message box and prints error description to console.

jacob-carlborg

Okay, but what I should to do to be able programming?

I think I have to try to reproduce the error and see if I can fix it.

My english is bad, but it happens always, when I tried to build. Does you means, that I should just reinstall OS?

No, you need not to reinstall the OS. The problem is with the linker.

it is one error. optlink throws message box and prints error description to console.

Ok, I'll see if I can reproduce it. Could you try the latest version of DMD, 2.060, and see if that makes any difference. I recommend installing DMD using DVM. It lets you install multiple versions of the compiler.

https://bitbucket.org/doob/dvm

Slava Egorenkov

I think I have to try to reproduce the error and see if I can fix it.

This error reproduce other people. I think you will not have problems with reproducing. Please, fix it :(

Could you try the latest version of DMD, 2.060

I can't compile it with DMD 2.060 (errors in code, please, fix it too). But 2.059 have errors with linking.

Sorry for my English. There is another guy, that may help you to reproduce the problem.

Slava Egorenkov

And, yeah! Thanx for your help! :)

jacob-carlborg

I just update the repositories. Please update to the latest code and try again. Run this from the "dwt" directory:

$ git pull
$ git submodule update --init --recursive
Slava Egorenkov

I reinstall DMD2 compiler to version 2.060. Remove DWT folder and clone it again. Now, the DWT2 is compiled by DMD version 2.060, but in debug mode it is still not work.

I found the simplest way to reproduce problem. Just write:

rake DEBUG=1 swtsnippets

That's all! I hope, you will have this problem too.

Slava Egorenkov

It seems, like I found temporary solution: just to build base and dwt separately:

rake DEBUG=1 base
rake swt

In that case I can to debug my SWT Hello Worlds :)

jacob-carlborg

Good that you found a workaround. This is the problem with the linker. Sometimes it works if you pass the object files/libraries in a different order. It's very unpredictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.