Skip to content

mingw built program fails to run on Windows 2000 #586

@alexbrainman

Description

@alexbrainman
What steps will reproduce the problem?

1. install go

cd $GOROOT/src
./all.bash

2. cross compile mingw runtime

export GOOS=mingw
cd $GOROOT/src/pkg/runtime
make clean
make install

3. cross compile my simple program

cd ~/test
cat test.go

package main

func main() {
    print("hello world\n")
}

export GOOS=mingw
~/bin/8g -o _go_.8 test.go
~/bin/8l -o test.exe _go_.8

4. copy resulting binary test.exe to Win2000 pc and run it, it output
nothing and exits.

What is the expected output? 

hello world

What do you see instead?

<nothing>

What is your $GOOS?  $GOARCH?

GOARCH=386
GOOS=linux

Which revision are you using?  (hg identify)

36e71486f51f+ tip

Please provide any additional information below.

I figured the problem is that the executable built by 8l, doesn't have
"import table" and Win2000 loader is not smart enough to implicitly link
kernel32.dll functions, used by runtime. The reference that helped me here
is: http://www.phreedom.org/solar/code/tinype/. That's the only ref I could
find.

I have made the change to the PE building code, and it seems to be doing
the trick. Happy to provide the code.


Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions