开发者

Static linking with OpenSSL

开发者 https://www.devze.com 2023-03-21 05:28 出处:网络
We have a project really similar to the one reported in this question where OpenSSL is the starting point of lib B. When compiling the executable (Exe 1), the problem is that we are getting some linki

We have a project really similar to the one reported in this question where OpenSSL is the starting point of lib B. When compiling the executable (Exe 1), the problem is that we are getting some linking issues that seems to be related to OpenSSL linking.

(cryptlib.obj) LNK2019: unresolved external symbol __alloca_probe_16 referenced in function _OPENSSL_isservice
(bss_file.obj) LNK2001: unresolved external symbol __alloca_probe_16 
(b_print.obj)  LNK2019: unresolved external symbol __ftol2_sse referenced in function _roundv

Compiling the library doesn't give any error whatsoever. I'm curious to know where are located these functions so that I can add the correct references in the project.

I'm running on Windows 7 with a 64 bits proc, if that can make any difference :)

Edit1

Those are errors when compiling in Win32 with VS2010.

Edit2

The OpenSSL lib (libeay32.lib) was also compiled with nasm for VS2010 (for Win32).

Edit3

If someone could point out a link to build OpenSSL with VS2010 (vc2010) or VS2008 compiler, that would also be helpfull (other than pointing to the InstallW** files in OpenSSL)

Edit4

We are also using the W开发者_StackOverflowindows DDK 2003, if it can help.


Here are the steps I took to solve the issue :

Solving the __alloca_probe_16 linking error

Since we also have Visual Studio 2008 installed we used some obj files to fix this issue. alloca16.obj is present in four different directories under the Visual Studio 2008 folder (which should be something like C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/crt/src/intel/XXX_lib where XXX might be dll, mt, xdll or xmt. Note that I'm not quite sure what is the difference between any of them).

Adding this path to the Linker > General > Addtionnal Library Directories under the Properties panel of the project and adding alloca16.obj to the Linker > Input > Addtional Dependencies solved the issue.

Solving the __ftol2_sse linking error

This one is a little bit tricky. Configuring OpenSSL with no-sse2 flag seems like it would fix the problem... but not as of version 1.0.0d. I created a new header file which contains this :

extern "C" { 
   long _ftol( double ); 
   long _ftol2_sse( double dblSource ) { return _ftol( dblSource ); }
}

(as shown on this site)

0

精彩评论

暂无评论...
验证码 换一张
取 消