Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc/swig/stdio: test fails on windows #7281

Closed
gopherbot opened this issue Feb 7, 2014 · 14 comments
Closed

misc/swig/stdio: test fails on windows #7281

gopherbot opened this issue Feb 7, 2014 · 14 comments

Comments

@gopherbot
Copy link
Contributor

by czarek.tomczak:

Hi there,

I'm running the command:

    C:\Go\misc\swig>go test -x -v -work ./stdio

It builds fine but when running test executable it fails:

    exit status -1073741515
    FAIL    _/C_/Go/misc/swig/stdio 0.038s

Attaching complete logs: "go test logs.txt".

The files in the WORK directory:

    _-C_-Go-misc-swig-stdio-file-swig.so
    _go_.8
    _testmain.go
    file.go
    file_gc.8
    file_gc.c
    file_wrap.c
    file_wrap.o
    main.a
    stdio.test.exe

The .so file indicates that something is not okay, it should be a .dll file on Windows.

Renaming the .so file to .dll doesn't help.

When running the stdio.test.exe manually I get win message box error:

    The program can't start because .DLL is missing from your computer. 
    Try reinstalling the program to fix this problem. 

When running Dependency Walker on the executable I see "<empty string>"
in a place where the DLL filename should appear. Attaching screenshot
("dependency-walker-...png").

How can I fix that?
Thanks for help.

Best regards,
Czarek

Attachments:

  1. go test logs.txt (4753 bytes)
  2. dependency-walker-stdio.test.exe.png (60537 bytes)
@gopherbot
Copy link
Contributor Author

Comment 1 by czarek.tomczak:

Go version: go1.2 windows/386
OS: Win7 64-bit

@ianlancetaylor
Copy link
Member

Comment 2:

I think that when issue #7156 is fixed this will most likely be fixed as well.

@gopherbot
Copy link
Contributor Author

Comment 3 by czarek.tomczak:

I've found some useful resources.
There is an issue in SWIG for the Go language on Windows:
    "Go: SWIG doesn't work on Windows"
    swig/swig#100
It includes links to a topic on golang-nuts with a patch that fixes the problem in SWIG:
    
    https://groups.google.com/d/msg/golang-nuts/9L0U4Q7AtyE/iNFTnLJH9xMJ
The libtorrent library uses an another approach to fix the problem, it modifies the
generated .cxx and .c files:
    https://github.com/steeve/libtorrent-go/blob/master/Makefile#L124

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 4:

Labels changed: added release-go1.3.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Apr 3, 2014

Comment 5:

Labels changed: added release-go1.3maybe, removed release-go1.3.

@rsc
Copy link
Contributor

rsc commented May 9, 2014

Comment 6:

Ian, you were just in there. Have you seen the patch at
https://groups.google.com/forum/#!msg/golang-nuts/9L0U4Q7AtyE/iNFTnLJH9xMJ ? Is it worth
applying to SWIG?

Owner changed to @ianlancetaylor.

@ianlancetaylor
Copy link
Member

Comment 7:

It's a very invasive patch and does several things in what I think is the wrong way. 
E.g., there should be no need to have a -windows option at all; SWIG should do the right
thing automatically.
The right approach is the cmd/go CL you approved that will land in 1.3 if nobody
objects, and getting Windows external linking to work.  If we do those things, the patch
you cite is both unnecessary and incorrect.

@rsc
Copy link
Contributor

rsc commented May 13, 2014

Comment 8:

Labels changed: added release-go1.4, removed release-go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 9:

Labels changed: added release-go1.5, removed release-go1.4.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@minux
Copy link
Member

minux commented Jan 12, 2015

Now that #7156 has been fixed 7 months ago, could someone verify whether this is fixed too?

@achun
Copy link

achun commented Feb 22, 2015

env

windows 7 64bits
gcc (tdm64-1) 4.9.2

SWIG Version 3.0.5
Compiled with i586-mingw32msvc-g++ [i586-pc-mingw32msvc]
Configured options: +pcre

set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=F:\Go
set GORACE=
set GOROOT=E:\Go
set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

E:\Go\misc\swig>go test -x -v -work ./stdio

WORK=C:\Users\ADMINI~1\AppData\Local\Temp\go-build717716031
mkdir -p $WORK\_\E_\Go\misc\swig\stdio\_test\_\E_\Go\misc\swig\
mkdir -p $WORK\_\E_\Go\misc\swig\stdio\_test\_obj_test\
swig -version
cd $WORK
"E:\\Go\\pkg\\tool\\windows_amd64\\6g.exe" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test
\\_go_.6" -trimpath "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -p command-line-arguments -complete -D _/C_/Users/ADMINI~1/AppData/Local
/Temp/go-build717716031 "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\swig_intsize.go"
cd E:\Go\misc\swig\stdio
swig -go -intgosize 64 -module file -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file_
wrap.c" -outdir "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\" file.swig
"E:\\Go\\pkg\\tool\\windows_amd64\\6c.exe" -F -V -trimpath "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -I "C:\\Users\\ADMINI~1\\AppData\
\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\" -I "E:\\Go\\pkg\\windows_amd64" -o "C:\\Users\\ADMINI~1\\AppData\\Local\
\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file_gc.6" -D GOOS_windows -D GOARCH_amd64 "C:\\Users\\ADMINI~1\\AppData\\Local\\
Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file_gc.c"
gcc -I "E:\\Go\\misc\\swig\\stdio" -m64 -mthreads -fmessage-length=0 -g -O2 -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\mi
sc\\swig\\stdio\\_test\\_obj_test\\file_wrap.o" -c "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj
_test\\file_wrap.c"
"E:\\Go\\pkg\\tool\\windows_amd64\\6g.exe" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_\\E_\\Go
\\misc\\swig\\stdio.a" -trimpath "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -p _/E_/Go/misc/swig/stdio -D _/E_/Go/misc/swig/stdio -I "C
:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -pack "E:\\Go\\misc\\swig\\stdio\\file_test.go" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go
-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file.go"
pack r "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_\\E_\\Go\\misc\\swig\\stdio.a" "C:\\Users\\ADMI
NI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file_gc.6" "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-bu
ild717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_obj_test\\file_wrap.o" # internal
mkdir -p $WORK\_\E_\Go\misc\swig\stdio\_test\
cd $WORK\_\E_\Go\misc\swig\stdio\_test
"E:\\Go\\pkg\\tool\\windows_amd64\\6g.exe" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\main.a" -
trimpath "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -p testmain -complete -D "" -I "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build
717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test" -I "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031" -pack "C:\\Users\\ADMINI~1\\AppData\\Loca
l\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\_testmain.go"
cd .
"E:\\Go\\pkg\\tool\\windows_amd64\\6l.exe" -o "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\stdio.tes
t.exe" -L "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test" -L "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp
\\go-build717716031" -w -extld=gcc "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\go-build717716031\\_\\E_\\Go\\misc\\swig\\stdio\\_test\\main.a"
# testmain
C:\Users\ADMINI~1\AppData\Local\Temp\go-build717716031\_\E_\Go\misc\swig\stdio\_test/_/E_/Go/misc/swig/stdio.a(file_wrap.o): malformed pe file: _cgo_topofs
tack: invalid symbol binding 105
$WORK\_\E_\Go\misc\swig\stdio\_test\stdio.test.exe -test.v=true
FAIL    _/E_/Go/misc/swig/stdio [build failed]

@rsc rsc removed accepted labels Apr 14, 2015
@ianlancetaylor
Copy link
Member

This should be fixed, now that #4069 is fixed. This time for sure.

Anybody want to try it out? You will need SWIG 3.0.6 or later.

@chai2010
Copy link
Contributor

@ianlancetaylor The test is OK on win7/64bit.

@ianlancetaylor
Copy link
Member

Thanks for checking.

@golang golang locked and limited conversation to collaborators Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants