[openssl-users] What happened during compiling openssl?

Jakob Bohm jb-openssl at wisemo.com
Fri Nov 11 03:40:58 UTC 2016


On 11/11/2016 03:12, Gyumin wrote:
>
> Dear openssl developers,
>
> I modified openssl library to use my own static library which has 
> global variables.
> When I run make then I can see some errors like|./libcrypto.so: 
> undefined reference to my_own_function|and making static libraries is 
> failed, but the shared libraries are compiled successfully.
> Finally, there is no issue to use the compiled shared library in my 
> another application.
> The problem occurs when I link my static library to resolve the 
> undefined error. The shared libraries and static libraries are 
> compiled successfully, but when I use the shared libraries in my 
> application, addresses of the global variables are different.
> For example, if the address of global variable 'A' in my application 
> is 0x1234 then the address of the 'A' in the shared library is 0xABCD.
> Why does this situation happen? Thanks for your helps in advance.
When you link a static library (your own in this case) into shared
libraries (libcrypto.so and libssl.so in this case), each shared
library gets its own copy of the stuff in your static library,
including the variables.

If you want the OpenSSL libraries to use the same copy of the
variables in your own library as each other and as your application,
you need to either use static openssl libraries or turn your own
library into a shared library.

I am guessing the error when compiling the static OpenSSL libraries
is slightly different from what you wrote, reporting instead that
"my_own_function" is missing when linking one or more OpenSSL
programs or selftests against libcrypto.a and libssl.a.  If that is
the error message, you need to modify the CFLAGS used by the OpenSSL
build to include the options to link in your own static library too.

Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded



More information about the openssl-users mailing list