I had a brief brush with WSL and later WSL2 when I was using MSWindows for a while.
One common issue seems to be that GLFW can be compiled for either X11 or Wayland, and it must be compiled for the same target as the rest of your app. With FLTK supporting both X11 and Wayland at the same time, I assume that means you have to find out which one your app chooses and link the corresponding GLFW.
GLFW (HEAD) now supports compiling both X11 and Wayland in the
same library (either statically or dynamically). You can then
switch at runtime with a glfwInitHint(). In my classes I have it
recognize "FLTK_BACKEND" and "XDG_SESSION_TYPE" to select the
backend that it uses.
No idea why you get the "file too short" error though, but in general, I try to link all my apps statically. FLTK is small enough and it reduces installation woes. You can check the file type with `file ibfltk_gl.so.1.4.so` and see the content with `nm -D ibfltk_gl.so.1.4.so` or `objdump -T ibfltk_gl.so.1.4.so`. Hope that helps... .
Static linking for my application is not an option as I need to
provide swig wrappers and also need to link against FFmpeg libs
which for legal reasons I can't link statically.
libfltk_gl.so.1.4.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e6121db98db515231e28416447a3aa058818ce43, not stripped
$ nm -D libfltk_gl.so.1.4.0 | grep
Fl_Widget
00000000000154f0 W
_ZN19Fl_Gl_Device_Plugin17rectangle_captureEP9Fl_Widgetiiii
0000000000015450 W _ZN19Fl_Gl_Device_Plugin5printEP9Fl_Widget
U _ZN2Fl5focusEP9Fl_Widget
U _ZN8Fl_Group3addER9Fl_Widget
U _ZN8Fl_Group9on_insertEP9Fl_Widgeti
U _ZN9Fl_Widget6damageEh
U _ZN9Fl_Widget6redrawEv
U _ZNK9Fl_Widget10top_windowEv
$ ldd libfltk_gl.so.1.4.0
./libfltk_gl.so.1.4.0: error while loading shared libraries:
libfltk.so.1.4: file too short
Oh... I think I see what the problem is. libfltk.so.1.4 is a symbolic link, not an actual DSO. It seems WSL2 has no concept of symlinks from Ubuntu. I can create *new* symlinks, but not actually *read* symlinks that are already created from Ubuntu. And the newly created symlinks can also *not* be read by the native Ubuntu on the same NTFS drive.
Oh well... Microsoft *almost* got it right this time, but they
still suck.
-- Gonzalo Garramuño ggar...@gmail.com
$ ldd libfltk_gl.so.1.4.0
./libfltk_gl.so.1.4.0: error while loading shared libraries: libfltk.so.1.4: file too short
Oh... I think I see what the problem is. libfltk.so.1.4 is a symbolic link, not an actual DSO. It seems WSL2 has no concept of symlinks from Ubuntu. I can create *new* symlinks, but not actually *read* symlinks that are already created from Ubuntu. And the newly created symlinks can also *not* be read by the native Ubuntu on the same NTFS drive.
Oh well... Microsoft *almost* got it right this time, but they still suck.