Shipping plugin with ThirdParty lib with libCURL

Hello,

I have a .lib (let’ call it “happy.lib” - it is a pretty large project that communicates with a server, database, stores data onto a drive etc. and it has a few third party dependencies - one of them is a libCURL. I add the happy.lib with all the dependencies it needs into the plugin as PublicAdditionalLibraries (the libraries) and PublicIncludePaths (the headers).

…and around the happy.lib, I am developing a plugin, that propagates some of that functionality into the Unreal Editor so it can be easily used in a blueprint.

I also need to be able to package the result into an executable and that is the problem:

  • If I build the plugin in: Development editor configuration, the build is successful, I can run the Editor, create a blueprint and happily work with the functions provided by the plugin - that works OK.
  • If I build the plugin in: Shipping configuration, the build fails reporting the following error in every object file from the happy.lib that uses a reference into the libCURL header files: curl_easy_cleanup already defined in libcurl_a.lib(easy.obj) - thus the libCURL linked by me is conflicting with the libCURL provided by Unreal Engine.
  • If I remove the dynamically linked libCURL that I added as a dependency with the happy.lib, the build is successful-ish (a reference to the static libCURL library is used) with linker warnings: LNK4049 locally defined symbol ‘symbol’ imported BUT at the same time, I cannot build in the Developement editor configuration (Unresolved external symbols) and even if I package the game, it does not work (from logs from happy.lib and Wireshark I found out that a first message (that opens a connection with a server) is send to the server, response is returned successfully but the client (Unreal/plugin) receives an empty message even though the server sent correct message.
  • The only working solution I have now is that in libcurl.Build in Engine/Source/ThirdParty/libcurl I comment out these lines:
    PublicAdditionalLibraries.Add("libcurl_a.lib"); Definitions.Add("CURL_STATICLIB=1");
    That prevents the libCURL to be available in the Engine and the Unreal then lets me use the libCURL I provided. The build in both configurations works fine, so does the packaging and the game.

My question is: Is there a way to nicely suppress the libCURL in the Engine without modifying the Unreal Engine (prehaps in the .ini config files)? Is there a better way to do this?

Thank You very much for your time! :slight_smile:

Jakub

1 Like