mingw 64-bit build of 1.1.0e

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

mingw 64-bit build of 1.1.0e

sisyphus1
Hi,

Having a spot of bother trying to build a static openssl-1.1.0e using a
mingw-w64 64-bit compiler - namely, gcc version 6.3.0
(x86_64-posix-sjlj-rev1, Built by MinGW-W64 project).

In the msys2 shell, I run:

./config no-shared
zlib -IC:/_64/msys_630/1.0/local/include -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
&& make && make test && make install

Works beautifully ... except that libssl.a and libcrypto.a turn out to be
32-bit builds !!
That is, the built library works fine with the same vendor's 32-bit compiler
(gcc version 6.3.0 (i686-posix-sjlj-rev1, Built by MinGW-W64 project)), but
the x64 compiler that built the damned things regards them as incompatible.

I'm thinking that I just need to specify an -m64 switch in there. How do I
do that ?

I did try adding the 'os/compiler:mingw64' to the ./config args, but that
resulted in:

$ ./config no-shared
zlib -IC:/_64/msys_630/1.0/local/include -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
os/compiler:mingw64 && make && make test && make install
Operating system: x86_64-whatever-mingw
Configuring for mingw
Configuring OpenSSL version 1.1.0e (0x1010005fL)
target already defined - mingw (offending arg: os/compiler:mingw64)

Having spent quite a few hours just getting to this diagnosis, I've now
settled for simply asking the dumb question.
(Sorry.)

Cheers,
Rob

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

sisyphus1
-----Original Message-----
From: [hidden email]
Sent: Saturday, March 11, 2017 10:21 PM
To: [hidden email]
Subject: [openssl-users] mingw 64-bit build of 1.1.0e

> In the msys2 shell, I run:
>
> ./config no-shared
> zlib -IC:/_64/msys_630/1.0/local/include -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
> && make && make test && make install
>
> Works beautifully ... except that libssl.a and libcrypto.a turn out to be
> 32-bit builds !!
> That is, the built library works fine with the same vendor's 32-bit
> compiler (gcc version 6.3.0 (i686-posix-sjlj-rev1, Built by MinGW-W64
> project)), but the x64 compiler that built the damned things regards them
> as incompatible.
>
> I'm thinking that I just need to specify an -m64 switch in there. How do I
> do that ?

After another couple of hours fossicking about, I did it by firstly setting
the CC environment variable to 'gcc -m64'. (I would normally do that by
specifying 'CC="gcc -m64"' as part of the ./config command, but ./config
found that to be objectionable, so I pre-set it in a separate command prior
to running ./config.)
And I added '-m64' as a ./config arg.

I don't know if *both* of those steps were necessary, but it did the trick.

Disconcertingly, the summary at the end of ./config still announces
"THIRTY_TWO_BIT mode" but, at the end of the build, I definitely have the
X64 libraries that I wanted.

Cheers,
Rob

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

Matt Caswell-2


On 12/03/17 00:06, [hidden email] wrote:

> -----Original Message----- From: [hidden email]
> Sent: Saturday, March 11, 2017 10:21 PM
> To: [hidden email]
> Subject: [openssl-users] mingw 64-bit build of 1.1.0e
>
>> In the msys2 shell, I run:
>>
>> ./config no-shared zlib -IC:/_64/msys_630/1.0/local/include
>> -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local &&
>> make && make test && make install
>>
>> Works beautifully ... except that libssl.a and libcrypto.a turn out to
>> be 32-bit builds !!
>> That is, the built library works fine with the same vendor's 32-bit
>> compiler (gcc version 6.3.0 (i686-posix-sjlj-rev1, Built by MinGW-W64
>> project)), but the x64 compiler that built the damned things regards
>> them as incompatible.
>>
>> I'm thinking that I just need to specify an -m64 switch in there. How
>> do I do that ?
>
> After another couple of hours fossicking about, I did it by firstly
> setting the CC environment variable to 'gcc -m64'. (I would normally do
> that by specifying 'CC="gcc -m64"' as part of the ./config command, but
> ./config found that to be objectionable, so I pre-set it in a separate
> command prior to running ./config.)
> And I added '-m64' as a ./config arg.
>
> I don't know if *both* of those steps were necessary, but it did the trick.
>
> Disconcertingly, the summary at the end of ./config still announces
> "THIRTY_TWO_BIT mode" but, at the end of the build, I definitely have
> the X64 libraries that I wanted.

Did you just try:

perl Configure mingw64 no-shared zlib


Matt

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

sisyphus1
-----Original Message-----
From: Matt Caswell
Sent: Sunday, March 12, 2017 11:13 AM
To: [hidden email]
Subject: Re: [openssl-users] mingw 64-bit build of 1.1.0e



> On 12/03/17 00:06, [hidden email] wrote:

>> Disconcertingly, the summary at the end of ./config still announces
>> "THIRTY_TWO_BIT mode" but, at the end of the build, I definitely have the
>> X64 libraries that I wanted.
>
>Did you just try:
>
> perl Configure mingw64 no-shared zlib


Aaah ... that looks better.
I now get "SIXTY_FOUR_BIT mode".
And I don't have to do 'no-asm' which (I forgot to mention) I had to do with
my previous incantation.
Also, I can clear the CC environment variable.

I added '--prefix=C:/_64/msys_630/1.0/local' to ensure that the built
library would be installed where I wanted it. That, too, worked fine.

But where did it find libz ?
I don't see anything in the command that will point to any of the libz
installations that I know of.

Thanks, Matt !!

Cheers,
Rob

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

Richard Levitte - VMS Whacker-2
In reply to this post by sisyphus1
Just add -m64 on the config line, like this:

./config no-shared zlib -m64 -IC:/_64/msys_630/1.0/local/include \
-LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local

This is weird, though...  what config target did you get when
configuring?  Ideally, you should have gotten 'mingw64', which already
uses the -m64 flag, so what gives?  If you show us the config output,
maybe we can help you figure out what actually goes wrong...

Cheers,
Richard

In message <947E3E0C7B5E4C5A97C3506B97EBC133@OwnerPC311012> on Sat, 11 Mar 2017 22:21:05 +1100, <[hidden email]> said:

sisyphus1> Hi,
sisyphus1>
sisyphus1> Having a spot of bother trying to build a static openssl-1.1.0e using
sisyphus1> a
sisyphus1> mingw-w64 64-bit compiler - namely, gcc version 6.3.0
sisyphus1> (x86_64-posix-sjlj-rev1, Built by MinGW-W64 project).
sisyphus1>
sisyphus1> In the msys2 shell, I run:
sisyphus1>
sisyphus1> ./config no-shared
sisyphus1> zlib -IC:/_64/msys_630/1.0/local/include
sisyphus1> -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
sisyphus1> && make && make test && make install
sisyphus1>
sisyphus1> Works beautifully ... except that libssl.a and libcrypto.a turn out to
sisyphus1> be
sisyphus1> 32-bit builds !!
sisyphus1> That is, the built library works fine with the same vendor's 32-bit
sisyphus1> compiler
sisyphus1> (gcc version 6.3.0 (i686-posix-sjlj-rev1, Built by MinGW-W64
sisyphus1> project)), but
sisyphus1> the x64 compiler that built the damned things regards them as
sisyphus1> incompatible.
sisyphus1>
sisyphus1> I'm thinking that I just need to specify an -m64 switch in there. How
sisyphus1> do I
sisyphus1> do that ?
sisyphus1>
sisyphus1> I did try adding the 'os/compiler:mingw64' to the ./config args, but
sisyphus1> that
sisyphus1> resulted in:
sisyphus1>
sisyphus1> $ ./config no-shared
sisyphus1> zlib -IC:/_64/msys_630/1.0/local/include
sisyphus1> -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
sisyphus1> os/compiler:mingw64 && make && make test && make install
sisyphus1> Operating system: x86_64-whatever-mingw
sisyphus1> Configuring for mingw
sisyphus1> Configuring OpenSSL version 1.1.0e (0x1010005fL)
sisyphus1> target already defined - mingw (offending arg: os/compiler:mingw64)
sisyphus1>
sisyphus1> Having spent quite a few hours just getting to this diagnosis, I've
sisyphus1> now
sisyphus1> settled for simply asking the dumb question.
sisyphus1> (Sorry.)
sisyphus1>
sisyphus1> Cheers,
sisyphus1> Rob
sisyphus1>
sisyphus1>
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

sisyphus1
-----Original Message-----
From: Richard Levitte
Sent: Sunday, March 12, 2017 3:25 PM
To: [hidden email]
Subject: Re: [openssl-users] mingw 64-bit build of 1.1.0e

> Just add -m64 on the config line, like this:
>
> ./config no-shared zlib -m64 -IC:/_64/msys_630/1.0/local/include \
> -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
>
> This is weird, though...  what config target did you get when configuring?
> Ideally, you should have gotten 'mingw64', which already uses the -m64
> flag, so what gives?  If you show us the config output, maybe we can help
> you figure out what actually goes wrong...
>
Hi Richard,

The command I originally tried was
./config no-shared
zlib -IC:/_64/msys_630/1.0/local/include -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local

For that command, the config is in the attached conf0.txt.

If I add the '-m64' switch, then the output (see conf1.txt) changes very
little.
According to diff, the only change is the insertion of '-m64' in the "CFLAG"
line.

Having included the '-m64' switch, if I then proceed to run 'make', I very
quickly get a long list of assembler error messages pertaining to push, pop,
pushf and popf:

crypto/aes/aes-586.s: Assembler messages:
crypto/aes/aes-586.s:969: Error: invalid instruction suffix for `push'
...
crypto/aes/aes-586.s:970: Error: invalid instruction suffix for `pop'
...
crypto/aes/aes-586.s:2233: Error: invalid instruction suffix for `pushf'
...
crypto/aes/aes-586.s:2350: Error: invalid instruction suffix for `popf'
...

(Adding the no-asm switch to ./config works around that particular problem.)

Matt suggested running 'perl Configure mingw64 no-shared zlib'.
The config output for it is in the attached conf2.txt, and is much more in
keeping with expectations.

I'm quite happy to continue building openssl by running that perl command.
I'm also happy to assist with investigating the problem that led to my
original post.

Cheers,
Rob

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

conf0.txt (2K) Download Attachment
conf1.txt (2K) Download Attachment
conf2.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

sisyphus1
In reply to this post by sisyphus1


-----Original Message-----
From: [hidden email]

>>Did you just try:
>>
>> perl Configure mingw64 no-shared zlib


> Aaah ... that looks better.

[snip]

> But where did it find libz ?

Heh ... this compiler ships with libz.a (x86_64-w64-mingw32/lib/libz.a).
I don't know how long they've been doing that - probably for years.
Remove (or rename) that file and 'make' fails because -lz can't be resolved.

Cheers,
Rob

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

Richard Levitte - VMS Whacker-2
In reply to this post by sisyphus1
In message <8CD5EEA9CC3F4643AAFC6D7DDF6EB449@OwnerPC311012> on Sun, 12 Mar 2017 16:15:47 +1100, <[hidden email]> said:

sisyphus1> -----Original Message----- From: Richard Levitte
sisyphus1> Sent: Sunday, March 12, 2017 3:25 PM
sisyphus1> To: [hidden email]
sisyphus1> Subject: Re: [openssl-users] mingw 64-bit build of 1.1.0e
sisyphus1>
sisyphus1> > Just add -m64 on the config line, like this:
sisyphus1> >
sisyphus1> > ./config no-shared zlib -m64 -IC:/_64/msys_630/1.0/local/include \
sisyphus1> > -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
sisyphus1> >
sisyphus1> > This is weird, though...  what config target did you get when
sisyphus1> > configuring? Ideally, you should have gotten 'mingw64', which already
sisyphus1> > uses the -m64 flag, so what gives?  If you show us the config output,
sisyphus1> > maybe we can help you figure out what actually goes wrong...
sisyphus1> >
sisyphus1>
sisyphus1> Hi Richard,
sisyphus1>
sisyphus1> The command I originally tried was
sisyphus1> ./config no-shared zlib -IC:/_64/msys_630/1.0/local/include
sisyphus1> -LC:/_64/msys_630/1.0/local/lib --prefix=C:/_64/msys_630/1.0/local
sisyphus1>
sisyphus1> For that command, the config is in the attached conf0.txt.

Thanks for the output, that explains to me what's happening.  More
precisely, these first two lines:

    Operating system: x86_64-whatever-mingw
    Configuring for mingw

I just had a look in the script 'config', and learned that it doesn't
do anything special with 'x86_64-whatever-mingw', except using its
last part ('mingw') as the target to 'Configure'...  which seems a bit
wrong in my mind, as I would expect (like you've noticed yourself)
that 'mingw64' would be a better target specifically on 'x86_64'.  So
it seems that the 'config' script is a bit lacking, and obviously
unusable in a 64-bit mingw environment.

Time for a fix, methinks.

Cheers,
Richard

--
Richard Levitte         [hidden email]
OpenSSL Project         http://www.openssl.org/~levitte/
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw 64-bit build of 1.1.0e

Matt Caswell-2
In reply to this post by sisyphus1


On 12/03/17 07:57, [hidden email] wrote:
>> But where did it find libz ?
>
> Heh ... this compiler ships with libz.a (x86_64-w64-mingw32/lib/libz.a).
> I don't know how long they've been doing that - probably for years.
> Remove (or rename) that file and 'make' fails because -lz can't be
> resolved.

You can specify where to find libz with the following Configure options:

  --with-zlib-include=DIR
  --with-zlib-lib=LIB

Check the INSTALL file for details.


Matt

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users