On 2013-06-17 11:21, Thorsten Glaser wrote:
Jens Staal dixit:

I picked up 2 problems immediately, which was that ape/cc does not understand
-O2 and -W... stuff. Because of this I will add a small test under compiler

You can export stuff like HAVE_CAN_OTWO=0 before running Build.sh
or put that into the Plan9) case.

For some strange reason ape/cc also chokes on this:

char ctasserts_dblcheck[sizeof(struct ctasserts) == NUM ? 1 : -1];
        int main(void) { return (sizeof(ctasserts_dblcheck)); }

Which of them precisely (there should be one above those)?
Working around the assertions is, unfortunately, not permitted.

In the attached patch, I do work around it since I don't understand the stuff. I am an amateur so much of what I do is horrible :)

There is most likely a much nicer solution to this problem.


When I got it sorted out I will send a patch to the list. Is it OK if I do the
diff on R46 (the version I currently have extracted on my Plan9 VM)?

Sure.

Attached is a patch to Build.sh. I put the tests for "PLAN9" last in the compiler tests in the hope that (gcc and hypothetical) alternative compilers on Plan9 then would have a chance first.
I had to re-define setegid and seteuid to setuid and setgid - a problem?

With the attached patch (done with the Plan9 "diff -n"), mksh builds with the native "cc" compiler under Plan9 APE using Build.sh.

The resulting binary can execute and within the shell, one can execute an external command (I tried "lc") once but it does not go back to being ready for a new command (I tried killing "lc" with the Del key or ctrl-c).



bye,
//mirabilos


Build.sh.orig:690 a Build.sh:691,695
> #OK this one is only added to pick up plan9 in c-coded tests...
> 	add_cppflags -DPLAN9
> #some missing stuff that need to be re-defined.
> 	add_cppflags -Dseteuid=setuid
> 	add_cppflags -Dsetegid=setgid
Build.sh.orig:878 a Build.sh:884,885
> #elif defined(PLAN9)
> ct="plan9"
Build.sh.orig:996 a Build.sh:1004,1006
> plan9)
> 	vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
> 	;;
Build.sh.orig:1135 a Build.sh:1146,1148
> elif test $ct = plan9; then
> 	save_NOWARN=
> 	DOWARN=
Build.sh.orig:1169 c Build.sh:1182
< elif test $ct = tcc || test $ct = tendra; then
---
> elif test $ct = tcc || test $ct = tendra || test $ct = plan9; then
Build.sh.orig:1905,1906 c Build.sh:1918,1923
< char ctasserts_dblcheck[sizeof(struct ctasserts) == NUM ? 1 : -1];
< 	int main(void) { return (sizeof(ctasserts_dblcheck)); }
---
> #ifndef PLAN9
> char ctasserts_dblcheck[sizeof(struct ctasserts) == NUM ? 1 : -1]; 
> #else
> char ctasserts_dblcheck[1];
> #endif
> 	int main(void) { return (sizeof(ctasserts_dblcheck)); } 

Reply via email to