x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Packaging/Shipping build errors from custom C++ plugin/libraries using OpenSSL

Question/Problem

If I build in Development editor configuration, the build is successful. But when trying to package the project, I get lots of already defined in libcurl_a.lib linker errors, because I am linking in libssl.lib and libcrypto.lib via a custom plugin (that relies on custom C++ libraries using OpenSSL). This is a very major issue as it is restricting access to complex libraries built on top of using that OpenSSL version. How can I disable libcurl and related/conflicting modules from builds/packaging?

 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(ssl_lib.obj) : error LNK2005: ssl3_undef_enc_method already defined in libcurl_a.lib(ssl_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(ssl_lib.obj) : error LNK2005: SSL_version_str already defined in libcurl_a.lib(ssl_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_enc_data already defined in libcurl_a.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_1_enc_data already defined in libcurl_a.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_2_enc_data already defined in libcurl_a.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(d1_lib.obj) : error LNK2005: DTLSv1_enc_data already defined in libcurl_a.lib(d1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(d1_lib.obj) : error LNK2005: DTLSv1_2_enc_data already defined in libcurl_a.lib(d1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(s3_lib.obj) : error LNK2005: SSLv3_enc_data already defined in libcurl_a.lib(s3_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(cryptlib.obj) : error LNK2005: OPENSSL_NONPIC_relocated already defined in libcurl_a.lib(cryptlib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(v3_ncons.obj) : error LNK2005: v3_name_constraints already defined in libcurl_a.lib(v3_ncons.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_encrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_decrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ecb_encrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ccm64_encrypt_blocks already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ccm64_decrypt_blocks already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ctr32_encrypt_blocks already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_xts_encrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_xts_decrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_cbc_encrypt already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_set_decrypt_key already defined in libcurl_a.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_set_encrypt_key already defined in libcurl_a.lib(aesni-x86_64.obj)

It is very similar to https://answers.unrealengine.com/questions/471041/shipping-plugin-with-thirdparty-lib-with-libcurl.html (that was never answered), except I am using another version of OpenSSL instead of another version of libcurl.


Technical details

Unreal Engine: 4.19.2 (pre-built Launcher version).

Compiler/IDE: Visual Studio 2015 Enterprise Update 3

OpenSSL: 1.1.0h

Operating System: Windows 7 Ultimate x64 Service Pack 1


Relevant links studied (irrelevant omitted)


Approaches NOT working

[1] Adding to project DefaultEngine.ini:

 [Networking]
 UseLibCurl=false

[2] Adding to .Build.cs of both plugin module (linking in the libraries) AND main project:

 PublicDependencyModuleNames.Remove("libcurl");
 PublicDependencyModuleNames.Remove("HTTP");
 PublicDependencyModuleNames.Remove("OpenSSL");
 PrivateDependencyModuleNames.Remove("libcurl");
 PrivateDependencyModuleNames.Remove("HTTP");
 PrivateDependencyModuleNames.Remove("OpenSSL");
 PublicAdditionalLibraries.Remove("libcurl_a.lib");
 PublicAdditionalLibraries.Remove("libcurl_a");

[3] Unchecking the "Verify Peer" box in Edit -> Project Settings -> Network -> Libcurl.

[4] Disabling all of the TCP/UDP Messaging (and others in the list) plugins under Edit -> Project Settings -> Plugins category/section.

[5] Commenting out libcurl linking in UE_4.19\Engine\Source\ThirdParty\libcurl\libcurl.Build.cs:

 // Commented out.
 //PublicAdditionalLibraries.Add("libcurl_a.lib");
 //PublicDefinitions.Add("CURL_STATICLIB=1");

Produces different errors (seem to be related to OpenSSL more directly this time).

 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(cryptlib.obj) : error LNK2005: OPENSSL_NONPIC_relocated already defined in libeay.lib(cryptlib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_encrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_decrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ecb_encrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ccm64_encrypt_blocks already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ccm64_decrypt_blocks already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_ctr32_encrypt_blocks already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_xts_encrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_xts_decrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_cbc_encrypt already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_set_decrypt_key already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libcrypto.lib(aesni-x86_64.obj) : error LNK2005: aesni_set_encrypt_key already defined in libeay.lib(aesni-x86_64.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(ssl_lib.obj) : error LNK2005: ssl3_undef_enc_method already defined in ssleay.lib(ssl_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(ssl_lib.obj) : error LNK2005: SSL_version_str already defined in ssleay.lib(ssl_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_enc_data already defined in ssleay.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_1_enc_data already defined in ssleay.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(t1_lib.obj) : error LNK2005: TLSv1_2_enc_data already defined in ssleay.lib(t1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(d1_lib.obj) : error LNK2005: DTLSv1_enc_data already defined in ssleay.lib(d1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(d1_lib.obj) : error LNK2005: DTLSv1_2_enc_data already defined in ssleay.lib(d1_lib.obj)
 UATHelper: Packaging (Windows (64-bit)):   libssl.lib(s3_lib.obj) : error LNK2005: SSLv3_enc_data already defined in ssleay.lib(s3_lib.obj)

As well as new errors:

 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_unescape
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_free
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_global_init_mem
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_global_cleanup
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_slist_append
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_slist_free_all
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_share_init
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_share_setopt
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_version_info
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_strerror
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_init
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_setopt
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_cleanup
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_easy_getinfo
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_init
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_add_handle
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_remove_handle
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_perform
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_cleanup
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_info_read
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_strerror
 UATHelper: Packaging (Windows (64-bit)):   UE4-HTTP.lib(Module.HTTP.cpp.obj) : error LNK2001: unresolved external symbol curl_multi_setopt

[6] Rebuilding Intermediate directory.

[7] Building from Visual Studio in Shipping configuraion (produces identical errors as through Editor packaging).

[8] Disabling most plugins ( SteamVR, OculusVR, CryptoKeys, OnlineSubsystem, OnlineSubsystemUtils, OnlineSubsystemNull, OnlineSubsystemIOS, GoogleCloudMessaging, NetcodeUnitTest, NUTUnrealEngine4, HTML5Networking, UdpMessaging, TcpMessaging, UObjectPlugin, IOSDeviceProfileSelector, AndroidDeviceProfileSelector, LocationServicesBPLibrary, AppleARKit, AndroidPermission, OnlineSubsystemGooglePlay ), most notably AES Network Pakcet Handler and Platform Cryptography plugin (although the latter two aren't automatically added to the .uproject, they are unchecked in the Editor).

[9] Trying to build as "Modular" instead of default "Monolithic" by adding LinkType = TargetLinkType.Modular; to <GameProjectName>.Target.cs fails with the following errors:

 UATHelper: Packaging (Windows (64-bit)):   LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\Epic Games\UE_4.19\Engine\Intermediate\Build\Win64\UE4\Development\UE4-CoreUObject.lib'
 UATHelper: Packaging (Windows (64-bit)):   LINK : fatal error LNK1181: cannot open input file 'C:\Program Files\Epic Games\UE_4.19\Engine\Intermediate\Build\Win64\UE4\Development\UE4-Core.lib'

[10] Trying to add the updated 1.1.0 OpenSSL version in the same way the existing 1.0.2 version is already present (in the Engine ThirdParty directory), through C:\Program Files\Epic Games\UE_4.19\Engine\Source\ThirdParty\OpenSSL\OpenSSL.Build.cs. After, adding the module dependency for that PrivateDependencyModuleNames.Add("OpenSSL"); to <GameProject>.Build.cs (instead of linking OpenSSL through the plugin). But that produced the same behavior/errors as manually linking through the plugin.


Test project

I have created a test project as simplified version of the issue. It uses the same setup (custom plugin with custom C++ library using OpenSSL) that simply initializes two OpenSSL structures. There are only a few errors with that test project, but they are of the same nature, so the underlying issue is the same. The project contains pre-compiled libraries so it should be very easy to use.

Small note: Although it's a .zip archive file, there's actually a .7z archive inside the .zip archive, due to the 5.2MB upload limit.

Product Version: UE 4.19
Tags:
more ▼

asked Jun 03 '18 at 01:32 PM in C++ Programming

avatar image

Wooden Banana
6 2 2

avatar image Shadowriver Jun 02 '18 at 11:00 PM

You can't disable those because engine needs them, thats why after commenting them out you started to have unresolved symbols errors from HTTP module which use curl.

I think you trying too aggressive methods here just because library in plugin you technicly trying to nuke any use of OpenSSL in rest of the enigne. Insted of destroying one side you should make them cooperate or at least coexist. Is there really API breaking differences between OpenSSL in UE4 and your plugin? did you tried your library in plugin with OpenSSL in UE4? Did you tried upgrading library in UE4 to version that your plugin needs? did you maybe try to modify build scipts in library to rename other version of OpenSSL in plugin?

avatar image Wooden Banana Jun 02 '18 at 11:25 PM

Is there really API breaking differences between OpenSSL in UE4 and your plugin? did you tried your library in plugin with OpenSSL in UE4?

Yes, there are major differences in behavior and protocol support between 1.0.2 and 1.1.0 branches , thus it will not be compatible as the library relies strictly on 1.1.0 behavior.

Did you tried upgrading library in UE4 to version that your plugin needs?

I haven't tried it, is that possible with the pre-built launcher version? How?

did you maybe try to modify build scipts in library to rename other version of OpenSSL in plugin?

I'm sorry, I don't understand what you are saying. What build scripts in the library, do you mean the build scripts of the plugin linking/exposing the library? If so, then renaming what other version in the plugin, how, why? I'm sorry, it's unclear what you were trying to say, could you please rephrase that?

avatar image Wooden Banana Jun 03 '18 at 03:00 AM

Probably worth mentioning as a failed attempt [10]

I've tried adding the 1.1.0 OpenSSL version in the same way the current UE4 1.0.2 version exists through C:\Program Files\Epic Games\UE_4.19\Engine\Source\ThirdParty\OpenSSL\OpenSSL.Build.cs and added PrivateDependencyModuleNames.Add("OpenSSL"); to .Build.cs (instead of also linking through the plugin). But that produced the same behavior/errors as manually linking through the plugin.

avatar image David Gundry Oct 24 '18 at 03:42 PM

Any progress on this? I'm suffering with the exact same problem.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question