[CMake] Linker error when building 3.8.0-rc4 on Linux

Nils Gladitz nilsgladitz at gmail.com
Fri Mar 31 02:28:43 EDT 2017


On 03/31/2017 07:46 AM, ウルヰ wrote:

> ../Utilities/cmlibarchive/libarchive/libcmlibarchive.a(archive_hmac.c.o):
> In function `__hmac_sha1_init':
> archive_hmac.c:(.text+0x25): undefined reference to `HMAC_CTX_new'
> ../Utilities/cmlibarchive/libarchive/libcmlibarchive.a(archive_hmac.c.o):
> In function `__hmac_sha1_cleanup':
> archive_hmac.c:(.text+0x12d): undefined reference to `HMAC_CTX_free'
> collect2: error: ld returned 1 exit status
> Source/CMakeFiles/ccmake.dir/build.make:422: recipe for target
> 'bin/ccmake' failed
> make[2]: *** [bin/ccmake] Error 1
> CMakeFiles/Makefile2:2314: recipe for target
> 'Source/CMakeFiles/ccmake.dir/all' failed
> make[1]: *** [Source/CMakeFiles/ccmake.dir/all] Error 2
> Makefile:162: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Is this a bug with the build configuration or have I forgotten to do
> something I need to do?

According to the OpenSSL documentation HMAC_CTX_new() and 
HMAC_CTX_free() were introduced in 1.1.0.
Presumably your OpenSSL version is older than that and disabling OpenSSL 
(presuming you don't need it) or building against a newer version should 
help.

To disable OpenSSL e.g. "cmake ... -DCMAKE_USE_OPENSSL=false" or 
"bootstrap ... --  -DCMAKE_USE_OPENSSL=false".
To point CMake at a custom OpenSSL installation instead setting the 
CMAKE_PREFIX_PATH environment to the installation should work.

Nils


More information about the CMake mailing list