Skip to content

Build sentry from source #706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 84 commits into from
Feb 6, 2025
Merged

Build sentry from source #706

merged 84 commits into from
Feb 6, 2025

Conversation

PlasmaDev5
Copy link
Contributor

WIP changes to build sentry-native from source.

Currently i have only tested/developed on windows and will not yet fully compile due to not linking libraries.
The changes here are based on UE4CMake with modification and cleanup to better function for the needs of sentry.
going forward further modification will be needed to add platform support for all our needs.
In addition we will need to load custom toolchains for some platforms.

TODO:

  • Link generated libraries
  • Android
  • IOS
  • Linux
  • Mac
  • Other Platforms

PlasmaDev5 added 2 commits December 6, 2024 22:20
only windows tested currently
Copy link
Contributor

github-actions bot commented Dec 6, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 1314039

@PlasmaDev5
Copy link
Contributor Author

@tustanivsky Any insights on the build issues. from what i can tell something is referencing modules/sentry-native but i did checked everything and did a string search and nothing comes up. It should all have been moved to plugin-dev/sentry-native

@PlasmaDev5
Copy link
Contributor Author

Only thing left before final review is add the ability to build for both crashpad and breakpad independently

@PlasmaDev5 PlasmaDev5 marked this pull request as ready for review December 19, 2024 15:22
@PlasmaDev5
Copy link
Contributor Author

I have marked this as ready to review as all contents are ready. The is 1 thing missing related to building backtrace from CI and this looks to be a larger discussion

@bruno-garcia
Copy link
Member

image
@PlasmaDev5 quite a few CI steps are broken though

@PlasmaDev5
Copy link
Contributor Author

Ah yeah when I looked at it before it looked to be a permissions issue but looks to be doesn't with that last build. I'll take a look

sentry-native/.codecov.yml
sentry-native/.craft.yml
sentry-native/.editorconfig
sentry-native/.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a @tustanivsky question:

Should we be adding .git to the packages? This will include all commit history etc.
Similarly about .github, looks like we're adding the whole git submodule as-is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this require a change in sentry-native to work?
If so, lets get that added to main through a PR on sentry-native first. Then we bump main here and pull that into this branch.

This way we don't need to change sentry-native in this PR and having it pass CI checks that the change is compatible with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no changes to native. The current issues to CI imply im missing something with building Linux.

public class Sentry : ModuleRules
{
[CommandLine("-usebreakpad")]
public bool bUseBreakpad = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I say false, what am I using then?
And would that be true regardless of platform? (On Xbox today we only support breakpad so that's odd)

Seems like config will be more complicated than a bool as it'll depend on what platform you're targeting, and what's supported there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably rename this. Its an override more then anything. Native already select the backend needed for selected platforms but this allows the build system to override to build to use breakpad on windows. its needed for shipping releases as we only ship breakpad for the marketplace version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah then it needs a better name, and docs on it (XML docs over C# members)

{
string generatorName="";

switch(compiler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we cover all these branches in CI?

I don't think we're building on Windows yet, so we need to add that, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not currently build windows. i did talk to Ivan about this briefly when gathering information. Last info i got on the topic was during a weekly meeting it was mentioned he was pointed at some stuff that may help get it working.

As for the generators we currently dont build all the unreal generators even on linux. Im not even sure we try all cmake generators on the native side. But the general goal here is to map the unreal compiler to its best fit in the cmake space.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be better off adding all of the CI infrastructure first, before we continue with this change.
That way we can be confident we started off with something that works, and the changes continue to do so

}
public class CMakeTargetInst
{
// Based on UE4CMake with modifications
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a link to where this came from that you can copy and paste here?

Instead of linking to the file through a branch, use the commit sha (on GitHub, if you press y it changes the path from branch to sha automatically.

.gitmodules Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did it need to move to plugin-dev? It was located on modules before and it's unclear why it had to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SDK plugin now needs to know the path to native in order to build. I did originally try do this via symlink but with the SDK itself being used as a symlink it caused errors and pointed to the wrong direction. The safest and least error prone option for users was to simple move native into the SDK folder so that wherever you build SDK it can easily locate native without manual user steps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that one side effect is that we have the whole repo there (sentry-native) and a bunch of unrelated stuff shows up in the final package. I left notes on those snapshot files.

Also, why is it named plugin-dev then? is it relates to dev vs prod time?
Could sentry-native be a better name if that's what it is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's based on Unity: https://github.com/getsentry/sentry-unity/tree/cb71faad6304e437b7e6d063f198d99c4aa57069/package-dev

We named it like that because we have the package used in development and the one used for packaging and release.

Doesn't seem to be the same situation here

PlasmaDev5 and others added 2 commits December 24, 2024 03:28
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@PlasmaDev5
Copy link
Contributor Author

As discussed i have reverted linux to make this initial version window and xbox only.

@PlasmaDev5
Copy link
Contributor Author

The 5.0 branch is currently failing due to a bug in unreal https://issues.unrealengine.com/issue/UE-143579
I am currently looking into work arounds

Copy link
Collaborator

@tustanivsky tustanivsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After updating the process of building the Native SDK in Unreal (#771) we're good to proceed with the merge. Build scripts like Sentry.Build.cs and SentryNative.Build.cs could benefit from some cleanup but we can tackle that in a separate ticket. Also, we'll need to document how to build the Native SDK from within the Unreal plugin.

@PlasmaDev5 PlasmaDev5 merged commit bf135fa into main Feb 6, 2025
20 checks passed
@PlasmaDev5 PlasmaDev5 deleted the feat/build-native branch February 6, 2025 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants