emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.67k stars 3.29k forks source link

Use of emconfigure for wxWidgets #13983

Open faisalahmed88 opened 3 years ago

faisalahmed88 commented 3 years ago

Hi, I am using the following documentation.

https://emscripten.org/docs/compiling/Building-Projects.html

emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.17 clang version 13.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 3b677b81cec7b3c5132aee8fccc30252d87deb69) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /home/faisal/Desktop/emsdk/upstream/bin

I am looking to use the ./emconfigure file for the wxWidgets library in Ubuntu. It could not find the gtk library. Simple execution of ./configure for g++ works just fine.

issue

sbc100 commented 3 years ago

There is no support for gtk or glib/gthread that I know of on emscripten. If you wanted that to work you would first need to port GTK+ to emscripten

faisalahmed88 commented 3 years ago

Alright, thankyou

faisalahmed88 commented 3 years ago

Hi,

I am trying to port GTK to enscripten i.e. by using meson to cross-compile to emscripten.

enscripten.txt `[binaries] c = /home/faisal/Desktop/emsdk/upstream/emscripten/emcc cpp = /home/faisal/Desktop/emsdk/upstream/emscripten/em++ ar = /home/faisal/Desktop/emsdk/upstream/emscripten/emar'

meson --cross-file=emscripten.txt . build

I am getting the following error,

Screenshot from 2021-04-26 12-42-55

My goal is to use the shared libraries from GTK, to link them to produce .wasm file.

As I suppose, this to work i need to port glib by using ./emmake make. Is it the right approach?

sbc100 commented 3 years ago

Indeed we do not currently support getxattr in our version of musl libc.

If you want to port gtk to emscripten you are going to hit lot of issue like this. Porting gtk is likely to be highly non-trivial.. perhaps weeks or months of dedicated work since it is is very large and complex library with lots of dependencies and I/O with the operating system. I don't mean to discourage you but you are not trying to solve an easy problem here. The Qt folks managed to port Qt but I imagine that took a fair amount of effort and customization.

faisalahmed88 commented 3 years ago

thanks for the information. Qt has LGPL licencing, that's why it will be hard for me to use. There are many c++ gui libraries, is there any thats already or can be easily ported to emscripten. I am interested in c++ GUI app to JS web app.

sbc100 commented 3 years ago

GTK is also LGPL according to https://www.gtk.org/:

GTK is a free and open-source project maintained by GNOME and an active community of contributors. GTK is released under the terms of the GNU Lesser General Public License.

wxWidgets might be the way to go if you can remove / avoid the GTK dependency.. although maybe check their license too.. it looks like its at least derived from LGPL: https://wxwidgets.org/about/licence/. Perhaps there is a wxWidgets that draws directly to OpenGL?

faisalahmed88 commented 3 years ago

Hi,

wxWidgets is also LGPL with the exception

stating that derived works in binary form may be distributed on the user’s own terms. This is a solution that satisfies those who wish to produce GPL’ed software using wxWidgets, and also those producing proprietary software.

And Qt does not provide that exception.

wxWidgets has a class wxGLCanvas that displays openGL graphics. I am not sure about it because porting to wasm still requires GTK to be compiled from emcc.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.