Skip to content
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

XA3007: Could not link native shared library: libxamarin-app.so #8352

Closed
rubberydev opened this issue Sep 19, 2023 · 17 comments
Closed

XA3007: Could not link native shared library: libxamarin-app.so #8352

rubberydev opened this issue Sep 19, 2023 · 17 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@rubberydev
Copy link

rubberydev commented Sep 19, 2023

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.)

Affected platform version

VS 2022 17.7.4

Description

the project Xamarin.Android was built in Visual Studio 2019 but I want to run and build it in Visual Studio 2022 to upgrade it to API Level 33(Android 13) but this problem doesn´t permit me continue, help me please!

Error_build_project

Thanks in advance!

Steps to Reproduce

  1. Open the project
  2. Change the Target Framework
  3. Run.

Did you find any workaround?

No response

Relevant log output

No response

@rubberydev rubberydev added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Sep 19, 2023
@jonathanpeppers
Copy link
Member

Can you attach an MSBuild binary log of the error? Thanks!

@jonathanpeppers jonathanpeppers added need-info Issues that need more information from the author. and removed needs-triage Issues that need to be assigned. labels Sep 19, 2023
@microsoft-github-policy-service
Copy link
Contributor

Hi @rubberydev. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@jonathanpeppers jonathanpeppers added this to the Under Consideration milestone Sep 19, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention A xamarin-android contributor needs to review and removed need-info Issues that need more information from the author. labels Sep 20, 2023
@rubberydev
Copy link
Author

Can you attach an MSBuild binary log of the error? Thanks!

Hi @jonathanpeppers , I attach the MSBuildLog

Thanks in advance!
MSBuildLog_DebugMode.txt

@jonathanpeppers
Copy link
Member

@rubberydev this is a text-based build log with Normal (maybe actually Minimal?) verbosity. If you want to send a text-based one, can you use Diagnostic verbosity?

https://docs.microsoft.com/xamarin/android/troubleshooting/troubleshooting#diagnostic-msbuild-output

@rubberydev
Copy link
Author

Hi @jonathanpeppers thank you for your response! excuse me I didn´t know that, thanks again for guide me...
I attach the MSBuild with verbosity in mode Diagnostic:
MSBuild.zip

@rubberydev
Copy link
Author

Input file "obj\Debug\130\android\typemaps.armeabi-v7a.o" is newer than output file "obj\Debug\130\app_shared_libraries\arm64-v8a\libxamarin-app.so".
I think so this is the problem, I looked something similar in forums about MAUI with architecture arm64-v8a

dotnet/maui#14531

I´m not sure it is related?

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Sep 21, 2023

@grendello @dellis1972 do you know if there is a way to get more info out of:

[Native Linker] c:\program files\microsoft visual studio\2022\community\MSBuild\Xamarin\Android\binutils\bin\ld.EXE --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -X -m armelf_linux_eabi obj\Debug\130\android\typemaps.armeabi-v7a.o obj\Debug\130\android\environment.armeabi-v7a.o obj\Debug\130\android\compressed_assemblies.armeabi-v7a.o obj\Debug\130\android\marshal_methods.armeabi-v7a.o obj\Debug\130\android\jni_remap.armeabi-v7a.o -o obj\Debug\130\app_shared_libraries\armeabi-v7a\libxamarin-app.so
[Native Linker] c:\program files\microsoft visual studio\2022\community\MSBuild\Xamarin\Android\binutils\bin\ld.EXE --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -m elf_x86_64 obj\Debug\130\android\typemaps.x86_64.o obj\Debug\130\android\environment.x86_64.o obj\Debug\130\android\compressed_assemblies.x86_64.o obj\Debug\130\android\marshal_methods.x86_64.o obj\Debug\130\android\jni_remap.x86_64.o -o obj\Debug\130\app_shared_libraries\x86_64\libxamarin-app.so
[Native Linker] c:\program files\microsoft visual studio\2022\community\MSBuild\Xamarin\Android\binutils\bin\ld.EXE --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings --fix-cortex-a53-843419 -m aarch64linux obj\Debug\130\android\typemaps.arm64-v8a.o obj\Debug\130\android\environment.arm64-v8a.o obj\Debug\130\android\compressed_assemblies.arm64-v8a.o obj\Debug\130\android\marshal_methods.arm64-v8a.o obj\Debug\130\android\jni_remap.arm64-v8a.o -o obj\Debug\130\app_shared_libraries\arm64-v8a\libxamarin-app.so
[Native Linker] c:\program files\microsoft visual studio\2022\community\MSBuild\Xamarin\Android\binutils\bin\ld.EXE --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -m elf_i386 obj\Debug\130\android\typemaps.x86.o obj\Debug\130\android\environment.x86.o obj\Debug\130\android\compressed_assemblies.x86.o obj\Debug\130\android\marshal_methods.x86.o obj\Debug\130\android\jni_remap.x86.o -o obj\Debug\130\app_shared_libraries\x86\libxamarin-app.so
XA3007: Could not link native shared library: libxamarin-app.so

(It looks like a .NET 7 app)

@grendello
Copy link
Contributor

@jonathanpeppers depends on which NET7 it is. We've had this improvement since November last year. Prior to that, the stderr output should be in the verbose log/binlog. Failing that, one can cut-and-paste the command to developer prompt and see what it says.

@rubberydev
Copy link
Author

Hi guys, thanks a lot for helping me, I really don´t know how to find the log in log/binlog, however I could launch the command dotnet build XxxxXxxx.Droid.csproj in my command prompt and I got the next output:

thanks!

Output_from_prompt.txt

@jonathanpeppers
Copy link
Member

For dotnet build if you just add an additional -bl argument, it will create an msbuild.binlog file in the current directory.

@rubberydev
Copy link
Author

rubberydev commented Sep 25, 2023

it´s really clear @jonathanpeppers thanks again man! I´m gonna share you the binlog generated:

BinLog.zip

I´m pending for you advices to solve this problem,

thanks in advance!

@jonathanpeppers
Copy link
Member

The latest one has a completely different error:

EnelPeru.Droid.csproj(4934,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.401\Xamarin\Android\Xamarin.Android.CSharp.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\7.0.401\\Xamarin\Android\Xamarin.Android.CSharp.targets" is correct, and that the file exists on disk.

Is this a Xamarin.Android project? For that, you would have to use msbuild instead of dotnet build.

My MSBuild is at "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" for example.

@rubberydev
Copy link
Author

rubberydev commented Sep 25, 2023

The latest one has a completely different error:

EnelPeru.Droid.csproj(4934,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.401\Xamarin\Android\Xamarin.Android.CSharp.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\7.0.401\\Xamarin\Android\Xamarin.Android.CSharp.targets" is correct, and that the file exists on disk.

Is this a Xamarin.Android project? For that, you would have to use msbuild instead of dotnet build.

My MSBuild is at "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" for example.

@jonathanpeppers with MSBuild.exe got 0 errors:
image
but,I ran in VS I got the same issue, however I attach the detailed output log of build:
MSBuildLogDetail.txt

thanks !

@jonathanpeppers
Copy link
Member

How can we get a log that contains the error:

XA3007: Could not link native shared library: libxamarin-app.so

@rubberydev
Copy link
Author

How can we get a log that contains the error:

XA3007: Could not link native shared library: libxamarin-app.so

I really dont know because the error disappering when I built project with MSBuild tool, so! my question rigth now is, if I could build the project with MSBuild tool and upgraded to API level 33 without any output error in the process, also Could I sign the .apk from similar CLI tools or something like this existent;In order to follow releasing versions to my app.

@jonathanpeppers
Copy link
Member

Ok, if this is Xamarin.Android, you probably also need -t:SignAndroidPackage to do a "full" build that creates an .apk file.

@jpobst jpobst removed the need-attention A xamarin-android contributor needs to review label Mar 20, 2024
@jpobst
Copy link
Contributor

jpobst commented May 17, 2024

With support for Classic Xamarin.Android ended May 1st, 2024, this issue is likely no longer relevant.

If this still persists in .NET 8+, please open a new issue with updated information based on net8.0-android or greater. Please include a link to this issue for context.

@jpobst jpobst closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

No branches or pull requests

5 participants