Gobo on OpenBSD

6 messages Options
Embed this post
Permalink
Bernd Schoeller

Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
Hello everybody,

for your information:

I have successfully compiled Gobo (including gec) under OpenBSD. As a
result, gec is now the first Eiffel compiler that has been ported to
OpenBSD.

The 'security enhanced' gcc compiler of OpenBSD issues a couple of
warnings about the use of 'sprintf' and 'strcpy' (which OpenBSD
requires be replaced by their safe counterparts):

  /tmp//ccIg2494.o(.text+0x173068): In function `file_creatable':
  : warning: strcpy() is almost always misused, please use strlcpy()
  /tmp//ccIg2494.o(.text+0x17348b): In function `file_owner':
  : warning: sprintf() is often misused, please use snprintf()

Normally, OpenBSD is a challenge to any c-producing compiler, as it
uses lots of enhanced techniques to defend against buffer-overflows
(pro-police stack guard, mmap instead of brk for malloc, randomized
heap locations). Gobo seems to be clean with respect to these issues.

The bootstrapping works as expected: create the 'gec.c' and 'gec.h'
files under Linux, copy them to OpenBSD, compile a 'gec'-binary
manually, add it to the path, do '$GOBO/work/bootstrap/bootstrap.sh'.

I have some problems to compile 'gexslt':

First I had a ulimit for processes at 512MB, which made 'gec' produce
a segmentation violation, caused by an 'out-of-memory' call to
gealloc. A nicer error message would be appreciated here.

Then, compiling gexslt required too much memory for the first host
(that machine had 512MB of RAM). I stopped at 814M, but then swapping
locked down the OS.

On a second host (1500MB of RAM under VMWare), I managed to generate
the C code.  Then I had to add '#include <sys/timeb.h>' to the .h-file
for the C compilation to start. In the end, gcc terminates with:

cc1: out of memory allocating 18296555516 bytes after a total of 0 bytes

Bernd


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
Eric Bezault

Re: Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
Bernd Schoeller wrote:
> I have successfully compiled Gobo (including gec) under OpenBSD. As a
> result, gec is now the first Eiffel compiler that has been ported to
> OpenBSD.

Wow, you're too fast ;-) I'm still ironing a few things and
writing the embryo of the doc (listing what is not implemented
yet) before asking people to try to compile Gobo with gec
on their computer with their C compiler.

> The 'security enhanced' gcc compiler of OpenBSD issues a couple of
> warnings about the use of 'sprintf' and 'strcpy' (which OpenBSD
> requires be replaced by their safe counterparts):
>
>   /tmp//ccIg2494.o(.text+0x173068): In function `file_creatable':
>   : warning: strcpy() is almost always misused, please use strlcpy()
>   /tmp//ccIg2494.o(.text+0x17348b): In function `file_owner':
>   : warning: sprintf() is often misused, please use snprintf()

OK, I'll have a look at that, but I don't care that much because
it is to implement some features from FreeELKS's file classes
but these classes really owe to reduce their interface with C.

> Normally, OpenBSD is a challenge to any c-producing compiler, as it
> uses lots of enhanced techniques to defend against buffer-overflows
> (pro-police stack guard, mmap instead of brk for malloc, randomized
> heap locations). Gobo seems to be clean with respect to these issues.

Good.

> The bootstrapping works as expected: create the 'gec.c' and 'gec.h'
> files under Linux, copy them to OpenBSD, compile a 'gec'-binary
> manually, add it to the path, do '$GOBO/work/bootstrap/bootstrap.sh'.

I wanted to wait before adding gec.[ch] to the bootstrap. I
first want to get feedback from people trying to compile
Gobo with gec with different C compilers on different
platforms. But as I said above, I'm not quite ready yet.
Almost...

> I have some problems to compile 'gexslt':

All Eiffel compilers have problems compiling gexslt!

> First I had a ulimit for processes at 512MB, which made 'gec' produce
> a segmentation violation, caused by an 'out-of-memory' call to
> gealloc. A nicer error message would be appreciated here.

Yes, but you're too fast again ;-) gec does not support exceptions
yet. Therefore you don't get a No-more-memory exception yet.

> Then, compiling gexslt required too much memory for the first host
> (that machine had 512MB of RAM). I stopped at 814M, but then swapping
> locked down the OS.
>
> On a second host (1500MB of RAM under VMWare), I managed to generate
> the C code.  Then I had to add '#include <sys/timeb.h>' to the .h-file
> for the C compilation to start.

Do you know what requires this include file? Is it something
part of the generated C code, or something in one of the C
files in $GOBO/misc/gec/runtime/c?

> In the end, gcc terminates with:
>
> cc1: out of memory allocating 18296555516 bytes after a total of 0 bytes

I didn't have time to let gec be able to generate several
smaller C files instead of a huge one. When that will be
implemented perhaps this will help things a bit.

--
Eric Bezault
mailto:[hidden email]
http://www.gobosoft.com



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
Bernd Schoeller

Re: Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
On Tue, Mar 07, 2006 at 07:38:59PM +0100, Eric Bezault wrote:

> >Then, compiling gexslt required too much memory for the first host
> >(that machine had 512MB of RAM). I stopped at 814M, but then swapping
> >locked down the OS.
> >
> >On a second host (1500MB of RAM under VMWare), I managed to generate
> >the C code.  Then I had to add '#include <sys/timeb.h>' to the .h-file
> >for the C compilation to start.
>
> Do you know what requires this include file? Is it something
> part of the generated C code, or something in one of the C
> files in $GOBO/misc/gec/runtime/c?

I just ran the C compilation again, and discovered that the problem
was in linking, not in compilation. I must have tricked myself here.

The reason: ftime is deprecated (replaced by time and gettimeofday)
and has to be linked using -lcompat as it was removed from libc.

ftime seems to be deprecated in Linux and any other Unix OSs, so it
might be worthwhile to update FreeELKS to use the current Unix
mechanisms.

I have now managed to compile gexstl by tweaking some OS
configurations, but I had to switch off all optimizations. The
resulting binary is 16MB (stripped 14MB).

Bernd


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
Eric Bezault

Re: Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bernd Schoeller
Bernd Schoeller wrote:
> The 'security enhanced' gcc compiler of OpenBSD issues a couple of
> warnings about the use of 'sprintf' and 'strcpy' (which OpenBSD
> requires be replaced by their safe counterparts):
>
>   /tmp//ccIg2494.o(.text+0x173068): In function `file_creatable':
>   : warning: strcpy() is almost always misused, please use strlcpy()
>   /tmp//ccIg2494.o(.text+0x17348b): In function `file_owner':
>   : warning: sprintf() is often misused, please use snprintf()

I removed all occurrences of 'strcpy' and 'sprintf'. There are
still some occurrences of 'strcat' in the C code associated with
the PATH_NAME classes, but these classes ought to be rewritten
in pure Eiffel anyway.

--
Eric Bezault
mailto:[hidden email]
http://www.gobosoft.com



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
Eric Bezault

Re: Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bernd Schoeller
Bernd Schoeller wrote:
> The reason: ftime is deprecated (replaced by time and gettimeofday)
> and has to be linked using -lcompat as it was removed from libc.
>
> ftime seems to be deprecated in Linux and any other Unix OSs, so it
> might be worthwhile to update FreeELKS to use the current Unix
> mechanisms.

The problem is that apparently 'gettimeofday' is not supported
by MSVC under Windows. So I suggest that we keep 'ftime' (and
the -lcompat flag) for the time being.

> I have now managed to compile gexstl by tweaking some OS
> configurations, but I had to switch off all optimizations. The
> resulting binary is 16MB (stripped 14MB).

Under Windows we have to compile without C optimizations
as well (all Eiffel compilers alike) and the size of the
binary is about the same.

--
Eric Bezault
mailto:[hidden email]
http://www.gobosoft.com



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
GAMER-Kod

Re: Gobo on OpenBSD

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bernd Schoeller
Hello!
Did you mean Slonenok Gobo product by NOM (Neformal'noye Objedinenie Molodeji)? :D

Bernd Schoeller wrote:
Hello everybody,

for your information:

I have successfully compiled Gobo (including gec) under OpenBSD. As a
result, gec is now the first Eiffel compiler that has been ported to
OpenBSD.

The 'security enhanced' gcc compiler of OpenBSD issues a couple of
warnings about the use of 'sprintf' and 'strcpy' (which OpenBSD
requires be replaced by their safe counterparts):

  /tmp//ccIg2494.o(.text+0x173068): In function `file_creatable':
  : warning: strcpy() is almost always misused, please use strlcpy()
  /tmp//ccIg2494.o(.text+0x17348b): In function `file_owner':
  : warning: sprintf() is often misused, please use snprintf()

Normally, OpenBSD is a challenge to any c-producing compiler, as it
uses lots of enhanced techniques to defend against buffer-overflows
(pro-police stack guard, mmap instead of brk for malloc, randomized
heap locations). Gobo seems to be clean with respect to these issues.

The bootstrapping works as expected: create the 'gec.c' and 'gec.h'
files under Linux, copy them to OpenBSD, compile a 'gec'-binary
manually, add it to the path, do '$GOBO/work/bootstrap/bootstrap.sh'.

I have some problems to compile 'gexslt':

First I had a ulimit for processes at 512MB, which made 'gec' produce
a segmentation violation, caused by an 'out-of-memory' call to
gealloc. A nicer error message would be appreciated here.

Then, compiling gexslt required too much memory for the first host
(that machine had 512MB of RAM). I stopped at 814M, but then swapping
locked down the OS.

On a second host (1500MB of RAM under VMWare), I managed to generate
the C code.  Then I had to add '#include <sys/timeb.h>' to the .h-file
for the C compilation to start. In the end, gcc terminates with:

cc1: out of memory allocating 18296555516 bytes after a total of 0 bytes

Bernd


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gobo-eiffel-develop mailing list
gobo-eiffel-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop