-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Works with 64-bit Windows (without pkg-config) but doesn't work with 32-bit Windows. #27
Comments
Check here: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/VNP6Mwz_B6o I fixed package sqlite
/*
#cgo CFLAGS: -I. -fno-stack-check -fno-stack-protector -mno-stack-arg-probe
#cgo LDFLAGS: -lmingwex -lmingw32 -lgcc_s
*/
import "C" and then Best regards |
Hmm, libgcc_s.a is provided for mingw64. it don't exists in my mingw/lib directory. |
I can confirm that works for me on a 32-bit and 64-bit Windows now. I have libgcc_s.a in "C:\MinGW\lib64" (mingw64) on the 64-bit system. On the 32-bit system I have "C:\MinGW\lib\gcc\mingw32\4.6.2\libgcc_s.a" in case that helps at all. Thanks & Regards |
Oh, ok, I'll check it soon. |
Hmm, if linking libgcc_s.a on mingw32 32bit, example/main crash. |
@stever If change as following, can it succeeded to build?
|
Build succeeded but then when I run the example it fails with similar error messages, on win32. I think I need the -lgcc_s flag on win32 and not win64. The example/main didn't crash for me when I ran it with this on either architecture. I made sure sqlite3.dll and include files were not on the path either in case that was having an effect. I have a fairly clean setup so far as I know and the suggestion from matrixik works for me. |
I'm checking this issue on windows 32bit and It don't require libgcc_s.a for building. |
Sure, seem to need to link to it on win32 though. I didn't need to link to it with win64. |
Hmm, inversed result? |
I don't know why linking libgcc_s.a on win32 crashes for you. Maybe we have different mingw32 versions? I've used a fairly recent mingw-get-inst installer. |
What version of go? |
1.0.3 |
Me too... |
Ah, but I'm using |
Hi, just forked go-sqlite3 & added the following flags in sqlite3.go & was able to subsequently do a simple "go get" to install the package. Example compiles perfectly on win32 with standard MinGW. Had the same issues & soln. building Russ Cox's sqlite3 bindings... libgcc_s.a contains the "__divdi3" which gets rid of not found etc errors. Removing the stack protection gets rid of "__chkstk_ms" not found errors which i simply wasn't able to figure out (this is supposed to be defined in the standard libgcc.a which is included by default by MinGW but somehow wasn't getting linked) #cgo LDFLAGS: -lgcc_s |
That flags is already put in sqlite3_windows.go |
hmmmm..... a simple "go get" was throwing a whole bunch of starting with __divdi3 type of errors on compiling the test program before i made this change. Wonder why.... maybe because of -lgcc_s? |
@mattn no it's not, you didn't push it to github |
@matrixik ? I didn't change anything. What you want? |
@srinathdevelopment
I guess it so. |
You didn't add |
@matrixik see above. if add -lgcc_s on win32, it occur crashed. |
@mattn That's true for you, but is it true for others? Not true for me. It's only required in my win32 build but doesn't hurt to have it for both that and 64-bit windows too. |
@stever if it occur on your environment just only, I'll change to
Is this ok? |
@mattn Really is it needed in 64-bit windows at all? Weird that I have the complete opposite. I'll just fork it to work around the issue I have, but I'm not assuming right now I'm the only person that does. I've tested this on a bunch of computers with consistent results. |
@stever Where did you get sqlite3.dll or header files ? |
@mattn I've tested with an without my own sqlite3.dll and header files. I made a fork before just to remove the static include for windows here as a special case. However, on windows I still like this so right now I'm not using anything outside of your repository plus the '-lgcc_s' fix mentioned above. |
I'm confusing... |
Maybe I've confused you... I didn't/don't fully understand the problem but the suggested fix '-lgcc_s' worked for me and that's all I needed. It's neat to be able to include SQLite statically on windows so I prefer this than the DLL option that I had mentioned as my initial workaround. It would be ideal if the '-lgcc_s' fix work for you and everyone else. It would be useful if other people will confirm there experience with this on 32-bit windows. |
ok, |
When the build error happen? building |
No build error. Just errors when running. Here's the output:
|
If use |
Actually no - same errors. Still, if I use |
|
Also built with I'm using the command |
Hmm, maybe I must write __divdi3 on my code. |
The example even works for me if all I use is |
I'm not so interested in having sqlite3 statically compiled over having it has a DLL dependency. Initially I made a fork and included the following info to help build 32-bit and 64-bit Download the SQLite amalgamation source 64-bit:
32-bit:
|
I had struggled without the above info to make 32-bit and 64-bit versions of the |
Probably, whether compiler use divdi3 or not, is related on CPU. On my On 12/10/12, Steven Robertson [email protected] wrote:
|
I've only tested using Windows in VMware for 32-bit, though hosted on systems with both 64-bit Intel and AMD CPU. |
I'll try to build without optimization of CPU arch in next time. On 12/11/12, Steven Robertson [email protected] wrote:
|
minix let me know answer. https://groups.google.com/d/msg/golang-nuts/5If6AoWD_mU/jjBq8XvBTUgJ |
Ah, a resolved issue in Go. I'm not keen to compile Go on Windows, though maybe it's easy... I'll give it a go. |
Actually, building tip from source is no problem. Just need Mercurial installed... and it works! No need for the Thanks for the resolution. |
Trying install Go from source, fails on compilation time and even that it look like Go working I couldn't
Move back to Windows installer and But when I have Go installed from source I would leave that issue open until Go stable release will fix it (next year?). Best regards |
Did you make sure this issue on hg tip? |
Working without problems on tip. Best regards, |
@matrixik thank you! is this closable? |
Yes. Best regards, |
Thank you all. |
Hello. I've been having trouble with getting this to work on Windows using 32-bit and then found that it works on 64-bit Windows even without pkg-config (which incidentally I had got installed though I'm not sure that could help after all). Having learned more about the current head revision I understand that it works without pkg-config on Windows however I could not get it to work with 32-bit Windows and I get a stream of error messages like "__divdi3: not defined". My understanding of C and cgo is patchy and I'm not sure what this means. I couldn't see why it should be different on 32-bit Windows but perhaps some other compiler option is required.
I resolved my problems by discarding pkg-config and the static compilation on Windows and use the DLL instead, which is what other platforms are using anyway. So instead of the #cgo pkg-config line I'm using "#cgo LDFLAGS: -lsqlite3" having the environment set up with the include files on the path for gcc (LIBRARY_PATH and C_INCLUDE_PATH). The little work with cgo that I've done so far this works best with the smallest of changes to the source-code across platforms.
I've never used pkg-config before and while I had no trouble with it on other platforms on Windows it was a struggle getting an environment set up. Wouldn't this be better without pkg-config?
In any case the current head revision doesn't appear to work for 32-bit Windows and the static compilation as an exception for Windows seems unnecessarily complicated. Maybe you can get it to work but I wonder if this is the wrong direction to go.
The text was updated successfully, but these errors were encountered: