[oi-dev] Could I reuse the Linux crt headers for OpenIndiana?

Bob Friesenhahn bfriesen at simple.dallas.tx.us
Thu Mar 25 13:43:51 UTC 2021


On Thu, 25 Mar 2021, cretin1997 via oi-dev wrote:

> The current crt headers of FreeBASIC is exclusively based on Linux: https://github.com/freebasic/fbc/tree/master/inc/crt
>
> In order to build GTK based FreeBASIC application, one has to have a working crt headers set, too. There is no such thing for OpenIndiana. I and other FreeBASIC users decided to just copy the Linux crt headers and modify them to use with OpenIndiana. The result is we could build the application successfully but unfortunately this application can't run. I think there could be two potential problems:
>
> First, it could be my removing of --export-dynamic caused the FreeBASIC compiler to generate a not working shared library.

This seems like the most unlikely cause. :-)

> Second, it could be the Linux crt headers are incompatible with OpenIndiana, the C standard functions are the same but the platform specific details (#define bla bla) are different, so the application could be compiled, but it used the wrong details so it can't run.

This is exceedingly likely.  Although Linux is originally modelled on 
SunOS (a clone of Unix), it did not directly copy it.  The GNU libc 
(much of what you call a "CRT") is independent of Linux, so it also 
makes its own decisions.

>From looking at the translated ".bi" files (e.g. 
https://github.com/freebasic/fbc/blob/master/inc/crt/io.bi), there are 
many arbitrary constant values which were translated from system 
headers.  An API may be the "same" (be compliant to a standard) even 
if the integer values representing it are different.

At the top of the referenced header I see "io -- header translated 
with help of SWIG FB wrapper".

It seems that the methodology used to create this files needs to be 
replicated in order to produce similar files for Illumos.

> Please note that the application could be launched, but it just sit 
> there idle and doesn't print any output on the terminal. I have to 
> use Ctrl+C to cancel it.

This is not surprising.  What means "start" in Linux may very well 
mean "stop" in Illumos.

It does not appear that the git structure of the FreeBASIC files is 
designed to support porting since it does not even mention that these 
files are translations of Linux/glibc header content.

Python does similar things, but it is designed for porting.

Bob
-- 
Bob Friesenhahn
bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt



More information about the oi-dev mailing list