Self built OpenSSL version 3.0.8 names
Moderator: Moderator Team
Re: Self built OpenSSL version 3.0.8 names
Turns out the library names matter (thought it only mattered when they were downloaded from DCMTK website).
I also found out that if the CMake process doesn't find the libraries with those names, it will not find the functions it needs to find to setup OpenSSL/DCMTK for building.
I didn't realize that the process looked into the libraries. I thought they only looked into the ts.h header file.
I also found out that if the CMake process doesn't find the libraries with those names, it will not find the functions it needs to find to setup OpenSSL/DCMTK for building.
I didn't realize that the process looked into the libraries. I thought they only looked into the ts.h header file.
Re: Self built OpenSSL version 3.0.8 names
Looks like changing the .lib names helps with the configure/generate steps and allows the build to work later.
However, the tool exes are still looking for DLLs named: libssl-3-x64.dll and libcrypto-3-x64.dll.
I have asked the OpenSSL team if there is a way to set the names during their build process.
Since the DCMTK team has built several versions of OpenSSL, perhaps they have advice too.
However, the tool exes are still looking for DLLs named: libssl-3-x64.dll and libcrypto-3-x64.dll.
I have asked the OpenSSL team if there is a way to set the names during their build process.
Since the DCMTK team has built several versions of OpenSSL, perhaps they have advice too.
-
- OFFIS DICOM Team
- Posts: 1497
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Self built OpenSSL version 3.0.8 names
We use a CMake script that modifies the makefile after OpenSSL's Perl configure script has generated it. Here are the relevant parts:
Code: Select all
file(READ "makefile" MAKEFILE)
if(DEBUG)
string(REGEX REPLACE "lib(crypto|ssl)([^ \n\t\r]*\\.)(dll|lib|def|pdb)" "dcmtk\\1_d\\2\\3" MAKEFILE "${MAKEFILE}")
string(REGEX REPLACE "LIBRARY lib(crypto|ssl)" "LIBRARY dcmtk\\1_d" MAKEFILE "${MAKEFILE}")
else()
string(REGEX REPLACE "lib(crypto|ssl)([^ \n\t\r]*\\.)(lib|def)" "dcmtk\\1_o\\2\\3" MAKEFILE "${MAKEFILE}")
string(REGEX REPLACE "lib(crypto|ssl)([^ \n\t\r]*\\.)(dll|pdb)" "dcmtk\\1\\2\\3" MAKEFILE "${MAKEFILE}")
string(REGEX REPLACE "LIBRARY lib(crypto|ssl)" "LIBRARY dcmtk\\1" MAKEFILE "${MAKEFILE}")
endif()
if(MT)
string(REGEX REPLACE "(\nCFLAGS=[^\n]*)/MD([^\n]*\n)" "\\1/MT\\2" MAKEFILE "${MAKEFILE}")
string(REGEX REPLACE "(\nBIN_CFLAGS=[^\n]*)/MD([^\n]*\n)" "\\1/MT\\2" MAKEFILE "${MAKEFILE}")
endif()
# What a great idea to write a .def file that overwrites the library name
# passed to the linker as an argument with a fixed and non-configurable
# string.
# Now to fix this genius idea, let's employ some regex magic that patches some
# regex magic into the Makefile...
string(REGEX REPLACE
"(\t[^\r\n]*util[\\]mkdef[.]pl[^>]*)(> [$]@)"
"\\1| sed \"/^LIBRARY/d\" \\2"
MAKEFILE "${MAKEFILE}"
)
file(WRITE "makefile" "${MAKEFILE}")
-
- DCMTK Developer
- Posts: 2072
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Self built OpenSSL version 3.0.8 names
Hi,
I tried to use pre-built current version of OpenSSL to check building DCMTK with it. This is what I have done:
BR Michael
I tried to use pre-built current version of OpenSSL to check building DCMTK with it. This is what I have done:
- Download Windows build of OpenSSL. I used this one (Win64 OpenSSL v3.3.1 MSI installer): https://slproweb.com/products/Win32OpenSSL.html
- Configure DCMTK in CMake (no options set)
- When configured with default options, enable the following option: DCMTK_USE_FIND_PACKAGE (should be pre-defined but disabled)
- Also, enable the following option: DCMTK_WITH_OPENSSL
- Configure in CMake again to take over these settings
- Generate project files in CMake
- Compile DCMTK in Visual Studio (e.g. build storescu which is an SSL-enabled tool if you don't want a full build for testing)
- Run storescu --version to see whether it prints the OpenSSL version you wanted to link agianst.
- Note that running the executables will require the OpenSSL DLLS to be in your DLL path, e.g. copy to the directory where the executable is stored.
BR Michael
-
- DCMTK Developer
- Posts: 2072
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Self built OpenSSL version 3.0.8 names
P.S: I also tried with a self-built OpenSSL. It also works for my out of the box.
- Download Windows build of OpenSSL. I used this one (Win64 OpenSSL v3.3.1 MSI installer Download and build source code as described here: https://wiki.openssl.org/index.php/Comp ... lation#W64
- Configure DCMTK in CMake (no options set)
- When configured with default options, enable the following option: DCMTK_USE_FIND_PACKAGE (should be pre-defined but disabled)
- Also, enable the following option: DCMTK_WITH_OPENSSL
- Also, add the following CMake Option: OPENSSL_ROOT_DIR and set it to your downloaded (and built) version of OpenSSL directory (for me it was C:/Users/onken/Downloads/openssl-3.3.1)
- ...rest as above
Re: Self built OpenSSL version 3.0.8 names
Thank you Michael.Michael Onken wrote: ↑Mon, 2024-07-29, 09:31 Hi,
I tried to use pre-built current version of OpenSSL to check building DCMTK with it. This is what I have done:This works for me using current DCMTK code and OpenSSL 3.3.1.
- Download Windows build of OpenSSL. I used this one (Win64 OpenSSL v3.3.1 MSI installer): https://slproweb.com/products/Win32OpenSSL.html
- Configure DCMTK in CMake (no options set)
- When configured with default options, enable the following option: DCMTK_USE_FIND_PACKAGE (should be pre-defined but disabled)
- Also, enable the following option: DCMTK_WITH_OPENSSL
- Configure in CMake again to take over these settings
- Generate project files in CMake
- Compile DCMTK in Visual Studio (e.g. build storescu which is an SSL-enabled tool if you don't want a full build for testing)
- Run storescu --version to see whether it prints the OpenSSL version you wanted to link agianst.
- Note that running the executables will require the OpenSSL DLLS to be in your DLL path, e.g. copy to the directory where the executable is stored.
BR Michael
I was running CMake Configure with DCMTK_USE_FIND_PACKAGE disabled (DCMTK_USE_FIND_PACKAGE:BOOL=OFF in CMakeCache.txt). So it seems I should have enabled this and it would have find my actual libraries?
DCMTK_WITH_OPENSSL was enabled (DCMTK_WITH_OPENSSL:BOOL=ON)
What confused me is CMake seemed to find the include and lib paths just fine. The only thing it didn't get right were the library names
WITH_OPENSSLINC:PATH=C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32
DCMTK_LIBRARY_DEPENDENCIES:INTERNAL=config;iphlpapi;ws2_32;netapi32;wsock32;iphlpapi;ws2_32;netapi32;wsock32;crypt32;debug;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkssl_d.lib;optimized;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkssl_o.lib;debug;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkcrypto_d.lib;optimized;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkcrypto_o.lib;crypt32;debug;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkssl_d.lib;optimized;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkssl_o.lib;debug;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkcrypto_d.lib;optimized;C:/repos/mmi-director-dcmtk-3.6.8/openssl-3.0.8-win32/lib/dcmtkcrypto_o.lib
Re: Self built OpenSSL version 3.0.8 names
I considered using this method but never tried it because I thought OPENSSL_ROOT_DIR was only for downloaded already built openssl packages.Michael Onken wrote: ↑Mon, 2024-07-29, 10:21 P.S: I also tried with a self-built OpenSSL. It also works for my out of the box.
- Download Windows build of OpenSSL. I used this one (Win64 OpenSSL v3.3.1 MSI installer Download and build source code as described here: https://wiki.openssl.org/index.php/Comp ... lation#W64
- Configure DCMTK in CMake (no options set)
- When configured with default options, enable the following option: DCMTK_USE_FIND_PACKAGE (should be pre-defined but disabled)
- Also, enable the following option: DCMTK_WITH_OPENSSL
- Also, add the following CMake Option: OPENSSL_ROOT_DIR and set it to your downloaded (and built) version of OpenSSL directory (for me it was C:/Users/onken/Downloads/openssl-3.3.1)
- ...rest as above
For both of your suggested options, did I misunderstand the instructions in INSTALL? I thought I followed the instructions for creating my own libraries and putting them in a place that CMake configure would find them.
With the variations I tried, perhaps I lost track of the part about using DCMTK_USE_FIND_PACKAGE.
I had been relying on the default search behavior finding my includes and libs. As this text from INSTALL suggested and most of the behavior had me think was happening.
I didn't see DCMTK_USE_FIND_PACKAGE mentioned in the INSTALL file.- OPENSSL_ROOT_DIR: Directory where OpenSSL is installed.
Default: search in standard directories for headers and libraries.
Thank you for your help.
Who is online
Users browsing this forum: No registered users and 1 guest