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

cmd/cgo: trivial program fails on windows/386 with 4.3.3-tdm-1 mingw32 #17679

Closed
WesleiRamos opened this issue Oct 31, 2016 · 6 comments

Comments

@WesleiRamos
Copy link

commented Oct 31, 2016

What version of Go are you using (go version)?

1.7

What operating system and processor architecture are you using (go env)?

set GOARCH=386
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Dayhane & Lucas\Go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_386
set CC=gcc
set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\DAYHAN~1\AppData\Local\Temp\go-build422804030=/tmp/go-build
set CXX=g++
set CGO_ENABLED=1

C compiler

Reading specs from c:/mingw/bin/../lib/gcc/mingw32/4.3.3/specs
Target: mingw32
Configured with: ../gcc-4.3.3/configure --prefix=/mingw --build=mingw32 --enable-languages=c,ada,c++,fortran,objc,obj-c++ --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php --disable-nls --disable-win32-registry --enable-libgomp --disable-werror --enable-threads --disable-symvers --enable-cxx-flags='-fno-function-sections -fno-data-sections' --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-sjlj-exceptions --with-pkgversion='4.3.3-tdm-1 mingw32'
Thread model: win32
gcc version 4.3.3 (4.3.3-tdm-1 mingw32)

Error

My code build but not runs, returns this error 'exit status -1073741819'

In ideone works http://ideone.com/yvW02W

(sorry my english)

@rakyll rakyll changed the title CGO "exit status -1073741819" on windows cgo: "exit status -1073741819" on windows Oct 31, 2016

@rakyll rakyll added this to the Go1.8Maybe milestone Oct 31, 2016

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 2, 2016

The code is:

package main

/*
int teste() { return 2 + 1; }
*/
import "C"

func main(){
    println(C.teste()); 
}

It does seem like that should work. The exit code is 0xc0000005, access violation (like Unix SIGSEGV).

@WesleiRamos, what versions of Windows are you using? Thanks.

@rsc rsc changed the title cgo: "exit status -1073741819" on windows cmd/cgo: trivial program fails on windows/386 with 4.3.3-tdm-1 mingw32 Nov 2, 2016

@alexbrainman

This comment has been minimized.

Copy link
Member

commented Nov 3, 2016

This works for me on:

go version devel +bba1ac4 Thu Oct 27 22:55:30 2016 +0000 windows/386

with both gcc (GCC) 4.8.1 and gcc (tdm-1) 5.1.0.
I use Windows XP.

Alex

@WesleiRamos

This comment has been minimized.

Copy link
Author

commented Nov 4, 2016

@rsc Windows 10

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 11, 2016

Is there a reason you are using 32-bit x86 with Windows 10 instead of 64-bit x86? I wouldn't think Windows 10 would run on any 32-bit-only hardware.

I wonder if maybe something somewhere is getting confused about whether it should be 32-bit or 64-bit code.

@WesleiRamos

This comment has been minimized.

Copy link
Author

commented Dec 6, 2016

I switched compiler and it worked, to version 4.7.1 of gcc.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 9, 2016

Sounds like this is resolved. Let me know if I'm confused.

@bradfitz bradfitz closed this Dec 9, 2016

@golang golang locked and limited conversation to collaborators Dec 9, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
8 participants
You can’t perform that action at this time.