I have cross compiled glib-2.74.0 to qnx 7.0 using the qnx gcc 5.4 cross compiler.
So far so good. But, when I compile a small test program that links to glib (it doesn’t use anything in glib, just linking) and run it on my qnx target I get a segmentation fault before the main method is invoked
Probably someone more knowledgable than me can give you a comprehensive answer; anyway, from what I can tell, the issue may be related to __attribute__(constructor) functions defined inside GLib.
Here’s a quick grep:
$ grep -rn --exclude-dir=".git" gconstructor.h
docs/reference/glib/meson.build:36: 'gconstructor.h',
gio/giomodule.c:76:#include "gconstructor.h"
gio/meson.build:933: input : ['data-to-c.py', files('../glib/gconstructor.h')],
gio/tests/resources.c:24:#include "gconstructor.h"
glib/gconstructor-private.h:30:#include "gconstructor.h"
glib/gconstructor.h:62: * so that items using gconstructor.h outside of GLib (such as
glib/glib-init.c:28:#include "gconstructor.h"
gobject/gobject.c:38:#include "gconstructor.h"
gobject/gtype.c:37:#include "gconstructor.h"
NEWS:656: - !2487 gconstructor.h: Visual Studio: Only include gslist.h if needed
NEWS:3130: - !791 glib/gconstructor.h: Include stdlib.h for MSVC builds
Apart from ancillary files and tests, constructors are used in:
Tried generating static glib libs and linking those to my test application, and it works fine.
So something is not right with generating glib dynamic libs.
This indicates to me that this is not an issue with static initialization or…?
This indicates to me that this is not an issue with static initialization or…?
I guess so, yes.
Out of curiosity, are you linking with all of the shared libraries provided by GLib (glib, gobject, gio, gmodule, gthread), or just glib? Also, did you ever test with previous versions of GLib?
This could be an issue with the QNX loader, as the crash seems to happen in ldqnx-64.so