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

Warning when cross-compiling for Windows on Go 1.11 #34

Closed
botherder opened this issue Aug 27, 2018 · 7 comments
Closed

Warning when cross-compiling for Windows on Go 1.11 #34

botherder opened this issue Aug 27, 2018 · 7 comments

Comments

@botherder
Copy link

I'm not sure if this is of any interesting, but this warning is raised when cross-compiling for Windows on Go 1.11:

GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc PKG_CONFIG_PATH=${YARA_SRC}/x86_64-w64-mingw32/lib/pkgconfig go install -ldflags '-extldflags "-static"' github.com/hillu/go-yara                
# github.com/hillu/go-yara
../../.gvm/pkgsets/go1.11/global/src/github.com/hillu/go-yara/rules_yara34.go: In function ‘_yr_rules_scan_fd’:
../../.gvm/pkgsets/go1.11/global/src/github.com/hillu/go-yara/rules_yara34.go:30:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   return yr_rules_scan_fd(rules, (YR_FILE_DESCRIPTOR)fd, flags, callback, user_data, timeout);
@hillu
Copy link
Owner

hillu commented Aug 27, 2018

@botherder The warning occurs for 64bit Windows builds, regardless of Go compiler. Things still work, after all this is "just" a warning. Which is a thing no sensible/serious C programmer would ever say in public. (go figure...), so I'm going to fix this.

@hillu hillu closed this as completed in 0540979 Aug 27, 2018
@botherder
Copy link
Author

Thanks for the fast reply.
I'm trying to triage also this when building for 64bit Windows:

/home/nex/.gvm/gos/go1.11/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32-gcc failed: exit status 1
/usr/bin/x86_64-w64-mingw32-ld: i386 architecture of input file `/tmp/go-link-888075984/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status```

I'm building with GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1. What am I doing wrong?

@hillu
Copy link
Owner

hillu commented Aug 27, 2018

@botherder no idea for the second problem, sorry.

@botherder
Copy link
Author

Yeah. I can't quite figure it out. I'm only managing to build 32bit on Windows at the moment.

@hillu
Copy link
Owner

hillu commented Aug 27, 2018

Does the same thing happen with previous Golang versions?

@hillu
Copy link
Owner

hillu commented Aug 30, 2018

@botherder I see that you have made a release. Nice, congratulations! Have you figured out what went wrong with your 64bit build?

@botherder
Copy link
Author

botherder commented Aug 30, 2018

Not yet, that's on the TODO. Thanks for your help though! And thanks for this library of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants