Patch to make leJOS compile with gcc4

When I was trying to build leJOS on Mac OS X Tiger 10.4.3 with gcc4 (from Xcode 2.2):

$ gcc_select
Current default compiler:
gcc version 4.0.1 (Apple Computer, Inc. build 5247)

I was getting this error:

====> Making leJOS Unix binaries (lejos, for emulation)
cd unix_impl; make OSTYPE=darwin
gcc -I../vmsrc -I. -Wall -Wno-unused -c ../vmsrc/threads.c
../vmsrc/threads.c: In function 'switch_thread':
../vmsrc/threads.c:326: error: label at end of compound statement
make[1]: *** [threads.o] Error 1
make: *** [tinyvm_emul] Error 2

This is simple to fix by applying this patch:

--- threads.c.orig      2006-01-07 08:37:40.000000000 -0800
+++ threads.c   2006-01-07 08:37:48.000000000 -0800
@@ -321,6 +321,7 @@
                }
             }
 done_pi:
+            ;
 #endif // PI_AVOIDANCE
          
           }

4 thoughts on “Patch to make leJOS compile with gcc4

  1. Hi,

    I’m getting the exact same error. I already went through and added “-source 1.3” to all of the make files and such, but now I’m getting this error. Unfortunately (I think I’m about to reveal a touch of newbie in me), I don’t understand how to apply the patch that you have there. Do I just change the code in threads.c to match that code?

    Thanks for any help!

    Timmy V.

  2. Just add ; on a new line after ‘done_pi:’ at line 323. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *