• MorphOS Developer
    Piru
    Posts: 580 from 2003/2/24
    From: finland, the l...
    Quote:

    Alexco wrote:

    If I want to port some Unix/Linux tool, what am I supposed to choose, ixemul or libnix?

    ixemul, assuming you just want to quickly get things done.

    Usually "proper" ports will use libnix, but this is quite often overkill just to get something done quickly.

    Quote:

    According to documents ixemul is more POSIX compliant than libnix, but looking at the different includes I find signal.h in "include" is missing a lot compared to FreeBSD 12 and semaphore.h is not available, but available in includestd.

    The ixemul API is unfortunately rather old but slowly getting upgraded. Next SDK will also include semaphore.h for ixemul, as well as accompanying libpthtread.a. Much of the time many GNU projects have some support library that implements the necessary functionality using the functions that are available (typically this is called libgnu.a). This works remarkably well. Sometimes some small patches are needed to avoid some missing functions.

    Quote:

    Does this mean that semaphores are not available in ixemul and signal handling is limited in ixemul?

    The semaphore implementation is missing in the current public SDK, but will be part of the next SDK release. Signal handling is limited, but exists and is working (with certain limitations such as for example KILL not being possible). Typically the missing functions can be implemented with the existing rudimentary functions. If you have any specific needs or something critical missing let me know and I'll look into adding it.

    Quote:

    Or is includestd not for libnix?

    includestd is libnix, indeed. Please note that not all functions in the libnix headers are implemented however. For example libnix has no real POSIX signal support at all.

    Quote:

    Can I mix both inside a project, e.g. compile some modules with libnix support and link this together with ixemul modules to an executable?

    No. Also, when using ixemul you're not allowed to call the MorphOS native library functions directly. Everything has to go thru ixemul.library in this case, or you'll risk having execution interrupted in the middle of OS function (can lead to for example critical OS semaphore - I'm talking about struct SignalSemaphore here, not to be mixed with POSIX semaphores - being held while your app exits via signal handler).

    If you want to call MorphOS functions then you need to use libnix (or you can skip standard libraries completely and manage everything manually, that is: -nostartfiles).

    Quote:

    Also gcc seems to have problems linking with -pie, as it claims pie is not available. Is this a general MOS thing and -fPIC, -pie,... needs to be removed when compiling?

    MorphOS binaries are always position independent anyway, so there is no need for it.

    [ Edited by Piru 10.04.2020 - 01:47 ]
  • »09.04.20 - 23:33
    Profile