Hi all,
I simply comment the line "#include<glib/deprecated/gthread.h>" in glib.h and it goes well. It seems it can include the head file successfully. But when I write some simple codes use the glib: //main.c #include <glib.h> gint i, rc; GHashTable *h; h = g_hash_table_new (NULL, NULL); it yields " undefined reference to `g_hash_table_new' ". It can find the 'GHashTable' definition but cannot find the 'g_hash_table_new', where all of them are included indirectly in <glib.h>. Have you anyone come across similar error when cross compiling the glib? Lele Ma 在 2014-09-25 14:29:11,"Lele MA" <lelema...@gmail.com> 写道: Hi all, I am trying to cross compile Glib into xen stubdom (based on Mini-OS), which has only the libc support from newlib. The cross root directory is '/cross-root-x86_64/x86_64-xen-elf/' I add the 'cross-glib' target in Makefile and the cross compile and install is succeed. The Makefile rules like this: TARGET_CPPFLAGS += -isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/glib-2.0 TARGET_CPPFLAGS += -isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/glib-2.0/include .PHONY: cross-glib cross-glib: glib-$(GLIB_VERSION) $(NEWLIB_STAMPFILE) ( cd $< && \ CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf --verbose --host=$(GNU_TARGET_ARCH)-xen-elf && \ $(MAKE) DESTDIR= && \ $(MAKE) DESTDIR= install ) Then I write programs to include <glib.h>, like this: //file: main.c #include <stdio.h> #include <unistd.h> #include <glib.h> int main(void) { sleep(2); printf("Hello, world!\n"); return 0; } But when cross compiled, it yields: cross-root-x86_64/x86_64-xen-elf/include/glib-2.0/glib/deprecated/gthread.h:162:5: error: unknown type name ‘pthread_t’ make[1]: *** [main.o] Error 1 I find pthread_t is defined in <sys/types.h>, which is included in 'pthread.h': #if defined(_POSIX_THREADS) #include <sys/types.h> #include <time.h> #include <sys/sched.h> Does it mean the system doesn't define "_POSIX_THREADS"? If so, can I still use the glib in the Mini-OS without the support of "_POSIX_THREADS"? Any advice will be appreciated! Lele Ma
_______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list