Win 64a dynamic link library build was unsuccessful using beta6

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

Win 64a dynamic link library build was unsuccessful using beta6

Majzik Matyas
Hi!

I have tried to build a 64  bit DLL for AMD64 processors. Using the 64
bit compiler in the new platform SDK.

However I got the following error:

        link /nologo /subsystem:console /opt:ref /dll bufferoverflowU.lib
/out:o
ut32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\DOCUME~1\openssldev\LOCALS~1\Temp\nm10.tmp
ms/LIBEAY32.def(7) : warning LNK4017: DESCRIPTION statement not supported
for th
e target platform; ignored
   Creating library out32dll\libeay32.lib and object out32dll\libeay32.exp
bss_fd.obj : error LNK2019: unresolved external symbol OPENSSL_UplinkTable
refer
enced in function fd_free
bss_file.obj : error LNK2001: unresolved external symbol OPENSSL_UplinkTable
b_dump.obj : error LNK2001: unresolved external symbol OPENSSL_UplinkTable
out32dll\libeay32.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.



So as you adviced I tried the following:
>perl ms/uplink.pl win64a > uplink.asm
>ml64 -c uplink.asm
>add it to APP_EX_OBJ in ntdll.mak file.

Still unsuccessful to compile:
C:\OpenSSL\openssl-0.9.8-beta6>nmake -f ms\ntdll.mak

Microsoft (R) Program Maintenance Utility   Version 7.00.8882
Copyright (C) Microsoft Corp 1988-2000. All rights reserved.

Building OpenSSL
        link /nologo /subsystem:console /opt:ref bufferoverflowU.lib
/dll /out:o
ut32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\DOCUME~1\admin\LOCALS~1\Temp\nmE34
.tmp
ms/LIBEAY32.def(7) : warning LNK4017: DESCRIPTION statement not
supported for th
e target platform; ignored
   Creating library out32dll\libeay32.lib and object out32dll\libeay32.exp
uplink.obj : error LNK2019: unresolved external symbol OPENSSL_Uplink
referenced
 in function $lazy1
out32dll\libeay32.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.

What is wrong?

Using static libraries are successful.

Thanks,

--
Matyas Majzik
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
> bss_file.obj : error LNK2001: unresolved external symbol OPENSSL_UplinkTable
> b_dump.obj : error LNK2001: unresolved external symbol OPENSSL_UplinkTable
>
> So as you adviced I tried the following:
>
>>perl ms/uplink.pl win64a > uplink.asm
>>ml64 -c uplink.asm
>>add it to APP_EX_OBJ in ntdll.mak file.
>
> Still unsuccessful to compile:

It's called unsuccessful to link:-)

>    Creating library out32dll\libeay32.lib and object out32dll\libeay32.exp
> uplink.obj : error LNK2019: unresolved external symbol OPENSSL_Uplink

Oh! My fault! There is ms/uplink.c, which also needs to be compiled [and
it should be compiled?] and linked, so that instructions should have been:

- perl ms/uplink.pl win64a > uptable.asm
- ml64 -c uptable.asm
- make sure *both* uplink.obj and uptable.obj are listed in APP_EX_OBJ
in .mak file

A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Majzik Matyas
In reply to this post by Majzik Matyas
Hi!

First of all I figured it out that i should use SHLIB_EX_OBJ not
APP_EX_OBJ :))

Second if I add both uplink.obj and uptable.obj to SHLIB_EX_OBJ then I
cannot link libeay32.dll:

        link /nologo /subsystem:console /opt:ref bufferoverflowU.lib
/dll /out:o
ut32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\DOCUME~1\admin\LOCALS~1\Temp\nm118
3.tmp
uplink.obj : error LNK2005: OPENSSL_UplinkTable already defined in
uptable.obj
uplink.obj : error LNK2005: $lazy1 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy2 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy3 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy4 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy5 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy6 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy7 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy8 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy9 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy10 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy11 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy12 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy13 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy14 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy15 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy16 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy17 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy18 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy19 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy20 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy21 already defined in uptable.obj
uplink.obj : error LNK2005: $lazy22 already defined in uptable.obj
ms/LIBEAY32.def(7) : warning LNK4017: DESCRIPTION statement not
supported for the target platform; ignored
   Creating library out32dll\libeay32.lib and object out32dll\libeay32.exp
out32dll\libeay32.dll : fatal error LNK1169: one or more multiply
defined symbol
s found
NMAKE : fatal error U1077: 'link' : return code '0x491'
Stop.


If I add only uptable.obj then it can create libeay32.dll successfully.
However I cannot link ssleay32.dll. So I figured it out that I do not
need uptable.obj to link ssleay32.dll so I rewrite the ntdll.mak file:
SHLIB_EX_OBJ_SSL=
SHLIB_EX_OBJ_CRYPTO=uptable.obj

and then I modified the end of the mak file to use these variables for
the dlls.

So finally successful to build on amd 64 both statically and
dynamically. Thanks a lot. All tests are also successful.

I summarize here what to modify in the mak files to build on AMD 64:
Remove:
SHLIB_EX_OBJ=

Add:
SHLIB_EX_OBJ_SSL=
SHLIB_EX_OBJ_CRYPTO=uptable.obj

Modify:
CFLAGS= to remove /WX option because of size_t conversations and I also
recommend to use /MT instead of /MD for the static link libraries in
nt.mak file.
LFLAGS=/nologo /subsystem:console /opt:ref bufferoverflowU.lib (so
remove /machine:I386 flag and add bufferoverflowU.lib)
Only in ntdll.mak: MLFLAGS= /nologo /subsystem:console /opt:ref
bufferoverflowU.lib /dll (so remove /machine:I386 flag and add
bufferoverflowU.lib)

Modify the following to use SHLIB_EX_OBJ_SSL instead of SHLIB_EX_OBJ:
$(O_SSL): $(SSLOBJ)
        $(LINK) $(MLFLAGS) /out:$(O_SSL) /def:ms/SSLEAY32.def @<<
  $(SHLIB_EX_OBJ_SSL) $(SSLOBJ)  $(L_CRYPTO) wsock32.lib gdi32.lib
advapi32.lib user32.lib
<<

Modify the following to use SHLIB_EX_OBJ_CRYPTO instead of SHLIB_EX_OBJ:
$(O_CRYPTO): $(CRYPTOOBJ)
        $(LINK) $(MLFLAGS) /out:$(O_CRYPTO) /def:ms/LIBEAY32.def @<<
  $(SHLIB_EX_OBJ_CRYPTO) $(CRYPTOOBJ)  wsock32.lib gdi32.lib
advapi32.lib user32.lib
<<

So how to build on AMD 64 and Intel EM64T I summarize here:

1. perl Configure VC-WIN32
2. ms\do_ms
3. perl ms/uplink.pl win64a > uptable.asm
4. ml64 -c uptable.asm
5. modify the mak files as above
6. nmake -f ms\ntdll.mak
7. nmake -f ms\nt.mak

I used the new platform SDK with 64 bit compiler and MSVC++.

I hope it helps others out.

Thank you for your help,

--
Matyas Majzik
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
> First of all I figured it out that i should use SHLIB_EX_OBJ not
> APP_EX_OBJ :))

Keep in mind that the instructions were provided off the top of my head
and not actually tested, which is why it's so "bumpy." Bear with me:-)

> Second if I add both uplink.obj and uptable.obj to SHLIB_EX_OBJ then I
> cannot link libeay32.dll:
>
>         link /nologo /subsystem:console /opt:ref bufferoverflowU.lib
> /dll /out:o
> ut32dll\libeay32.dll /def:ms/LIBEAY32.def
> @C:\DOCUME~1\admin\LOCALS~1\Temp\nm118
> 3.tmp
> uplink.obj : error LNK2005: OPENSSL_UplinkTable already defined in
> uptable.obj
> uplink.obj : error LNK2005: $lazy1 already defined in uptable.obj

Did you recompile uplink.obj from uplink.c? I bet not, because
uplink.obj [if recompiled from uplink.c] can't contain definitions of
$lazyN.

> If I add only uptable.obj then it can create libeay32.dll successfully.

Yes, but it does not mean that Applink is functional. You have to link
both uplink.obj [compiled from .c] and uptable.obj [compiled from .asm].

> However I cannot link ssleay32.dll. So I figured it out that I do not
> need uptable.obj to link ssleay32.dll so I rewrite the ntdll.mak file:

That is correct.

> So finally successful to build on amd 64 both statically and
> dynamically. Thanks a lot. All tests are also successful.

Idea behind [up/app]link is to make it possible to use .dll with
application compiled with different compiler flags [/M* ones to be
specific]. Applink doesn't get engaged when application is compiled with
same flag as .dll, such as test applications. In other words you've got
*something* working, but it's *not* what *we* had in mind. So do give it
another try:-) A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Majzik Matyas
In reply to this post by Majzik Matyas
Another try :))

So I cleaned my openssl directory and started again. I cannot build the
dlls as you directed me because if I add both uplink.obj and uptable.obj
to SHLIB_EX_OBJ then I got the following:

        link /nologo /subsystem:console /opt:ref bufferoverflowU.lib
/dll /out:out32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\DOCUME~1\admin\LOCALS~1\Temp\nm1417.tmp
uplink.obj : error LNK2005: OPENSSL_Uplink already defined in uplink.obj
ms/LIBEAY32.def(7) : warning LNK4017: DESCRIPTION statement not
supported for th
e target platform; ignored
   Creating library out32dll\libeay32.lib and object out32dll\libeay32.exp
out32dll\libeay32.dll : fatal error LNK1169: one or more multiply
defined symbols found
NMAKE : fatal error U1077: 'link' : return code '0x491'
Stop.

I recompiled both uptable and uplink. But if I remove uplink from
SHLIB_EX_OBJ then it works properly.

Thanks,
--
Matyas Majzik
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
> So I cleaned my openssl directory and started again. I cannot build the
> dlls as you directed me because if I add both uplink.obj and uptable.obj
> to SHLIB_EX_OBJ then I got the following:
>
>         link /nologo /subsystem:console /opt:ref bufferoverflowU.lib
> /dll /out:out32dll\libeay32.dll /def:ms/LIBEAY32.def
> @C:\DOCUME~1\admin\LOCALS~1\Temp\nm1417.tmp
> uplink.obj : error LNK2005: OPENSSL_Uplink already defined in uplink.obj

Well, no multiple $lazyN is improvement, isn't it? The above error
message doesn't make sense though. uplink.obj complains about symbol
being already defined in itself... H-m-m-m... I have to ponder over this...

> I recompiled both uptable and uplink. But if I remove uplink from
> SHLIB_EX_OBJ then it works properly.

Stop saying "it works properly." It links, it passes the test, but it's
missing the functionality. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Majzik Matyas
In reply to this post by Majzik Matyas
Hi again!

> Well, no multiple $lazyN is improvement, isn't it? The above error
> message doesn't make sense though. uplink.obj complains about symbol
> being already defined in itself... H-m-m-m... I have to ponder over
> this...

Thanks. But i have made some progress... see later in this mail.

> Stop saying "it works properly." It links, it passes the test, but it's
> missing the functionality. A.

Well, functionality which I don't need. It still works properly for my
purposes. I can link all my applications to these dlls so functionality
for my needs are enough :)) Also I always prefer static libraries. I
only do these things and spend time on it to help you and others to make
openssl is the best.


So I have done more research on this anomaly. I inspected the temporary
file which used to link the dll in the following command:

      link /nologo /subsystem:console /opt:ref bufferoverflowU.lib /dll
/out:out32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\DOCUME~1\admin\LOCALS~1\Temp\nm1659.tmp

So nm1659.tmp contains the following:
  uptable.obj uplink.obj tmp32dll\uplink.obj tmp32dll\cryptlib.obj
tmp32dll\mem.obj....... (I don't include the whole file)

As you can see there is multiple uses of uplink.obj. That is the reason
- I think - why it worked for me without adding to SHLIB_EX_OBJ .

As I see uplink is automatically compiled and included by the make file
without need to be added to SHLIB_EX_OBJ.


Thanks for your time,

--
Matyas Majzik
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
>>Stop saying "it works properly." It links, it passes the test, but it's
>>missing the functionality.
>
> Well, functionality which I don't need.

Sorry, bit for me it's either everything or nothing. In this particular
context Applink is either there, ready to be used or not there [in which
case I'd have to modify FAQ]. Also keep in mind that it's publicly
archived list, meaning that context of discussion gets fuzzy when people
start searching for keywords. Meaning that if you say something, it pays
off to explicitly mention particular context, at least "works for *my*
purposes," as failure to do so might give wrong impression about *us*.

> I
> only do these things and spend time on it to help you and others to make
> openssl is the best.

But don't take the above rant personally, as it's pretty much just a
pedant's whine:-) As a matter of fact we are sincerely grateful for
feedback and will to resolve problems *our* way. Thank you.

> As you can see there is multiple uses of uplink.obj. That is the reason
> - I think - why it worked for me without adding to SHLIB_EX_OBJ .

Right!

> As I see uplink is automatically compiled and included by the make file
> without need to be added to SHLIB_EX_OBJ.

So that adding uptable.obj is sufficient. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
In reply to this post by Majzik Matyas
> So how to build on AMD 64 and Intel EM64T I summarize here:
>
> 1. perl Configure VC-WIN32
> 2. ms\do_ms
> 3. perl ms/uplink.pl win64a > uptable.asm
> 4. ml64 -c uptable.asm
> 5. modify the mak files as above
> 6. nmake -f ms\ntdll.mak
>
> I hope it helps others out.

As per today the above unsupported instructions have to be declared
officially invalid. This is because if built according to above, the
resulting .dll will be binary incompatible with one built according to
newly introduced supported procedure:

- perl Configure VC-WIN64A [or VC-WIN64I for Itanium];
- ms\do_win64a [or ms\do_win64i for Itanium];
- nmake -f ms/ntdll.mak;

This applies to upcoming 0.9.8 and most likely future releases. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Richard Levitte - VMS Whacker
Andy Polyakov writes:

> As per today the above unsupported instructions have to be declared
> officially invalid. This is because if built according to above, the
> resulting .dll will be binary incompatible with one built according to
> newly introduced supported procedure:
>
> - perl Configure VC-WIN64A [or VC-WIN64I for Itanium];
> - ms\do_win64a [or ms\do_win64i for Itanium];
> - nmake -f ms/ntdll.mak;
>
> This applies to upcoming 0.9.8 and most likely future releases. A.

Hmm, I think it would be good to create a INSTALL.W64, or perhaps change
INSTALL.W32 to INSTALL.Win and add 64-bit instructions in there.

Are you willing to do that, or will that become my last task before I
release 0.9.8?

 -----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                       http://richard.levitte.org/ 

"When I became a man I put away childish things, including
the fear of childishness and the desire to be very grown up."
                                               -- C.S. Lewis

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Andy Polyakov
>> As per today the above unsupported instructions have to be declared
>> officially invalid. This is because if built according to above, the
>> resulting .dll will be binary incompatible with one built according to
>> newly introduced supported procedure:
>> - perl Configure VC-WIN64A [or VC-WIN64I for Itanium];
>> - ms\do_win64a [or ms\do_win64i for Itanium];
>> - nmake -f ms/ntdll.mak;
>> This applies to upcoming 0.9.8 and most likely future releases. A.
>
>
> Hmm, I think it would be good to create a INSTALL.W64,

I'm writing one right now. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Majzik Matyas
Hi,

> newly introduced supported procedure:

> - perl Configure VC-WIN64A [or VC-WIN64I for Itanium];
> - ms\do_win64a [or ms\do_win64i for Itanium];
> - nmake -f ms/ntdll.mak;

> This applies to upcoming 0.9.8 and most likely future releases. A

This is great news. Thank you for your great work. It will simplify the
build of OpenSSL on Win64 platform.

Thanks,

--
Matyas Majzik
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Win 64a dynamic link library build was unsuccessful using beta6

Richard Levitte - VMS Whacker
In reply to this post by Andy Polyakov
Andy Polyakov writes:

>
>> Hmm, I think it would be good to create a INSTALL.W64,
>
> I'm writing one right now. A.

Great!

Cheers,
Richard


 -----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                       http://richard.levitte.org/ 

"When I became a man I put away childish things, including
the fear of childishness and the desire to be very grown up."
                                               -- C.S. Lewis

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]