go-sqlcipher icon indicating copy to clipboard operation
go-sqlcipher copied to clipboard

The installation is failing on windows, may be because it's not been tested i believe.

Open mrtinkz opened this issue 9 years ago • 12 comments

I have the gcc properly installed. But looks like there seems to be an issue while installing go-sqlchiper. Has anyone tried to install the new release on windows yet. Any help is greatly appreciated. Thanks

go get github.com/xeodou/go-sqlcipher

github.com/xeodou/go-sqlcipher

....\workspace\src\github.com\xeodou\go-sqlcipher\sqlite3-binding.c:18280:26: fatal error: openssl/rand.h: No such file or directory #include <openssl/rand.h> ^ compilation terminated.

mrtinkz avatar Jul 22 '16 19:07 mrtinkz

hi, I got the same error. You can download openssl from here http://slproweb.com/products/Win32OpenSSL.html Notice: You need download the full version

1.)After that go to this path ->C:\OpenSSL-Win32\include and copy openssl folder and place it to C:\TDM-GCC-64\include\ if you are using TDM-GCC 2.)Rename these two file libeay32.a and libeay32.def will be present at C:\OpenSSL-Win32\lib to libcrypto.a and libcrypto.def and place libcrypto.a and libcrypto.def to C:\TDM-GCC-64\lib\

Then do go get github.com/xeodou/go-sqlcipher

you wouldn't get any error

vijaygiri10 avatar Jul 25 '16 11:07 vijaygiri10

This is what I got:

# github.com/xeodou/go-sqlcipher
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcrypto
collect2.exe: error: ld returned 1 exit status

drwasho avatar Jul 26 '16 06:07 drwasho

Hi,

I got the same error, and followed the steps above.

This is what I got :

d:\develop\go\src>go get github.com/xeodou/go-sqlcipher
# github.com/xeodou/go-sqlcipher
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../../../lib/libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../../../lib\libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../../libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../..\libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../../../lib/libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: skipping incompatible d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-m
ingw32/5.1.0/../../../libcrypto.a when searching for -lcrypto
d:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min
gw32/bin/ld.exe: cannot find -lcrypto
collect2.exe: error: ld returned 1 exit status

Maybe it is trying to compile for 64bit while having a 32bit library?

xjj1 avatar Aug 26 '16 22:08 xjj1

you are Right about compile for 64bit while having a 32bit library. Please tying go1.7 32 bit please do not forget to follow the steps i mentioned above. If still not able compile please feel free to mail me ([email protected])

vijaygiri10 avatar Aug 30 '16 08:08 vijaygiri10

But I need to build 64bit program. How can I do?

JinWuZhao avatar Jan 18 '17 08:01 JinWuZhao

@vijaygiri10 That PKG has a bad performance problem and the xeodou's works very well.I just have to solve the issue of compilation on windows.😁

JinWuZhao avatar Jan 19 '17 01:01 JinWuZhao

Now I stuck there:

C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xd8b): undefined reference to __imp_GetDeviceCaps' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xdb8): undefined reference to __imp_CreateCompatibleBitmap' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xdce): undefined reference to __imp_GetObjectW' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xe91): undefined reference to __imp_GetDIBits' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xf20): undefined reference to `__imp_DeleteObject'

JinWuZhao avatar Jan 19 '17 01:01 JinWuZhao

I tried in GO 1.6 32bit (windows10,windows7 64 bit OS)

You can download openssl from here http://slproweb.com/products/Win32OpenSSL.html

Rename these two file( libeay32.a) and (libeay32.def) to libcrypto.a and libcrypto.def

These two file( libeay32.a) and (libeay32.def) will be present at where you install openssl.

For me it is ->C:\OpenSSL-Win32\lib\

When you rename above file, please place them to C:\TDM-GCC-64\lib\

Then do go get github.com/xeodou/go-sqlcipher

you wouldn't get any error

Thanks $ Regards

vijaygiri10 avatar Jan 19 '17 06:01 vijaygiri10

I figure out it. I modified the sqlite3_windows.go and added '-lgdi32' behind the LDFLAGS. Like this:

Then I recompiled the libcrypto.a of OpenSSL 64bit and put it into C:\TDM-GCC-64\lib.

JinWuZhao avatar Jan 19 '17 07:01 JinWuZhao

If you want to build 32bit binary with 64bit go compiler and TDMGCC. Just recompile a 32bit libcrypto.a from OpenSSL. Then put it into C:\TDM-GCC-64\lib. DO NOT USE the distribution of http://slproweb.com/products/Win32OpenSSL.html, that doesn't work. And don't use the OpenSSL of 1.1.x version. Because that's not compatible with old version.

JinWuZhao avatar Jan 20 '17 02:01 JinWuZhao

See Issue #5 I've written a complete complication manual for how to compile on Windows 64bit. I do have to submit a PR for a minor change. Also this manual should probably go in some README or something. But first check it out and verify it also works on your environment.

gjrtimmer avatar Mar 20 '17 14:03 gjrtimmer

That's great. Well done!

JinWuZhao avatar Mar 21 '17 01:03 JinWuZhao