ddobrev / QtSharp

Mono/.NET bindings for Qt
Other
574 stars 51 forks source link

Building on Linux #45

Open define-private-public opened 8 years ago

define-private-public commented 8 years ago

I've been trying to get QtSharp working for a bit now and I still keep on having issues with getting it working on Linux.

I got to the point where I had to tell the QtSharp.CLI.exe app where my qmake and make utilities are stored. I supplied the application with the full path, but when trying to do that, I got this error:

Calling /home/me/Qt/5.5/clang_64/bin/qmake caused an exception: ApplicationName='/home/ben/Qt/5.5/clang_64/bin/qmake', CommandLine='-query QT_INSTALL_BINS', CurrentDirectory='', Native error= Cannot find the specified file.
ddobrev commented 8 years ago

Could you please run the same command in the terminal to see if it works properly?

define-private-public commented 8 years ago

It was run in the terminal.

ddobrev commented 8 years ago

I assume you build CppSharp yourself because the binaries in the repo are (for now) Windows-only. In turn, this means you built QtSharp too. With this in mind, please debug the call. It's performed by a method called ProcessHelper.Run at https://github.com/ddobrev/QtSharp/blob/master/QtSharp.CLI/Program.cs#L110 . When you debug it, you'll be able to see if the qmake executable you pass exists, as well as check for any other irregularities.

define-private-public commented 8 years ago

I did some poking, so the path /home/me/Qt/5.5/clang_64/bin/qmake doesn't exist, instead /home/me/Qt/5.5/gcc_64/bin/qmake does.

When I ran via the terminal again, I got this error:

Unhandled Exception:
System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
  at <Module>.___CxxCallUnwindDtor (System.MonoFNPtrFakeClass pDtor, System.Void* pThis) <0x40d1e250 + 0x00037> in <filename unknown>:0 
  at <Module>..cctor () <0x40d1df50 + 0x0004b> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at QtSharp.CLI.Program.GetDependencies (QtSharp.CLI.QtVersion qt) <0x40d1d930 + 0x0009f> in <filename unknown>:0 
  at QtSharp.CLI.Program.Main (System.String[] args) <0x41f41fd0 + 0x001d3> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
  at <Module>.___CxxCallUnwindDtor (System.MonoFNPtrFakeClass pDtor, System.Void* pThis) <0x40d1e250 + 0x00037> in <filename unknown>:0 
  at <Module>..cctor () <0x40d1df50 + 0x0004b> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at QtSharp.CLI.Program.GetDependencies (QtSharp.CLI.QtVersion qt) <0x40d1d930 + 0x0009f> in <filename unknown>:0 
  at QtSharp.CLI.Program.Main (System.String[] args) <0x41f41fd0 + 0x001d3> in <filename unknown>:0 

I also tried to run in the debugger, It kept on running until it hit this line: https://github.com/ddobrev/QtSharp/blob/master/QtSharp.CLI/Program.cs#L202

Where Monodevelop told me that it lost connection with the debugger.

ddobrev commented 8 years ago

I think you didn't update the binary references. They are only for Windows. For Linux you need to build https://github.com/mono/CppSharp yourself because while we have Linux CI for it at https://travis-ci.org/mono/CppSharp/jobs/123573796, we do not upload binaries yet. Once you have, you need to replace the references to CppSharp with your build and this error is going to disappear.

define-private-public commented 8 years ago

I'm sorry for not being more attentive with this. I'm finishing up school right now, I should be able to revisit this in less than a month.

Also, if I were to port some of the Qt examples to C#, would you be willing to merge them into this repo?

ddobrev commented 8 years ago

I won't be willing but happy to. :) Please just have in mind that API-s which require support for templates, such as QObjectList QObject::children(), are not available yet. I've been working on it and I hope I'll have it done in a month.

define-private-public commented 8 years ago

I've tried to take the release .dlls and include them in a MonoDevelop project on Ubuntu Linux. I was able to build the following small program, when when constructing the QColor, it throws a System.DllNotFoundException.

using System;
using QtGui;
using QtCore;
using QtWidgets;

namespace First
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            QColor clr = new QColor("red");
            Console.WriteLine(clr.Red);
            Console.WriteLine(clr.Green);
            Console.WriteLine(clr.Blue);
        }
    }
}

Here are the details of the error:

Unhandled Exception:
System.DllNotFoundException: Qt5Core
  at (wrapper managed-to-native) QtCore.QString+__Internal:FromUtf16_0 (intptr,uint16*,int)
  at QtCore.QString.FromUtf16 (System.UInt16& unicode, System.Int32 size) [0x00015] in <036aaf2feb0a47fba24c3cd1d557c6a8>:0 
  at QtGui.QColor..ctor (System.String name) [0x00053] in <3304e7a86acf4bebbe03fee2a9776156>:0 
  at First.MainClass.Main (System.String[] args) [0x0000b] in <8c0c07057a4f469a91e489d47e7acc37>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: Qt5Core
  at (wrapper managed-to-native) QtCore.QString+__Internal:FromUtf16_0 (intptr,uint16*,int)
  at QtCore.QString.FromUtf16 (System.UInt16& unicode, System.Int32 size) [0x00015] in <036aaf2feb0a47fba24c3cd1d557c6a8>:0 
  at QtGui.QColor..ctor (System.String name) [0x00053] in <3304e7a86acf4bebbe03fee2a9776156>:0 
  at First.MainClass.Main (System.String[] args) [0x0000b] in <8c0c07057a4f469a91e489d47e7acc37>:0 
tritao commented 8 years ago

I think you will need to compile your own version of Qt# for Linux, the releases are specific to Windows.

I got it to compile on OSX a few months ago, so making it work on Linux shouldn't be too much work.

@define-private-public What step are you stuck on when compiling Qt# from source code?

define-private-public commented 8 years ago

I was hoping that the .dll would world on a whim. Guess not. : P

Looking at the Qt Sharp build documentation, that's where I'm getting confused. If you would be able to document what you did step by step to get QtSharp built on OS X, that would be the best thing you could do for me.

tritao commented 8 years ago

Well, the way I did it was by using Premake. You can find the build scripts on the build folder.

First you need to compile CppSharp from scratch, by following the guide on the repository: https://github.com/mono/CppSharp/blob/master/docs/GettingStarted.md#building-from-source

After you have that built, you can call CppSharp's premake5-linux-64 binary to generate QtSharp project make files for Linux.

You can also generate project files for Xamarin Studio, by invoking with the VS action, something like: premake5-linux-64 --file=/path/to/QtSharp/build/premake5.lua --os=macosx vs2015.

Give it a try and I will try to help if you get stuck on any step.

Once you get QtSharp generator compiled, then we look into generate the Linux bindings from the Qt source files.

define-private-public commented 8 years ago

I'm at the last part of this document: https://github.com/mono/CppSharp/blob/master/docs/GettingStarted.md#compiling-on-linux

Where I run make -C gmake config=release_x64. I'm getting this error:

me@hostmachine:build$ make -C gmake config=release_x64
make: Entering directory '/home/me/Desktop/qt_sharp/CppSharp/build/gmake'
==== Building CppSharp (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.AST (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.CppParser (release_x64) ====
==== Building CppSharp.Runtime (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.Parser.CSharp (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.Parser (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.Generator (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.Parser.Gen (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CppSharp.Generator.Tests (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CSharp.Native (release_x64) ====
==== Building CSharp.Gen (release_x64) ====
make[1]: Nothing to be done for 'all'.
==== Building CSharp.CSharp (release_x64) ====
Running prebuild commands
mono --debug "../lib/Release_x64/CSharp.Gen.exe"
Stacktrace:

  at <unknown> <0xffffffff>
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary) [0x00027] in /home/ben/Desktop/qt_sharp/CppSharp/src/Generator/Driver.cs:476
  at CppSharp.Tests.CSharpTestsGenerator.Main (string[]) [0x00007] in /home/ben/Desktop/qt_sharp/CppSharp/tests/CSharp/CSharp.cs:185
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00051, 0x000c8>

Native stacktrace:

    mono() [0x4accca]
    mono() [0x5040fe]
    mono() [0x4275d7]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0) [0x7ffaa05e43d0]
    mono() [0x657efc]
    mono() [0x657f91]
    mono() [0x4b124b]
    mono() [0x4254cb]
    mono() [0x50d831]
    mono() [0x50f96e]
    mono() [0x510253]
    mono() [0x425efc]
    mono() [0x4af809]
    mono() [0x4b0117]
    [0x41c6368c]

Debug info from gdb:

[New LWP 4129]
[New LWP 4130]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007ffaa05e3fbb in __waitpid (pid=4131, stat_loc=0x7ffaa111811c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29  ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
  Id   Target Id         Frame 
* 1    Thread 0x7ffaa110a740 (LWP 4128) "Main" 0x00007ffaa05e3fbb in __waitpid (pid=4131, stat_loc=0x7ffaa111811c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
  2    Thread 0x7ffa9efff700 (LWP 4129) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7ffa9cc34700 (LWP 4130) "Finalizer" 0x00007ffaa05e2867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x97c100) at ../sysdeps/unix/sysv/linux/futex-internal.h:205

Thread 3 (Thread 0x7ffa9cc34700 (LWP 4130)):
#0  0x00007ffaa05e2867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x97c100) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x97c100, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007ffaa05e2914 in __new_sem_wait_slow (sem=0x97c100, abstime=0x0) at sem_waitcommon.c:181
#3  0x00007ffaa05e29ba in __new_sem_wait (sem=<optimized out>) at sem_wait.c:29
#4  0x00000000005bb8f9 in ?? ()
#5  0x000000000059c68c in ?? ()
#6  0x0000000000653b4c in ?? ()
#7  0x00007ffaa05da6fa in start_thread (arg=0x7ffa9cc34700) at pthread_create.c:333
#8  0x00007ffaa00fab5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7ffa9efff700 (LWP 4129)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000623a27 in ?? ()
#2  0x00007ffaa05da6fa in start_thread (arg=0x7ffa9efff700) at pthread_create.c:333
#3  0x00007ffaa00fab5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7ffaa110a740 (LWP 4128)):
#0  0x00007ffaa05e3fbb in __waitpid (pid=4131, stat_loc=0x7ffaa111811c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00000000004acd59 in ?? ()
#2  0x00000000005040fe in ?? ()
#3  0x00000000004275d7 in ?? ()
#4  <signal handler called>
#5  0x0000000000657efc in ?? ()
#6  0x0000000000657f91 in ?? ()
#7  0x00000000004b124b in ?? ()
#8  0x00000000004254cb in ?? ()
#9  0x000000000050d831 in ?? ()
#10 0x000000000050f96e in ?? ()
#11 0x0000000000510253 in ?? ()
#12 0x0000000000425efc in ?? ()
#13 0x00000000004af809 in ?? ()
#14 0x00000000004b0117 in ?? ()
#15 0x0000000041c6368c in ?? ()
#16 0x00007ffaa110a700 in ?? ()
#17 0x00000000018bc765 in ?? ()
#18 0x000000004158b76b in ?? ()
#19 0x0000000000000000 in ?? ()

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)
CSharp.CSharp.make:140: recipe for target 'prebuild' failed
make[1]: *** [prebuild] Error 134
Makefile:272: recipe for target 'CSharp.CSharp' failed
make: *** [CSharp.CSharp] Error 2
make: Leaving directory '/home/me/Desktop/qt_sharp/CppSharp/build/gmake'
tritao commented 8 years ago

I suspect you're hitting this issue.

https://github.com/mono/CppSharp/issues/655#issuecomment-230582585

The issue has been fixed but the build scripts have not been yet fixed to auto-detect recent GCC versions and choose the correct triple.

Try to change the triple in the build files and re-generate the project files to try a new build.

define-private-public commented 8 years ago

I tried changing the triple in the linked comment, but it looks liked it moved somewhere else in a more recent version of CppSharp. Is this the correct line to change?:

https://github.com/mono/CppSharp/blob/master/src/CppParser/Bindings/CSharp/premake5.lua#L30

And if it was, I tried changing it to { "x86_64-linux-gnu-cxx11abi/**.cs" } and then I got this error:

==== Building CSharp.CSharp (release_x64) ====
Creating ../obj/Release_x64/x64/Release/CSharp.CSharp
Running prebuild commands
mono --debug "../lib/Release_x64/CSharp.Gen.exe"

Generating bindings for CSharp (CSharp)
Looking for tests in: /home/ben/Desktop/qt_sharp/CppSharp/tests/CSharp
*** Error in `mono': free(): invalid pointer: 0x0000000002bf9558 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f300a3ae725]
/lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f300a3b6f4a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f300a3baabc]
/home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(+0x4c29ca)[0x7f300551f9ca]
/home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN5clang18CompilerInvocation14CreateFromArgsERS0_PKPKcS5_RNS_17DiagnosticsEngineE+0x1d7)[0x7f300552e0a7]
/home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN8CppSharp9CppParser6Parser11SetupHeaderEv+0x869)[0x7f30054f5419]
/home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN8CppSharp9CppParser6Parser11ParseHeaderERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEPNS0_12ParserResultE+0x4e)[0x7f300550724e]
[0x41afc990]
======= Memory map: ========
00400000-0076f000 r-xp 00000000 08:05 1976227                            /usr/bin/mono-sgen
0096f000-00970000 r--p 0036f000 08:05 1976227                            /usr/bin/mono-sgen
00970000-0097a000 rw-p 00370000 08:05 1976227                            /usr/bin/mono-sgen
0097a000-009ad000 rw-p 00000000 00:00 0 
02487000-02c57000 rw-p 00000000 00:00 0                                  [heap]
41042000-41052000 rwxp 00000000 00:00 0 
41ae7000-41b07000 rwxp 00000000 00:00 0 
7f2ff8000000-7f2ff8021000 rw-p 00000000 00:00 0 
7f2ff8021000-7f2ffc000000 ---p 00000000 00:00 0 
7f3000000000-7f3000021000 rw-p 00000000 00:00 0 
7f3000021000-7f3004000000 ---p 00000000 00:00 0 
7f30047d0000-7f3004b00000 r--p 00000000 08:05 1972932                    /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
7f3004b00000-7f3004c00000 rw-p 00000000 00:00 0 
7f3004c08000-7f3004c88000 rw-p 00000000 00:00 0 
7f3004c89000-7f3004cdb000 r--p 00000000 08:05 1972908                    /usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
7f3004cdb000-7f3004e4d000 r-xp 00000000 08:05 1969957                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f3004e4d000-7f300504d000 ---p 00172000 08:05 1969957                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f300504d000-7f3005057000 r--p 00172000 08:05 1969957                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f3005057000-7f3005059000 rw-p 0017c000 08:05 1969957                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f3005059000-7f300505d000 rw-p 00000000 00:00 0 
7f300505d000-7f30067f0000 r-xp 00000000 00:2b 6427078                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
7f30067f0000-7f30069f0000 ---p 01793000 00:2b 6427078                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
7f30069f0000-7f3006ac5000 r--p 01793000 00:2b 6427078                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
7f3006ac5000-7f3006ae1000 rw-p 01868000 00:2b 6427078                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
7f3006ae1000-7f3006ae7000 rw-p 00000000 00:00 0 
7f3006ae7000-7f3006d4c000 r--p 00000000 08:05 1972946                    /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
7f3006d4c000-7f3006e34000 r--p 00000000 08:05 2101000                    /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
7f3006e34000-7f3006e3d000 ---p 00000000 00:00 0 
7f3006e3d000-7f3007035000 rw-p 00000000 00:00 0 
7f3007035000-7f3007642000 r-xp 00000000 08:05 4589164                    /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f3007642000-7f3007842000 ---p 0060d000 08:05 4589164                    /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f3007842000-7f3007843000 rw-p 0060d000 08:05 4589164                    /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f3007843000-7f3007861000 rw-p 00000000 00:00 0 
7f3007861000-7f3007bff000 r--p 00000000 08:05 1975963                    /usr/lib/mono/4.5/mscorlib.dll
7f3007bff000-7f3008bff000 rw-p 00000000 00:00 0 
7f3008bff000-7f3008c00000 ---p 00000000 00:00 0 
7f3008c00000-7f3009800000 rw-p 00000000 00:00 0 
7f3009838000-7f300983a000 rw-p 00000000 00:00 0 
7f300983a000-7f300985a000 r--p 00000000 08:05 1972942                    /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
7f300985a000-7f3009870000 r--p 00000000 00:2b 6427082                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Parser.CSharp.dll.mdb
7f3009870000-7f30098af000 r--p 00000000 00:2b 6427081                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Parser.CSharp.dll
7f30098af000-7f30098b3000 r--p 00000000 00:2b 6427084                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Parser.dll.mdb
7f30098b3000-7f30098bf000 r--p 00000000 00:2b 6427083                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Parser.dll
7f30098bf000-7f30098c1000 r--p 00000000 00:2b 6427075                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.dll.mdb
7f30098c1000-7f30098c6000 r--p 00000000 00:2b 6427074                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.dll
7f30098c6000-7f30098e9000 r--p 00000000 00:2b 6427076                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.AST.dll
7f30098e9000-7f300990f000 r--p 00000000 00:2b 6427086                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Generator.dll.mdb
7f300990f000-7f300a337000 r--p 00000000 08:05 1974067                    /usr/lib/locale/locale-archive
7f300a337000-7f300a4f7000 r-xp 00000000 08:05 9179587                    /lib/x86_64-linux-gnu/libc-2.23.so
7f300a4f7000-7f300a6f6000 ---p 001c0000 08:05 9179587                    /lib/x86_64-linux-gnu/libc-2.23.so
7f300a6f6000-7f300a6fa000 r--p 001bf000 08:05 9179587                    /lib/x86_64-linux-gnu/libc-2.23.so
7f300a6fa000-7f300a6fc000 rw-p 001c3000 08:05 9179587                    /lib/x86_64-linux-gnu/libc-2.23.so
7f300a6fc000-7f300a700000 rw-p 00000000 00:00 0 
7f300a700000-7f300a716000 r-xp 00000000 08:05 9179625                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f300a716000-7f300a915000 ---p 00016000 08:05 9179625                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f300a915000-7f300a916000 rw-p 00015000 08:05 9179625                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f300a916000-7f300a92e000 r-xp 00000000 08:05 9179733                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f300a92e000-7f300ab2d000 ---p 00018000 08:05 9179733                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f300ab2d000-7f300ab2e000 r--p 00017000 08:05 9179733                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f300ab2e000-7f300ab2f000 rw-p 00018000 08:05 9179733                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f300ab2f000-7f300ab33000 rw-p 00000000 00:00 0 
7f300ab33000-7f300ab36000 r-xp 00000000 08:05 9179611                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f300ab36000-7f300ad35000 ---p 00003000 08:05 9179611                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f300ad35000-7f300ad36000 r--p 00002000 08:05 9179611                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f300ad36000-7f300ad37000 rw-p 00003000 08:05 9179611                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f300ad37000-7f300ad3e000 r-xp 00000000 08:05 9179741                    /lib/x86_64-linux-gnu/librt-2.23.so
7f300ad3e000-7f300af3d000 ---p 00007000 08:05 9179741                    /lib/x86_64-linux-gnu/librt-2.23.so
7f300af3d000-7f300af3e000 r--p 00006000 08:05 9179741                    /lib/x86_64-linux-gnu/librt-2.23.so
7f300af3e000-7f300af3f000 rw-p 00007000 08:05 9179741                    /lib/x86_64-linux-gnu/librt-2.23.so
7f300af3f000-7f300b047000 r-xp 00000000 08:05 9179657                    /lib/x86_64-linux-gnu/libm-2.23.so
7f300b047000-7f300b246000 ---p 00108000 08:05 9179657                    /lib/x86_64-linux-gnu/libm-2.23.so
7f300b246000-7f300b247000 r--p 00107000 08:05 9179657                    /lib/x86_64-linux-gnu/libm-2.23.so
7f300b247000-7f300b248000 rw-p 00108000 08:05 9179657                    /lib/x86_64-linux-gnu/libm-2.23.so
7f300b248000-7f300b26e000 r-xp 00000000 08:05 9179559                    /lib/x86_64-linux-gnu/ld-2.23.so
7f300b26e000-7f300b27d000 r--p 00000000 00:2b 6427077                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.AST.dll.mdb
7f300b27d000-7f300b2ee000 r--p 00000000 00:2b 6427085                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Generator.dll
7f300b2ee000-7f300b2f7000 r--p 00000000 00:2b 6427089                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Generator.Tests.dll
7f300b2f7000-7f300b3b1000 rw-p 00000000 00:00 0 
7f300b3b1000-7f300b3b4000 r--p 00000000 00:2b 6427090                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CppSharp.Generator.Tests.dll.mdb
7f300b3b4000-7f300b3ee000 rw-p 00000000 00:00 0 
7f300b3ee000-7f300b44d000 ---p 00000000 00:00 0 
7f300b44d000-7f300b453000 rw-p 00000000 00:00 0 
7f300b453000-7f300b454000 r--p 00000000 00:2b 6427093                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CSharp.Gen.exe.mdb
7f300b454000-7f300b45d000 rw-p 00000000 00:00 0 
7f300b45d000-7f300b460000 r--p 00000000 00:2b 6427092                    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/CSharp.Gen.exe
7f300b460000-7f300b46a000 rw-p 00000000 00:00 0 
7f300b46a000-7f300b46b000 rw-s 00000000 00:14 28                         /dev/shm/mono.4623
7f300b46b000-7f300b46d000 rw-p 00000000 00:00 0 
7f300b46d000-7f300b46e000 r--p 00025000 08:05 9179559                    /lib/x86_64-linux-gnu/ld-2.23.so
7f300b46e000-7f300b46f000 rw-p 00026000 08:05 9179559                    /lib/x86_64-linux-gnu/ld-2.23.so
7f300b46f000-7f300b470000 rw-p 00000000 00:00 0 
7ffeb41a5000-7ffeb41ad000 ---p 00000000 00:00 0 
7ffeb4983000-7ffeb49a4000 rw-p 00000000 00:00 0                          [stack]
7ffeb49c6000-7ffeb49c8000 r--p 00000000 00:00 0                          [vvar]
7ffeb49c8000-7ffeb49ca000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) CppSharp.Parser.ClangParser/__Internal.ParseHeader_0 (intptr) <IL 0x00009, 0x0005f>
  at CppSharp.Parser.ClangParser.ParseHeader (CppSharp.Parser.CppParserOptions) [0x0001f] in /home/ben/Desktop/qt_sharp/CppSharp/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs:18137
  at CppSharp.ClangParser.ParseSourceFile (CppSharp.SourceFile) [0x00021] in /home/ben/Desktop/qt_sharp/CppSharp/src/Parser/Parser.cs:59
  at CppSharp.ClangParser.<ParseProject>m__2 (CppSharp.SourceFile) [0x00002] in /home/ben/Desktop/qt_sharp/CppSharp/src/Parser/Parser.cs:90
  at System.Linq.Enumerable/WhereSelectListIterator`2<TSource_REF, TResult_REF>.MoveNext () <IL 0x0006c, 0x001a5>
  at System.Collections.Generic.List`1<T_REF>..ctor (System.Collections.Generic.IEnumerable`1<T_REF>) <0x001fb>
  at System.Linq.Enumerable.ToList<TSource_REF> (System.Collections.Generic.IEnumerable`1<TSource_REF>) <IL 0x00012, 0x00070>
  at CppSharp.ClangParser.ParseProject (CppSharp.Project,bool) [0x00030] in /home/ben/Desktop/qt_sharp/CppSharp/src/Parser/Parser.cs:90
  at CppSharp.Driver.ParseCode () [0x00040] in /home/ben/Desktop/qt_sharp/CppSharp/src/Generator/Driver.cs:203
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary) [0x000a0] in /home/ben/Desktop/qt_sharp/CppSharp/src/Generator/Driver.cs:494
  at CppSharp.Tests.CSharpTestsGenerator.Main (string[]) [0x00007] in /home/ben/Desktop/qt_sharp/CppSharp/tests/CSharp/CSharp.cs:185
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00051, 0x000c8>

Native stacktrace:

    mono() [0x4accca]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0) [0x7f300a9273d0]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f300a36c418]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f300a36e01a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7772a) [0x7f300a3ae72a]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a) [0x7f300a3b6f4a]
    /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c) [0x7f300a3baabc]
    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(+0x4c29ca) [0x7f300551f9ca]
    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN5clang18CompilerInvocation14CreateFromArgsERS0_PKPKcS5_RNS_17DiagnosticsEngineE+0x1d7) [0x7f300552e0a7]
    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN8CppSharp9CppParser6Parser11SetupHeaderEv+0x869) [0x7f30054f5419]
    /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so(_ZN8CppSharp9CppParser6Parser11ParseHeaderERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEPNS0_12ParserResultE+0x4e) [0x7f300550724e]
    [0x41afc990]

Debug info from gdb:

[New LWP 4624]
[New LWP 4625]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f300a926fbb in __waitpid (pid=4626, stat_loc=0x7ffeb499f70c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29  ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
  Id   Target Id         Frame 
* 1    Thread 0x7f300b44d740 (LWP 4623) "Main" 0x00007f300a926fbb in __waitpid (pid=4626, stat_loc=0x7ffeb499f70c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
  2    Thread 0x7f30093ff700 (LWP 4624) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7f3007034700 (LWP 4625) "Finalizer" 0x00007f300a925867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x97c100) at ../sysdeps/unix/sysv/linux/futex-internal.h:205

Thread 3 (Thread 0x7f3007034700 (LWP 4625)):
#0  0x00007f300a925867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x97c100) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x97c100, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007f300a925914 in __new_sem_wait_slow (sem=0x97c100, abstime=0x0) at sem_waitcommon.c:181
#3  0x00007f300a9259ba in __new_sem_wait (sem=<optimized out>) at sem_wait.c:29
#4  0x00000000005bb8f9 in ?? ()
#5  0x000000000059c68c in ?? ()
#6  0x0000000000653b4c in ?? ()
#7  0x00007f300a91d6fa in start_thread (arg=0x7f3007034700) at pthread_create.c:333
#8  0x00007f300a43db5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f30093ff700 (LWP 4624)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000623a27 in ?? ()
#2  0x00007f300a91d6fa in start_thread (arg=0x7f30093ff700) at pthread_create.c:333
#3  0x00007f300a43db5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f300b44d740 (LWP 4623)):
#0  0x00007f300a926fbb in __waitpid (pid=4626, stat_loc=0x7ffeb499f70c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00000000004acd59 in ?? ()
#2  <signal handler called>
#3  0x00007f300a36c418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#4  0x00007f300a36e01a in __GI_abort () at abort.c:89
#5  0x00007f300a3ae72a in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7f300a4c76b0 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#6  0x00007f300a3b6f4a in malloc_printerr (ar_ptr=<optimized out>, ptr=<optimized out>, str=0x7f300a4c448f "free(): invalid pointer", action=3) at malloc.c:5007
#7  _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3868
#8  0x00007f300a3baabc in __GI___libc_free (mem=<optimized out>) at malloc.c:2969
#9  0x00007f300551f9ca in ParseAnalyzerArgs(clang::AnalyzerOptions&, llvm::opt::ArgList&, clang::DiagnosticsEngine&) () from /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
#10 0x00007f300552e0a7 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, char const* const*, char const* const*, clang::DiagnosticsEngine&) () from /home/ben/Desktop/qt_sharp/CppSharp/build/gmake/lib/Release_x64/libCppSharp.CppParser.so
#11 0x00007f30054f5419 in CppSharp::CppParser::Parser::SetupHeader (this=this@entry=0x2c1e290) at ../../../src/CppParser/Parser.cpp:298
#12 0x00007f300550724e in CppSharp::CppParser::Parser::ParseHeader (this=0x2c1e290, SourceFiles=std::vector of length 1, capacity 1 = {...}, res=0x2bf8380) at ../../../src/CppParser/Parser.cpp:3770
#13 0x0000000041afc990 in ?? ()
#14 0x00007f30094035c0 in ?? ()
#15 0x00007ffeb49a24e0 in ?? ()
#16 0x00007f300941d9a0 in ?? ()
#17 0x00007f300941d9a0 in ?? ()
#18 0x0000000002bce380 in ?? ()
#19 0x00000000024d4760 in ?? ()
#20 0x00007f300941ac50 in ?? ()
#21 0x00007ffeb49a1df0 in ?? ()
#22 0x00007ffeb49a1c60 in ?? ()
#23 0x0000000041afc224 in ?? ()
#24 0x00007ffeb49a24e0 in ?? ()
#25 0x00007f300941d9a0 in ?? ()
#26 0x00007f300941ac50 in ?? ()
#27 0x0000000002bce380 in ?? ()
#28 0x00007ffeb49a1df0 in ?? ()
#29 0x0000000041afb954 in ?? ()
#30 0x0000000000000001 in ?? ()
#31 0x00007f300941ac50 in ?? ()
#32 0x0000000041afb8f0 in ?? ()
#33 0x0000000002bc2f70 in ?? ()
#34 0x0000000041afb8d9 in ?? ()
#35 0x000000000059cf10 in ?? ()
#36 0x00000000410441c0 in ?? ()
#37 0x00007f300941acd0 in ?? ()
#38 0x00007f300941acd0 in ?? ()
#39 0x0000000041afb8d4 in ?? ()
#40 0x00007f300941d9a0 in ?? ()
#41 0x00007f300941ac50 in ?? ()
#42 0x00007ffeb49a1df0 in ?? ()
#43 0x0000000041afb7b6 in ?? ()
#44 0x0000000000000000 in ?? ()

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)
CSharp.CSharp.make:140: recipe for target 'prebuild' failed
make[1]: *** [prebuild] Error 134
Makefile:272: recipe for target 'CSharp.CSharp' failed
make: *** [CSharp.CSharp] Error 2
make: Leaving directory '/home/ben/Desktop/qt_sharp/CppSharp/build/gmake'

Is there anywhere else the triple needs to be changed?

define-private-public commented 7 years ago

Hi.

It's been a while since I last left a message. Has there been any change on the Linux side of things?

ddobrev commented 7 years ago

@define-private-public QtSharp cannot be properly generated on Linux because of a bug in CppSharp - https://github.com/mono/CppSharp/issues/764 . I have unfortunately been too busy lately to either fix that bug or set up a Linux virtual machine. Unless you are able to give a hand, I would expect the problem to be fixed in June-July.

wolfgangmauer commented 7 years ago

I need QtSharp to be run on linux 32-Bit. This Bug is open for long time, is the any new infos?

define-private-public commented 7 years ago

Hi, Still haven't done anything in a while. I see that the one CppSharp bug is closed. I noticed that @wolfgangmauer is looking for 32 Bit support. Is 64 bit support there at least?

wolfgangmauer commented 7 years ago

Well, its not only linux-32. It need' to run on a Settop-Box (ARMV7) like raspi. At now i have(CrossCompile) C wrapper around Qt and use DllImport....

wolfgangmauer commented 7 years ago

I try out CppSharp and QtSharp, both do not compile/run on linux(Ubuntu-x64). Maybe they should be named CppWinSharp and QtWinSharp :-).

Hecatron commented 7 years ago

I think the main thing is to focus on getting it to work under one platform then worrying about other platforms afterwards. Without template functions / class's which is something ddobrev is working on at the moment, getting it working under Linux would probably be a mute point since the current windows version can't do something as simple as finding all child QWidgets within a QWidget currently. That's quite a difficult thing to do (outside of my scope).

Although I'm hoping to help out later on by proposing some changes / pull requests to use.

I'm currently working on a .Net core version of Gtksharp (gtk3) / scons stuff to see how that goes. If I can get that to work out okay then I'll take what I've learned and see if ddobrev is interested in it for CppSharp / QtSharp

wolfgangmauer commented 7 years ago

@grbd So, if you are working on Gtksharp make Gtk work on egl-only systems! Thats the only reason for me to use qt and not gtk :-(

Hecatron commented 7 years ago

I'm not working on Gtk or the GtkSharp code per say. Instead I'm working on the build scripts that surround GtkSharp to make it more portable / usable on .Net core, then I'm going to use that on some of my other projects. (a lot of that was bash and perl scripts / required a lot of fiddling in mingw to get it to work)

The actual code for GtkSharp is mostly just a copy / paste from:

Personally if I had a choice I'd use Qt since I'm not sure Gtk would survive long term and I like the idea of CppSharp generated code.

Also looking at the interfaces on these Ships that use Qt, that's some straight up star-trek type stuff right there

viennem commented 6 years ago

How can I update the binary references to CppSharp in the QtSharp build directory ? I'm getting the same System.NotImplementedException when executing QtSharp.CLI.exe on Linux after building it with QtSharp. I did not build CppSharp, but I did install it with nuget and I have the CppSharp dlls in several places (QtSharp/QtSharp/bin/Debug; QtSharp/QtSharp.CLI/bin/Debug ; QtSharp/packages/CppSharp.0.8.14/lib).

ddobrev commented 6 years ago

@maxime-vienne please try the latest C++#, 0.8.17.

viennem commented 6 years ago

I think I am already using it.

$ nuget list CppSharp
CppSharp 0.8.17

Do I need to change the references in QtSharp.csproj ? How do I find where the nuget package is installed ?

ddobrev commented 6 years ago

Are you trying to generate Qt# for Linux or on Linux? I am afraid the latter does not work yet because the NuGet packages are for Windows only.

viennem commented 6 years ago

Oh, so I need to build the CppSharp dlls from source ? I thought that the NuGet packages were available for linux too, because I was able to install them with nugget install CppSharp -Version 0.8.17.

Sorry, I'm new to this.

ddobrev commented 6 years ago

I am afraid not so you'd have to build it from source code.

define-private-public commented 6 years ago

I tried grabbing the latest release .tar.gz file. I was able to restore the nuget packages (via the command line), and build both the QtSharp and QtSharp.CLI projects. The only problem came up when trying to run the CLI. I passed in the arguments /usr/bin/qmake and /usr/bin/make. This was the output:

Unhandled Exception:
System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
  at <Module>.___CxxCallUnwindDtor (System.MonoFNPtrFakeClass pDtor, System.Void* pThis) [0x0000a] in <1e4c71e55e9e47099fbe59e4ae49d1cb>:0 
  at <Module>..cctor () [0x00011] in <1e4c71e55e9e47099fbe59e4ae49d1cb>:0 
   --- End of inner exception stack trace ---
  at CppSharp.Parser.ParserOptions..ctor () [0x00000] in <2479ed8ce232415c815ce1deaa0501a8>:0 
  at CppSharp.Driver..ctor (CppSharp.DriverOptions options) [0x00010] in <a0c86bd00d6a4e1a93b90087f0b58b13>:0 
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary library) [0x00012] in <a0c86bd00d6a4e1a93b90087f0b58b13>:0 
  at QtSharp.CLI.Program.Main (System.String[] args) [0x00132] in /home/ben/Desktop/QtSharp-0.7.3/QtSharp.CLI/Program.cs:196 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
  at <Module>.___CxxCallUnwindDtor (System.MonoFNPtrFakeClass pDtor, System.Void* pThis) [0x0000a] in <1e4c71e55e9e47099fbe59e4ae49d1cb>:0 
  at <Module>..cctor () [0x00011] in <1e4c71e55e9e47099fbe59e4ae49d1cb>:0 
   --- End of inner exception stack trace ---
  at CppSharp.Parser.ParserOptions..ctor () [0x00000] in <2479ed8ce232415c815ce1deaa0501a8>:0 
  at CppSharp.Driver..ctor (CppSharp.DriverOptions options) [0x00010] in <a0c86bd00d6a4e1a93b90087f0b58b13>:0 
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary library) [0x00012] in <a0c86bd00d6a4e1a93b90087f0b58b13>:0 
  at QtSharp.CLI.Program.Main (System.String[] args) [0x00132] in /home/ben/Desktop/QtSharp-0.7.3/QtSharp.CLI/Program.cs:196 
The application was terminated by a signal: SIGHUP
ddobrev commented 6 years ago

I am afraid the NuGet packages only work on Windows 64-bit. To run Qt# on Linux, you need to build C++# for Linux and then replace the managed references.

define-private-public commented 6 years ago

Ah, okay, I was confused on that. I think I did try building C++# from this document a while ago: https://github.com/ddobrev/QtSharp/blob/master/Docs/4.%20Building%20-%20CppSharp.md

But I got hung up somewhere. I see that it hasn't been updated in about two and a half years. Are the steps still good?

ddobrev commented 6 years ago

I am afraid not, they are for Windows only. Basically, you need to build C++# from source using its own instructions, and then replace the references in the Qt# project files.