Skip to content

Commit

Permalink
Revert Linux static libs to resolve user support case
Browse files Browse the repository at this point in the history
  • Loading branch information
tustanivsky committed Oct 10, 2024
1 parent 3bd0c82 commit 6710d9a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 39 deletions.
6 changes: 5 additions & 1 deletion plugin-dev/Source/Sentry/Private/SentryModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ void FSentryModule::StartupModule()

#if PLATFORM_MAC
const FString SentryLibName = TEXT("sentry.dylib");
const FString BinariesDirPath = GIsEditor ? FPaths::Combine(GetThirdPartyPath(), TEXT("bin")) : GetBinariesPath();
#elif PLATFORM_LINUX
const FString SentryLibName = TEXT("libsentry.so");
#endif

#if PLATFORM_MAC || PLATFORM_LINUX
const FString BinariesDirPath = GetBinariesPath();
FPlatformProcess::PushDllDirectory(*BinariesDirPath);
mDllHandleSentry = FPlatformProcess::GetDllHandle(*FPaths::Combine(BinariesDirPath, SentryLibName));
FPlatformProcess::PopDllDirectory(*BinariesDirPath);
Expand Down
14 changes: 4 additions & 10 deletions plugin-dev/Source/Sentry/Sentry.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,13 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target)
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Desktop"));

RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "crashpad_handler"), Path.Combine(PlatformThirdPartyPath, "bin", "crashpad_handler"));
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "libsentry.so"), Path.Combine(PlatformThirdPartyPath, "bin", "libsentry.so"));

PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_client.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_compat.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_handler_lib.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_minidump.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_snapshot.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_tools.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libcrashpad_util.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libmini_chromium.a"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "libsentry.a"));
PublicRuntimeLibraryPaths.Add(PlatformBinariesPath);

PublicAdditionalLibraries.Add(Path.Combine(PlatformBinariesPath, "libsentry.so"));

PublicDefinitions.Add("USE_SENTRY_NATIVE=1");
PublicDefinitions.Add("SENTRY_BUILD_STATIC=1");
}

// Additional routine for Mac
Expand Down
17 changes: 9 additions & 8 deletions scripts/build-linux.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/bin/bash
set -euo pipefail

export sentryNativeRoot=$1
export sentryArtifactsDestination=$2

rm -rf "${sentryArtifactsDestination}/"*

cmake -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=crashpad -D SENTRY_TRANSPORT=none -D SENTRY_SDK_NAME=sentry.native.unreal -D SENTRY_BUILD_SHARED_LIBS=OFF \
-D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER="clang++" -D CMAKE_CXX_FLAGS="-stdlib=libc++" -D CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++"
cmake -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=crashpad -D SENTRY_TRANSPORT=none -D SENTRY_SDK_NAME=sentry.native.unreal -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build "${sentryNativeRoot}/build" --target sentry --parallel
cmake --install "${sentryNativeRoot}/build" --prefix "${sentryNativeRoot}/install"

mkdir "${sentryArtifactsDestination}/bin"
mkdir "${sentryArtifactsDestination}/include"
mkdir "${sentryArtifactsDestination}/lib"

cp -r "${sentryNativeRoot}/install/lib/"*.a "${sentryArtifactsDestination}/lib"
strip -x "${sentryNativeRoot}/install/bin/crashpad_handler" -o "${sentryArtifactsDestination}/bin/crashpad_handler"
cp "${sentryNativeRoot}/install/include/sentry.h" "${sentryArtifactsDestination}/include/sentry.h"
strip -s "${sentryNativeRoot}/build/libsentry.so" -w -K sentry_[^_]* -o "${sentryArtifactsDestination}/bin/libsentry.so"
cp "${sentryNativeRoot}/build/libsentry.so" "${sentryArtifactsDestination}/bin/libsentry.dbg.so"
strip -x "${sentryNativeRoot}/build/crashpad_build/handler/crashpad_handler" -o "${sentryArtifactsDestination}/bin/crashpad_handler"
cp "${sentryNativeRoot}/include/sentry.h" "${sentryArtifactsDestination}/include/sentry.h"

pushd ${sentryArtifactsDestination}/bin
objcopy --add-gnu-debuglink="libsentry.dbg.so" "libsentry.so"
popd
12 changes: 2 additions & 10 deletions scripts/packaging/package-github.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,8 @@ Source/ThirdParty/Linux/bin/
Source/ThirdParty/Linux/bin/crashpad_handler
Source/ThirdParty/Linux/include/
Source/ThirdParty/Linux/include/sentry.h
Source/ThirdParty/Linux/lib/
Source/ThirdParty/Linux/lib/libcrashpad_client.a
Source/ThirdParty/Linux/lib/libcrashpad_compat.a
Source/ThirdParty/Linux/lib/libcrashpad_handler_lib.a
Source/ThirdParty/Linux/lib/libcrashpad_minidump.a
Source/ThirdParty/Linux/lib/libcrashpad_snapshot.a
Source/ThirdParty/Linux/lib/libcrashpad_tools.a
Source/ThirdParty/Linux/lib/libcrashpad_util.a
Source/ThirdParty/Linux/lib/libmini_chromium.a
Source/ThirdParty/Linux/lib/libsentry.a
Source/ThirdParty/Linux/bin/libsentry.dbg.so
Source/ThirdParty/Linux/bin/libsentry.so
Source/ThirdParty/Mac/
Source/ThirdParty/Mac/bin/
Source/ThirdParty/Mac/bin/sentry.dylib
Expand Down
12 changes: 2 additions & 10 deletions scripts/packaging/package-marketplace.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,8 @@ Source/ThirdParty/Linux/bin/
Source/ThirdParty/Linux/bin/crashpad_handler
Source/ThirdParty/Linux/include/
Source/ThirdParty/Linux/include/sentry.h
Source/ThirdParty/Linux/lib/
Source/ThirdParty/Linux/lib/libcrashpad_client.a
Source/ThirdParty/Linux/lib/libcrashpad_compat.a
Source/ThirdParty/Linux/lib/libcrashpad_handler_lib.a
Source/ThirdParty/Linux/lib/libcrashpad_minidump.a
Source/ThirdParty/Linux/lib/libcrashpad_snapshot.a
Source/ThirdParty/Linux/lib/libcrashpad_tools.a
Source/ThirdParty/Linux/lib/libcrashpad_util.a
Source/ThirdParty/Linux/lib/libmini_chromium.a
Source/ThirdParty/Linux/lib/libsentry.a
Source/ThirdParty/Linux/bin/libsentry.dbg.so
Source/ThirdParty/Linux/bin/libsentry.so
Source/ThirdParty/Mac/
Source/ThirdParty/Mac/bin/
Source/ThirdParty/Mac/bin/sentry.dylib
Expand Down

0 comments on commit 6710d9a

Please sign in to comment.