Skip to content

Project with spaces (or other characters) doesn't build with NativeAOT on Android #115165

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

Closed
jonathanpeppers opened this issue Apr 29, 2025 · 7 comments

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Apr 29, 2025

Description

I noticed this while setting up some MSBuild integration tests for Android+NativeAOT:

But then, I found a simpler repro. In a Linux GitHub Codespace:

  1. mkdir 'Test Me'
  2. cd Test\ Me/
  3. dotnet new console
  4. dotnet publish -p:PublishAot=true -bl

Errors with:

Restore complete (2.1s)
  Test Me failed with 2 error(s) (3.9s) → bin/Release/net9.0/linux-x64/Test Me.dll
    clang : error : no such file or directory: 'Me.exports'
    /home/codespace/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.4/build/Microsoft.NETCore.Native.targets(376,5): error MSB3073: The command ""clang" "obj/Release/net9.0/linux-x64/native/Test Me.o" -o "bin/Release/net9.0/linux-x64/native/Test Me" -Wl,--version-script=obj/Release/net9.0/linux-x64/native/Test Me.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libbootstrapper.o /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libRuntime.WorkstationGC.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libeventpipe-disabled.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libRuntime.VxsortEnabled.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libstandalonegc-disabled.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libstdc++compat.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/framework/libSystem.Native.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/framework/libSystem.Globalization.Native.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/framework/libSystem.IO.Compression.Native.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/framework/libSystem.Net.Security.Native.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/framework/libSystem.Security.Cryptography.Native.OpenSsl.a /home/codespace/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/9.0.4/sdk/libz.a -g -Wl,-rpath,'$ORIGIN' -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lrt -lm -pie -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" exited with code 1.

Build failed with 2 error(s) in 6.3s

This is pretty much exactly the same error we got targeting Android.

Reproduction Steps

See above.

Expected behavior

I can create console apps with spaces (or other odd characters) in the name, like Test Me.

Actual behavior

I get a build error with a project named Test Me.

Regression?

NativeAOT on Android is new, unsure if this worked previously on Linux.

Known Workarounds

Name your project Test_Me.

Configuration

$ dotnet --info
.NET SDK:
 Version:           9.0.203
 Commit:            dc7acfa194
 Workload version:  9.0.200-manifests.9df47798
 MSBuild version:   17.13.20+a4ef1e90f

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.203/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.4
  Architecture: x64
  Commit:       f57e6dc747

.NET SDKs installed:
  8.0.407 [/usr/share/dotnet/sdk]
  9.0.203 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other information

Binlog file: Test Me.zip

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 29, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@jkotas
Copy link
Member

jkotas commented Apr 29, 2025

Fixed by #112603

@jonathanpeppers
Copy link
Member Author

Ok, let me try a .NET 10 SDK.

@jonathanpeppers
Copy link
Member Author

Console apps work on .NET 10, using: https://ci.dot.net/public/Sdk/10.0.100-preview.5.25224.4/dotnet-sdk-10.0.100-preview.5.25224.4-linux-x64.tar.gz

Android apps still fail during the LinkNative target, though:

clang no such file or directory: 'Me.so' [C:\a\_work\1\a\TestRelease\04-28_22.51.25\temp\DotNetBuildandroid-arm64TrueFalseFalseNativeAOT\Test Me.csproj]
C:\Users\cloudtest\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-preview.5.25227.101\build\Microsoft.NETCore.Native.targets(391,5): error MSB3073: The command ""clang" "obj\Release\android-arm64\native\Test Me.o" -o "bin\Release\android-arm64\native\Test Me.so" -Wl,--version-script="obj\Release\android-arm64\native\Test Me.exports" -Wl,--export-dynamic -gz=zlib -fuse-ld=lld C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Globalization.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.IO.Compression.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Security.Cryptography.Native.OpenSsl.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbootstrapperdll.o C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libRuntime.WorkstationGC.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libeventpipe-disabled.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libstandalonegc-disabled.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libaotminipal.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libstdc++compat.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlienc.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlidec.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlicommon.a --target=aarch64-linux-android21 -g -Wl,-rpath,"$ORIGIN" -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e,0x0 -pthread -ldl -lz -llog -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,-z,max-page-size=16384 -Wl,-soname,libTest Me.so -Wl,--discard-all -Wl,--gc-sections -Wl,-T,"obj\Release\android-arm64\native\sections.ld"" exited with code 1. [C:\a\_work\1\a\TestRelease\04-28_22.51.25\temp\DotNetBuildandroid-arm64TrueFalseFalseNativeAOT\Test Me.csproj]

Binlog: android-spaces.zip

So, it might be something about using the Android NDK?

@jonathanpeppers jonathanpeppers changed the title Project with spaces (or other characters) doesn't build with NativeAOT Project with spaces (or other characters) doesn't build with NativeAOT on Android Apr 29, 2025
@jkotas
Copy link
Member

jkotas commented Apr 29, 2025

-Wl,-soname,libTest Me.so needs to be quoted here?

@jonathanpeppers
Copy link
Member Author

Trying it out, here: dotnet/android@33b4e1b

Will close if it works, thanks.

@jonathanpeppers
Copy link
Member Author

Projects with spaces & other characters are working now.

@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants