[GH-ISSUE #158] Undefined Symbol error when using self-compiled libQmlNet.so #98

Closed
opened 2026-05-05 11:04:30 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @hnrhn on GitHub (Aug 14, 2019).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/158

I have been attempting to compile my own libQmlNet.so so that I can include QT += widgets in the QmlNet.pro file (trying to solve the same problem as https://github.com/qmlnet/qmlnet/issues/149).

However, when trying to run a program using my .so file instead of the one downloaded from NuGet, I get the following error:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Qml.Net.Internal.Interop' threw an exception. ---> System.Exception: Symbol could not be loaded: /home/peter/.nuget/packages/qml.net.linuxbinaries/0.10.1/runtimes/linux-x64/native/libQmlNet.so: undefined symbol: type_info_setPrefVariantType. Symbol name: type_info_setPrefVariantType
   at NetNativeLibLoader.Loader.UnixPlatformLoader.LoadSymbol(IntPtr library, String symbolName)
   at Qml.Net.Internal.Interop.LoadDelegates(Object o, IntPtr library, IPlatformLoader loader)
   at Qml.Net.Internal.Interop.LoadInteropType[T](IntPtr library, IPlatformLoader loader)
   at Qml.Net.Internal.Interop..cctor()
   --- End of inner exception stack trace ---
   at Qml.Net.QQuickStyle.SetStyle(String style)
   at ExcelEquality.Program.Main(String[] args) in /home/peter/Dev/ExcelEquality/ExcelEquality/Program.cs:line 13
Aborted (core dumped)

The .so file that comes from NuGet is 2.0MiB, but the one generated by running build.sh myself comes out at 2.3MiB -- regardless of whether I include the QT += widgets line or not, so I assume this is coming in the qmake step, or Qt itself.

I'm using a fresh install of Qt5.12.4 (installed directly using Qt's web installer, not a package manager), running on Manjaro. Am I doing something wrong, or is there some other setup step I'm missing?

Originally created by @hnrhn on GitHub (Aug 14, 2019). Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/158 I have been attempting to compile my own _libQmlNet.so_ so that I can include `QT += widgets` in the _QmlNet.pro_ file (trying to solve the same problem as https://github.com/qmlnet/qmlnet/issues/149). However, when trying to run a program using my .so file instead of the one downloaded from NuGet, I get the following error: ``` Unhandled Exception: System.TypeInitializationException: The type initializer for 'Qml.Net.Internal.Interop' threw an exception. ---> System.Exception: Symbol could not be loaded: /home/peter/.nuget/packages/qml.net.linuxbinaries/0.10.1/runtimes/linux-x64/native/libQmlNet.so: undefined symbol: type_info_setPrefVariantType. Symbol name: type_info_setPrefVariantType at NetNativeLibLoader.Loader.UnixPlatformLoader.LoadSymbol(IntPtr library, String symbolName) at Qml.Net.Internal.Interop.LoadDelegates(Object o, IntPtr library, IPlatformLoader loader) at Qml.Net.Internal.Interop.LoadInteropType[T](IntPtr library, IPlatformLoader loader) at Qml.Net.Internal.Interop..cctor() --- End of inner exception stack trace --- at Qml.Net.QQuickStyle.SetStyle(String style) at ExcelEquality.Program.Main(String[] args) in /home/peter/Dev/ExcelEquality/ExcelEquality/Program.cs:line 13 Aborted (core dumped) ``` The .so file that comes from NuGet is 2.0MiB, but the one generated by running [build.sh](https://github.com/qmlnet/qmlnet/blob/develop/src/native/build.sh) myself comes out at 2.3MiB -- regardless of whether I include the `QT += widgets` line or not, so I assume this is coming in the qmake step, or Qt itself. I'm using a fresh install of Qt5.12.4 (installed directly using Qt's web installer, not a package manager), running on Manjaro. Am I doing something wrong, or is there some other setup step I'm missing?
Author
Owner

@pauldotknopf commented on GitHub (Aug 15, 2019):

What is your output of nm -D libQmlNet.so?

<!-- gh-comment-id:521487739 --> @pauldotknopf commented on GitHub (Aug 15, 2019): What is your output of ```nm -D libQmlNet.so```?
Author
Owner

@hnrhn commented on GitHub (Aug 15, 2019):

nmOutput.txt
I ran a diff against the same output for the .so from NuGet and the symbol values are different for practically everything (though I don't know enough about this topic to know whether that matters), a few chunks of extra lines in my version, and a few extra lines in the NuGet version.

<!-- gh-comment-id:521616296 --> @hnrhn commented on GitHub (Aug 15, 2019): [nmOutput.txt](https://github.com/qmlnet/qmlnet/files/3505259/nmOutput.txt) I ran a diff against the same output for the .so from NuGet and the symbol values are different for practically everything (though I don't know enough about this topic to know whether that matters), a few chunks of extra lines in my version, and a few extra lines in the NuGet version.
Author
Owner

@pauldotknopf commented on GitHub (Aug 15, 2019):

I see the issue.

You are compiling the latest native libs, using older .NET lib (probably from NuGet).

You have to make sure the native libs and .NET dll matches.

The type_info_setPrefVariantType exported method has been removed, but your .NET libs are trying to use it.

<!-- gh-comment-id:521625734 --> @pauldotknopf commented on GitHub (Aug 15, 2019): I see the issue. You are compiling the latest native libs, using older .NET lib (probably from NuGet). You have to make sure the native libs and .NET dll matches. The ```type_info_setPrefVariantType``` exported method has been removed, but your .NET libs are trying to use it.
Author
Owner

@hnrhn commented on GitHub (Aug 15, 2019):

Yep, that'll do it alright. I thought I'd covered all my bases, but I guess I didn't spot that "develop" is the default branch.
Thanks for the help!

<!-- gh-comment-id:521739508 --> @hnrhn commented on GitHub (Aug 15, 2019): Yep, that'll do it alright. I thought I'd covered all my bases, but I guess I didn't spot that "develop" is the default branch. Thanks for the help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#98
No description provided.