Reputation: 21
I'm currently trying to make a project with Unreal Engine 4, that executes HTTPS requests from C++ code.
In order to achieve that goal, I'm using the library c++-httplib, which requires OpenSSL, so I added it to my project, giving the location of include
and lib
files within my Project.Build.cs
file, especially libssl.lib
et libcrypto.lib
.
Everything works perfectly fine within the Editor, but as soon as I try to package my project, I get the following errors (line 11-12)
1:UEBuildTarget.GenerateManifest: Writing manifest to C:\MyProject\Intermediate\Build\Manifest.xml
2:ActionGraph.IsActionOutdated: MyProject.exe: Produced item "MyProject.exe" doesn't exist.
3:ActionGraph.DeleteOutdatedProducedItems: Deleting outdated item: C:\MyProject\Binaries\Win64\MyProject.pdb
4:UEBuildTarget.TryRecycleVersionManifests: Target is not using a version file.
5:ParallelExecutor.ExecuteActions: Building 1 action with 12 processes...
6:ParallelExecutor.ExecuteActions: [1/1] MyProject.exe
7:ParallelExecutor.ExecuteActions: vpxmd.lib(vpx_src_vpx_codec.obj) : .netmodule ou module MSIL compil� avec /GL trouv�; red�marrage de l'�dition de liens avec /LTCG�; ajoutez /LTCG � la ligne de commande de l'�dition de liens pour am�liorer les performances de l'�diteur de liens
8:ParallelExecutor.ExecuteActions: Cr�ation de la biblioth�que C:\MyProject\Binaries\Win64\MyProject.lib et de l'objet C:\MyProject\Binaries\Win64\MyProject.exp
9:ParallelExecutor.ExecuteActions: G�n�ration de code en cours
10:ParallelExecutor.ExecuteActions: Fin de la g�n�ration du code
11:ParallelExecutor.ExecuteActions: libcurl_a.lib(pem_all.obj) : error LNK2005: PEM_read_bio_RSAPrivateKey d�j� d�fini(e) dans libcrypto64MD.lib(libcrypto-1_1-x64.dll)
12:ParallelExecutor.ExecuteActions: libcurl_a.lib(pem_pkey.obj) : error LNK2005: PEM_read_bio_PrivateKey d�j� d�fini(e) dans libcrypto64MD.lib(libcrypto-1_1-x64.dll)
13:ParallelExecutor.ExecuteActions: C:\MyProject\Binaries\Win64\MyProject.exe : fatal error LNK1169: un ou plusieurs symboles d�finis � diff�rentes reprises ont �t� rencontr�s
14:Log.WriteException: ==============================================================================
15:Log.WriteException: ERROR: UBT ERROR: Failed to produce item: C:\MyProject\Binaries\Win64\MyProject.exe
16:Log.WriteException: (see C:\Users\etudiant\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.21\UBT-MyProject-Win64-Development.txt for full exception trace)
17:Log.WriteException:
18:Log.WriteException: BuildException: UBT ERROR: Failed to produce item: C:\MyProject\Binaries\Win64\MyProject.exe
19:Log.WriteException: à UnrealBuildTool.ActionGraph.ExecuteActions(BuildConfiguration BuildConfiguration, List`1 ActionsToExecute, String& ExecutorName, String TargetInfoForTelemetry, EHotReload HotReload) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\ActionGraph.cs:ligne 507
20:Log.WriteException: à UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String[] Arguments, FileReference ProjectFile, Boolean bCatchExceptions) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:ligne 1699
21:Log.WriteException: ==============================================================================
22:UnrealBuildTool.RunUBT: Total build time: 42,37 seconds (Parallel executor: 0,00 seconds)
And I don't have a clue of what I can do about it.
Upvotes: 2
Views: 1843
Reputation: 14158
The main problem is linker error LNK2005 which means you are linking in the same symbol (code) from two different places.
Namely "PEM_read_bio_RSAPrivateKey" and "PEM_read_bio_PrivateKey" from "libcurl_a.lib" and "libcrypto64MD.lib".
At a guess the "libcurl_a" library has openssl statically linked in already and you are trying to linked in the the openssl dynamic library "libcrypto64MD" (libcrypto-1_1-x64.dll).
You may be able to drop the linking in of "libcrypto64MD.lib" and get open ssl from "libcurl_a.lib". If you can't because of missing symbols, you may need to compile or get a different version of libcurl that uses the dll version of the openssl library.
Upvotes: 1