xeno-config options to build Xenomai applications
Hi,
I think that this question has been answered partially in the list, but I would like to ask it with more detail to clarify and maybe rewrite for the documentation.
I'm asking for applications in the user space, no kernel space. And cobalt core. Are these options correct?
1) Simple (C/C++) POSIX application with some threads. We want to use the POSIX functions as RT functions when possible.
To compile: xeno-config --posix --cflags To link: xeno-config --posix --ldflags --auto-init
2) C/C++ POSIX shared library with some threads. We want to use the POSIX functions as RT functions when possible.
To compile: xeno-config --posix --cflags
To link: xeno-config --posix --ldflags --auto-init -auto-init-solib
to build an application that uses that library:
To compile: xeno-config --posix --cflags + normal cflags
To link: xeno-config --posix --ldflags --no-auto-init + (ldflags of the library)
3) C/C++ POSIX shared library with native (2.x) (--alchemy) code and xddm mechanism to interchange data. The posix code must not be wrapped
To compile: xeno-config --native --cflags --compat
To link: xeno-config --native --ldflags --auto-init -auto-init-solib --compat
to build an application that uses that library:
compile and link with normal flags of the application to link against.
Best regards,
Leopold
Signature · 16 lines
-- Linux User 152692 GPG: 05F4A7A949A2D9AA Catalonia ------------------------------------- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <http://xenomai.org/pipermail/xenomai/attachments/20171130/ce0ad9cf/attachment.sig>
Quoted 5 lines · Leopold Palomo-Avellaneda
Hi,
I think that this question has been answered partially in the list, but I would like to ask it with more detail to clarify and maybe rewrite for the documentation.
Quoted 8 lines
I'm asking for applications in the user space, no kernel space. And cobalt core. Are these options correct?
1) Simple (C/C++) POSIX application with some threads. We want to use the POSIX functions as RT functions when possible.
To compile: xeno-config --posix --cflags To link: xeno-config --posix --ldflags --auto-init
Correct (also: --auto-init is assumed by default).
Quoted 7 lines
2) C/C++ POSIX shared library with some threads. We want to use the POSIX functions as RT functions when possible.
To compile: xeno-config --posix --cflags
To link: xeno-config --posix --ldflags --auto-init -auto-init-solib
--auto-init is for pure execs, which is mutually exclusive with --auto-init-solib which is for DSOs.
xeno-config --posix --ldflags [--auto-init-solib]
One needs --auto-init-solib to have the application attach to the Cobalt core (for gaining rt services) when it runs dlopen() on that library/DSO. The Xenomai code in charge of attaching the calling process to the rt core is contained in the bootstrap*.o files, one to be glued into pure execs, another one to be glued into PIC modules such as a DSOs.
This configuration is typically useful with plugin architectures, which may dynamically load a Xenomai-dependent plugin to gain some rt services, but for which there is no point in having the main executable depend on or even know about Xenomai by construction. e.g. some language interpreter which can be dynamically extended by linking in rt features implemented in an external DSO.
Quoted 5 lines
to build an application that uses that library:
To compile: xeno-config --posix --cflags + normal cflags
To link: xeno-config --posix --ldflags --no-auto-init + (ldflags of the library)
Correct, if bootstrapping the Xenomai services for the process is done at some point though; like by passing --auto-init-solib for building a DSO this app depends on, as you originally mentioned.
Quoted 3 lines
3) C/C++ POSIX shared library with native (2.x) (--alchemy) code and xddm mechanism to interchange data. The posix code must not be wrapped
Assuming you meant: the posix code should not be wrapped (i.e. application requirement, not a Xenomai requirement).
Quoted 5 lines
To compile: xeno-config --native --cflags --compat
To link: xeno-config --native --ldflags --auto-init -auto-init-solib --compatto build an application that uses that library:
Correct, dropping --auto-init in this case though.
Quoted 8 lines
compile and link with normal flags of the application to link against.
Best regards,
Leopold
Signature · 1 line
Philippe.
Hi,
first of all thanks!!
Quoted 1 line · Philippe Gerum
On 11/30/2017 01:32 PM, Leopold Palomo-Avellaneda wrote:
[....]
Quoted 7 lines
Quoted 4 lines
3) C/C++ POSIX shared library with native (2.x) (--alchemy) code and xddm mechanism to interchange data. The posix code must not be wrapped
Assuming you meant: the posix code should not be wrapped (i.e. application requirement, not a Xenomai requirement).
ok, but could be any kind of conflict in the posix code is wrapped? xddm, etc?
And just asking an idea. Could be possible "in theory" to build some big library as POCO to convert it to RT wrapping its POSIX funcions? I'm thinking in the thread class and the network module (RTNET)
Leopold
Signature · 8 lines
-- Linux User 152692 GPG: 05F4A7A949A2D9AA Catalonia ------------------------------------- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
Quoted 9 lines · Leopold Palomo-Avellaneda
Hi,
first of all thanks!!
Quoted 1 line · Philippe Gerum
On 11/30/2017 01:32 PM, Leopold Palomo-Avellaneda wrote:
[....]
Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
3) C/C++ POSIX shared library with native (2.x) (--alchemy) code and xddm mechanism to interchange data. The posix code must not be wrapped
Assuming you meant: the posix code should not be wrapped (i.e. application requirement, not a Xenomai requirement).
ok, but could be any kind of conflict in the posix code is wrapped? xddm, etc?
With the app, could be. With the Xenomai libs, should not be as there are provisions for avoiding this by explicitly marking the POSIX calls there with either __RT() or __STD().
Quoted 5 lines
And just asking an idea. Could be possible "in theory" to build some big library as POCO to convert it to RT wrapping its POSIX funcions? I'm thinking in the thread class and the network module (RTNET)
POSIX resources - sems, mutexes, condvars etc - can't be shared between rt and non-rt domains (i.e. cobalt and glibc), so blindly wrapping all POSIX calls may lead to unexpected results if there are calls on the same resources between those domains.
Also, calling a non-wrapped portion of the library from a wrapped portion would defeat the purpose of switching the POSIX calls issued by the latter to Xenomai services. Wrapping should be handled on a case by case basis, I don't see any "automatic" process for this.
Signature · 1 line
Philippe.