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

Windows 64bit build #57

Closed
jbrantly opened this issue Jul 24, 2013 · 13 comments
Closed

Windows 64bit build #57

jbrantly opened this issue Jul 24, 2013 · 13 comments

Comments

@jbrantly
Copy link

I'm trying to build a 64bit version of libsodium for Windows. I have so far been unsuccessful and wanted to make sure this was a supported scenario.

I'm using Windows 7 64bit. I have downloaded various mingw-w64 toolchains (in particular rubenvb's personal build, Mingw-builds, and TDM-GCC) along with MSYS and built numerous versions using various options which have all failed. By "fail" I mean "make check" fails all tests and my application which uses the library crashes when calling "crypto_secretbox" (but succeeds on some other, simpler calls such as sodium_init, sodium_version_string, crypto_secretbox_keybytes, etc).

I believe configure should be something along the lines of:
./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 CFLAGS="-march=x86-64 -mtune=generic"

Is a 64bit Windows build a supported scenario? Has anyone else been able to do this successfully?

@sneves
Copy link
Contributor

sneves commented Jul 24, 2013

I have been able to reproduce this. Generally, failed tests seem to be a build system problem; compiling them manually and running them seems to work fine (i.e., they pass). I haven't figured out yet what exactly in the build system makes the binaries fail.

I have also been able to reproduce the crypto_secretbox crash. This is due to the inclusion of the amd64_xmm6 optimized Salsa20 assembly implementation, which assumes the usual AMD64 ABI. On Windows the parameter transfer registers are not the same, and thus the crash. You can get around this by passing --disable-asm to configure script.

@jbrantly
Copy link
Author

Passing --disable-asm to the configure script did work for me. Thank you very much!

Going to leave this issue open since I'm assuming the intent is for this to work out-of-the-box. I would love to contribute but I'm afraid this is not my area of expertise.

@jedisct1
Copy link
Owner

Hello,
I'm going to take a look. Glad that --disable-asm works around it, but yes, the intent is that it should work out of the box.
Thanks again for reporting this!

@neheb
Copy link
Contributor

neheb commented Jul 24, 2013

I tried this using the MinGW toolchain from cygwin's installer and for me, it hangs at

CCAS crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.lo
CCLD libsodium.la

@jedisct1
Copy link
Owner

Hi Neheb
Was that with mingw64, too?
Use ./configure --disable-asm for now. I'll see how to work around this.

@neheb
Copy link
Contributor

neheb commented Jul 24, 2013

It was mingw64 indeed. On further inspection, this looks like a separate issue. For me, the CCLD line is hanging for some reason. Even if I add --disable-asm, it hangs. My full configure line is "./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --disable-asm". I also use make without -j#.

Note that regular cygwin compiles that use cygwin1.dll work fine.

@jedisct1
Copy link
Owner

Looks like --disable-pie is required when using the latest mingw-builds. Not with other mingw64 distributions. What a mess...

@jedisct1 jedisct1 closed this as completed Sep 9, 2013
@neheb
Copy link
Contributor

neheb commented Sep 9, 2013

You might also want to disable asm for cygwin64 as well. make check output:

../../test-driver: line 95: 6000 Segmentation fault (core dumped) "$@" > $log_file 2>&1
FAIL: box7.exe
../../test-driver: line 95: 2468 Segmentation fault (core dumped) "$@" > $log_file 2>&1
FAIL: box8.exe

it also hangs on secretbox2.

@jedisct1
Copy link
Owner

jedisct1 commented Sep 9, 2013

What is host_os for cygwin64? cygwin64?

@neheb
Copy link
Contributor

neheb commented Sep 9, 2013

that should be it.

edit: hmmm nevermind?

$ grep host_os < Makefile
host_os = cygwin

after ./configure

@jedisct1
Copy link
Owner

jedisct1 commented Sep 9, 2013

Can you check in config.log? config.guess doesn't seem to mention it. Checking host is probably safer, though.

@neheb
Copy link
Contributor

neheb commented Sep 9, 2013

host='x86_64-unknown-cygwin'
host_alias=''
host_cpu='x86_64'
host_os='cygwin'
host_vendor='unknown'

@jedisct1
Copy link
Owner

jedisct1 commented Sep 9, 2013

Thanks!

38d0a4d should do the trick.

Repository owner locked and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants