NinevaStudios / mqtt-utilities-unreal

MqttUtilities is a plugin for Unreal Engine intended to expose MQTT client functionality to blueprints
Eclipse Public License 1.0
147 stars 54 forks source link

Temporary pointer compile error on MacOS Sonoma with XCode 15.0 #33

Open morotsgurka opened 9 months ago

morotsgurka commented 9 months ago

When using the plugin with Unreal Engine 5.3.1 on MacOS Sonoma 14.0 and XCode 15.0, i get a compile issue in StringUtils.cpp. The error is line 7: const char* originalStr = TCHAR_TO_ANSI(*str); where i get the following error: temporary whose address is used as value of local variable 'originalStr' will be destroyed at the end of the full-expression [-Werror,-Wdangling]

Toernblom commented 8 months ago

Same error here, Ubuntu 22.04 , UE 5.3.1

Toernblom commented 7 months ago

Fixed by building https://github.com/eclipse/mosquitto from source.

Need to change a few things,

first in StringUtils.cpp from the plugin

auto convertedStr = StringCast<ANSICHAR>(*str);
const char* originalStr = convertedStr.Get();

In mosquitto src CMakeLists.txt

option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" ON)
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" ON)

in config.mk

WITH_STATIC_LIBRARIES:=yes

Then "make"

Move the outputs libmosquitto.so , libmosquittopp.so and _static to the thirdParty/linux/ appropiate folders.

i also added these lines to the build.cs of the plugin.

PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libssl.a");
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libcrypto.a");
YasserNezzari commented 3 months ago

@Toernblom I had the same issue when packaging for android, your solution worked for me, thank you !

morotsgurka commented 2 months ago

@Toernblom I've followed your steps and updated our fork of the plugin with the changes. One problem I have is that when building for shipping i get a lot of build errors because there exists 2 libssl.a, Example:

"ld.lld: error: duplicate symbol: SSL_CTX_set_purpose" "ld.lld: error: duplicate symbol: SSL_add1_host"

The definitions are:

I've tried to link to the engine provided libs but that does not seem to work (or I'm doing something wrong). Found this on integrating third-party libraries into Unreal and tried to make the path relative to the Engine path (so it would work for more people than just my Unreal path).

OS: Ubuntu 22.04.4 LTS Unreal Engine 5.3.2 (Linux)