* Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS"
@ 2014-09-25 9:08 Lele MA
2014-09-25 10:56 ` Ian Campbell
0 siblings, 1 reply; 6+ messages in thread
From: Lele MA @ 2014-09-25 9:08 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1612 bytes --]
Hi all,
I am trying to cross compile Glib into xen stubdom (based on Mini-OS). Does anyone knows how to cross compile the library into mini-OS?
I add the 'cross-glib' target in Makefile. The cross compilation and installation are succeed.
But when cross compiled with the main.c that include <glib.h>, 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
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 )
.PHONY: $(CROSS_ROOT)
$(CROSS_ROOT): cross-newlib cross-zlib cross-libpci cross-glib
Then I compile the c-stubdom with command "make c-stubdom"
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
[-- Attachment #1.2: Type: text/html, Size: 3067 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" 2014-09-25 9:08 Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" Lele MA @ 2014-09-25 10:56 ` Ian Campbell 2014-09-25 12:50 ` Lele MA 0 siblings, 1 reply; 6+ messages in thread From: Ian Campbell @ 2014-09-25 10:56 UTC (permalink / raw) To: Lele MA; +Cc: xen-devel Replying to this bit rather than the -users copy due to mention of rump kernels (feature in development) which follows. On Thu, 2014-09-25 at 17:08 +0800, Lele MA wrote: > Does it mean the system doesn't define "_POSIX_THREADS"? AFAIK mini-os doesn't supply a POSIX thread API, correct. I don't think anything else in the current stubdom infra (e.g. newlib) supplies one either. > If so, can I still use the glib in the Mini-OS without the support of > "_POSIX_THREADS"? That would be a question for the glib maintainers. At a minimum I'd expect you would need to port glib to the mini-os thread API. But, before you go down that route I think you should consider the new rumpkernels work which is going on. rumpkernels run on a mini-os/Xen and provide a BSD derived POSIX like environment, which I expect will include pthreads. Depending on your application it may well be very worthwhile to start from that (I think it most likely would be, but I don't know what you are actually doing). Ian. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" 2014-09-25 10:56 ` Ian Campbell @ 2014-09-25 12:50 ` Lele MA 2014-09-25 12:55 ` Ian Campbell 2014-09-25 16:56 ` Marcin Cieslak 0 siblings, 2 replies; 6+ messages in thread From: Lele MA @ 2014-09-25 12:50 UTC (permalink / raw) To: Ian Campbell; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 1193 bytes --] >AFAIK mini-os doesn't supply a POSIX thread API, correct. > >I don't think anything else in the current stubdom infra (e.g. newlib) >supplies one either. > >> If so, can I still use the glib in the Mini-OS without the support of >> "_POSIX_THREADS"? > >That would be a question for the glib maintainers. At a minimum I'd >expect you would need to port glib to the mini-os thread API. > >But, before you go down that route I think you should consider the new >rumpkernels work which is going on. > >rumpkernels run on a mini-os/Xen and provide a BSD derived POSIX like >environment, which I expect will include pthreads. Depending on your >application it may well be very worthwhile to start from that (I think >it most likely would be, but I don't know what you are actually doing). > Thank you so much! My ultimate goal is to use libvmi in mini-os. And libvmi needs glib's support. So I needs to cross-compile glib into mini-os firstly. The mini-os kernel is essential for our project, so I probably have to port the glib to mini-os thread API. Can you give me some tips on how to port a thread API ? I am a newbie to mini-os thread API, any help would appreciated. Thank you! Lele Ma [-- Attachment #1.2: Type: text/html, Size: 2385 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" 2014-09-25 12:50 ` Lele MA @ 2014-09-25 12:55 ` Ian Campbell 2014-09-25 15:41 ` Antti Kantee 2014-09-25 16:56 ` Marcin Cieslak 1 sibling, 1 reply; 6+ messages in thread From: Ian Campbell @ 2014-09-25 12:55 UTC (permalink / raw) To: Lele MA; +Cc: xen-devel On Thu, 2014-09-25 at 20:50 +0800, Lele MA wrote: > > >AFAIK mini-os doesn't supply a POSIX thread API, correct. > > > >I don't think anything else in the current stubdom infra (e.g. newlib) > >supplies one either. > > > >> If so, can I still use the glib in the Mini-OS without the support of > >> "_POSIX_THREADS"? > > > >That would be a question for the glib maintainers. At a minimum I'd > >expect you would need to port glib to the mini-os thread API. > > > >But, before you go down that route I think you should consider the new > >rumpkernels work which is going on. > > > >rumpkernels run on a mini-os/Xen and provide a BSD derived POSIX like > >environment, which I expect will include pthreads. Depending on your > >application it may well be very worthwhile to start from that (I think > >it most likely would be, but I don't know what you are actually doing). > > > > Thank you so much! > > My ultimate goal is to use libvmi in mini-os. And libvmi needs glib's support. So I needs to cross-compile glib into mini-os firstly. > > The mini-os kernel is essential for our project, Note that rumpkernels use mini-os (or at least large parts of it) under the hood. I'd strongly recommend you investigate rumpkernels before embarking on any direct porting work. > so I probably have to port the glib to mini-os thread API. Can you > give me some tips on how to port a thread API ? I've no idea what it actually looks like, sorry. You'll probably need to dize into the code. > I am a newbie to mini-os thread > API, any help would appreciated. Thank you! > > Lele Ma ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" 2014-09-25 12:55 ` Ian Campbell @ 2014-09-25 15:41 ` Antti Kantee 0 siblings, 0 replies; 6+ messages in thread From: Antti Kantee @ 2014-09-25 15:41 UTC (permalink / raw) To: Ian Campbell, Lele MA; +Cc: xen-devel On 25/09/14 12:55, Ian Campbell wrote: > On Thu, 2014-09-25 at 20:50 +0800, Lele MA wrote: >> >>> AFAIK mini-os doesn't supply a POSIX thread API, correct. >>> >>> I don't think anything else in the current stubdom infra (e.g. newlib) >>> supplies one either. >>> >>>> If so, can I still use the glib in the Mini-OS without the support of >>>> "_POSIX_THREADS"? >>> >>> That would be a question for the glib maintainers. At a minimum I'd >>> expect you would need to port glib to the mini-os thread API. >>> >>> But, before you go down that route I think you should consider the new >>> rumpkernels work which is going on. >>> >>> rumpkernels run on a mini-os/Xen and provide a BSD derived POSIX like >>> environment, which I expect will include pthreads. Depending on your >>> application it may well be very worthwhile to start from that (I think >>> it most likely would be, but I don't know what you are actually doing). Yes, there's support for pthreads with rump kernels on Xen (uses unmodified NetBSD libpthread). >> Thank you so much! >> >> My ultimate goal is to use libvmi in mini-os. And libvmi needs glib's support. So I needs to cross-compile glib into mini-os firstly. >> >> The mini-os kernel is essential for our project, > > Note that rumpkernels use mini-os (or at least large parts of it) under > the hood. I'd strongly recommend you investigate rumpkernels before > embarking on any direct porting work. Yes, it uses minios in a sort of "firmware" sense. You can still access the underlying minios from applications running as part of rumprun-xen ... though generally speaking it's better to access things through one API instead of multiple. The application-side interfaces (POSIX, TCP/IP, etc.) offered by rumprun-xen are complete enough that off-the-internet applications have a good chance of "just working" without any porting. >> so I probably have to port the glib to mini-os thread API. Can you >> give me some tips on how to port a thread API ? > > I've no idea what it actually looks like, sorry. You'll probably need to > dize into the code. > >> I am a newbie to mini-os thread >> API, any help would appreciated. Thank you! If you really want to roll your own, you can check how libpthread for rumprun-xen is integrated: https://github.com/rumpkernel/rumprun-xen/blob/92b81fde24beb5dfaec1c2eec3960a61cc6dd5e0/lib/_lwp.c Note: the above implements the _lwp API of NetBSD, which is what NetBSD libpthread uses to control the kernel threads it manages. The integration points to minios should be quite clear, nonetheless: create_thread(), block(), wake(), schedule(), ... - antti ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" 2014-09-25 12:50 ` Lele MA 2014-09-25 12:55 ` Ian Campbell @ 2014-09-25 16:56 ` Marcin Cieslak 1 sibling, 0 replies; 6+ messages in thread From: Marcin Cieslak @ 2014-09-25 16:56 UTC (permalink / raw) To: Lele MA; +Cc: Ian Campbell, xen-devel [-- Attachment #1: Type: TEXT/PLAIN, Size: 888 bytes --] On Thu, 25 Sep 2014, Lele MA wrote: > > >AFAIK mini-os doesn't supply a POSIX thread API, correct. > > > >I don't think anything else in the current stubdom infra (e.g. newlib) > >supplies one either. > > > >> If so, can I still use the glib in the Mini-OS without the support of > >> "_POSIX_THREADS"? > > > >That would be a question for the glib maintainers. At a minimum I'd > >expect you would need to port glib to the mini-os thread API. > > > > > > Thank you so much! > > My ultimate goal is to use libvmi in mini-os. > And libvmi needs glib's support. > So I needs to cross-compile glib into mini-os firstly. libvmi seems to use only simple list interface (GSList) from glib and probably not much more. It does not need threads and such stuff. It is probably much easier to supply some C list implementation to libvmi and get rid of glib dependency completely. //Marcin [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-25 16:56 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-09-25 9:08 Error when Glib cross compiled into Mini-OS without the support of "_POSIX_THREADS" Lele MA 2014-09-25 10:56 ` Ian Campbell 2014-09-25 12:50 ` Lele MA 2014-09-25 12:55 ` Ian Campbell 2014-09-25 15:41 ` Antti Kantee 2014-09-25 16:56 ` Marcin Cieslak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).