Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ jobs:
if: ${{ matrix.machine == 'ubuntu-22.04' }}
run: |
rm ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
rm ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so.debug
cp ./bin/ci-artifacts/bin-ubuntu1604-native/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
cp ./bin/ci-artifacts/bin-ubuntu1604-native/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so.debug ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so.debug

- name: Install MacOS CoreUtils
if: ${{ runner.os == 'macOS' }}
Expand Down
13 changes: 9 additions & 4 deletions build/Build.Steps.Linux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ partial class Build
.After(CompileNativeSrc, PublishManagedProfiler)
.Executes(() =>
{
// Copy Native file
var source = NativeProfilerProject.Directory / "build" / "bin" / $"{NativeProfilerProject.Name}.so";
// Copy Native files
var source = NativeProfilerProject.Directory / "build" / "bin";
var sourceLib = source / $"{NativeProfilerProject.Name}.so";
var sourceDebug = source / $"{NativeProfilerProject.Name}.so.debug";
var platform = Platform.ToString().ToLowerInvariant();
string clrProfilerDirectoryName = Environment.GetEnvironmentVariable("OS_TYPE") switch
{
Expand All @@ -65,9 +67,12 @@ partial class Build
};

var dest = TracerHomeDirectory / clrProfilerDirectoryName;
Log.Information($"Copying '{source}' to '{dest}'");

source.CopyToDirectory(dest, ExistsPolicy.FileOverwrite);
Log.Information($"Copying '{sourceLib}' to '{dest}'");
sourceLib.CopyToDirectory(dest, ExistsPolicy.FileOverwrite);

Log.Information($"Copying '{sourceDebug}' to '{dest}'");
sourceDebug.CopyToDirectory(dest, ExistsPolicy.FileOverwrite);
});

Target RunNativeTestsLinux => _ => _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
</metadata>

<files>
<file src="**\*" target="\" />
<file src="**\*.dll" target="\" />
<file src="**\*.dylib" target="\" />
<file src="**\*.pdb" target="\" />
Copy link
Member Author

@martincostello martincostello Jan 16, 2026

Choose a reason for hiding this comment

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

Preserves addition of .pdb files from #4774, as they're only ~16-19 MB each compared to ~35-50MB each for .so.debug files.

<file src="**\*.so" target="\" />
<file src="..\..\opentelemetry-icon-color.png" target="images\opentelemetry-icon-color.png" />
<file src="..\..\src\OpenTelemetry.AutoInstrumentation.Native\README.md" target="docs\README.md" />
</files>
Expand Down
16 changes: 16 additions & 0 deletions src/OpenTelemetry.AutoInstrumentation.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ elseif (ISARM)
add_compile_options(-DARM)
endif()

# Produce symbol files
if (ISLINUX)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g")
endif()

add_compile_definitions(OTEL_AUTO_VERSION_MAJOR=${OTEL_AUTO_VERSION_MAJOR})
add_compile_definitions(OTEL_AUTO_VERSION_MINOR=${OTEL_AUTO_VERSION_MINOR})
add_compile_definitions(OTEL_AUTO_VERSION_PATCH=${OTEL_AUTO_VERSION_PATCH})
Expand Down Expand Up @@ -217,6 +223,16 @@ else()
)
endif()

# Strip symbols from the binaries into a separate file
if (ISLINUX)
add_custom_command(TARGET "OpenTelemetry.AutoInstrumentation.Native" POST_BUILD
COMMAND ${CMAKE_OBJCOPY}
--only-keep-debug $<TARGET_FILE:OpenTelemetry.AutoInstrumentation.Native> $<TARGET_FILE:OpenTelemetry.AutoInstrumentation.Native>.debug
COMMAND ${CMAKE_STRIP} --strip-debug $<TARGET_FILE:OpenTelemetry.AutoInstrumentation.Native>
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:OpenTelemetry.AutoInstrumentation.Native>.debug $<TARGET_FILE:OpenTelemetry.AutoInstrumentation.Native>
)
endif()

set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")

# Define linker libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/LICENSE,
/instrument.sh,
/linux-musl-arm64/OpenTelemetry.AutoInstrumentation.Native.so,
/linux-musl-arm64/OpenTelemetry.AutoInstrumentation.Native.so.debug,
/net/OpenTelemetry.Api.ProviderBuilderExtensions.dll,
/net/OpenTelemetry.Api.dll,
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.dll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/LICENSE,
/instrument.sh,
/linux-musl-x64/OpenTelemetry.AutoInstrumentation.Native.so,
/linux-musl-x64/OpenTelemetry.AutoInstrumentation.Native.so.debug,
/net/OpenTelemetry.Api.ProviderBuilderExtensions.dll,
/net/OpenTelemetry.Api.dll,
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.dll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/LICENSE,
/instrument.sh,
/linux-arm64/OpenTelemetry.AutoInstrumentation.Native.so,
/linux-arm64/OpenTelemetry.AutoInstrumentation.Native.so.debug,
/net/OpenTelemetry.Api.ProviderBuilderExtensions.dll,
/net/OpenTelemetry.Api.dll,
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.dll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/LICENSE,
/instrument.sh,
/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so,
/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so.debug,
/net/OpenTelemetry.Api.ProviderBuilderExtensions.dll,
/net/OpenTelemetry.Api.dll,
/net/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.dll,
Expand Down
Loading