Skip to main content

building squawk on mac os x

14 replies [Last post]
metebalci
Offline
Joined: 2007-02-07
Points: 0

Hi,

I have read the previous post about building on linux and windows. However, I want to build on mac os x and I did not succeed yet. First, tools.jar does not exist in mac os x. However, I think the problem is not this. I have tried to play with Launcher and Build sources but again I did not come up with a solution. Detailed information is below, anybody has an idea ?

Today, at local JavaDay event, I have learned squawk project has become opensource. I am so happy with this, because I am interested in embedded platforms. In case there are any people interested, I have spent some effort to implement a CPU on FPGA and I plan to run Java over it.

Thank you,

Mete

----

/Library/Java/Home/bin/java -Xms128M -Xmx256M -ea -jar build.jar -info -verbose
os=Mac OS X-i386
java.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
java.vm.version=1.5.0_13-119
C compiler=gcc-macosx
Builder properties:
RTSJ1.0=false
SMARTMONITORS=true
NATIVE_VERIFICATION_ONLY=true
JAVA_SE=false
CLDC1.1=true
ASSERTIONS_ENABLED=false
SUITE_VERIFIER=false
GC=com.sun.squawk.Lisp2GenerationalCollector
J2ME.HEAP_TRACE=false
JDK1.0=false
KERNEL_SQUAWK=false
DEBUG_CODE_ENABLED=false
MACROIZE=false
FLASH_MEMORY=false
SQUAWK_64=false
FAST_INVOKEINTERFACE=true
INCLUDE_EXECUTECIO_PARMS=false
TRACING_ENABLED=false
REAL_TIME_MINI=true
VM2C=true
TRUSTED=false
REVERSE_PARAMETERS=true
ENABLE_DYNAMIC_CLASSLOADING=true
WRITE_BARRIER=true
RESOURCE.CONNECTION=false
J2ME.STATS=true
OLD_IIC_MESSAGES=false
FULL_SLOT_CLEARING_ANALYSIS=false
REUSEABLE_MESSAGES=false
TYPEMAP=false
TRUST_SLOT_CLEARING=true
REAL_TIME_PROTO=true
EXCLUDE=false
NATIVE_GC_ONLY=true
FINALIZATION=false
BUFFERCHANNELINPUT=false
NATIVE_VERIFICATION=true
SQUAWK=true
REAL_TIME=true
LISP2_BITMAP=true
FLOATS=true
CHECK_SLOT_CLEARING=false
[generating OPC...]
description: generates the file cldc/src/com/sun/squawk/vm/OPC.java
description: generates the file cldc/src/com/sun/squawk/vm/OPC.java
[building cldc...]
description: compiles the Java sources in cldc/src and cldc/phoneme
description: compiles the Java sources in cldc/src and cldc/phoneme
cldc/src/com/sun/squawk/Finalizer.java: excluded file
cldc/src/com/sun/squawk/FinalizerTest.java: excluded file
cldc/src/com/sun/squawk/FlashObjectMemoryLoader.java: excluded file
cldc/src/com/sun/squawk/io/j2me/channel/BufferedInputStream.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/ClientProtocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/Database.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/Message.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/MessageInputStream.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/MessageOutputStream.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/MessageResourceManager.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/MessageStreamCallback.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/NotifierProtocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/Protocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msg/ServerProtocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/msgserver/Protocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/resource/Protocol.java: excluded file
cldc/src/com/sun/squawk/io/j2me/spotsuite/Protocol.java: excluded file
cldc/src/com/sun/squawk/io/ServerConnectionHandler.java: excluded file
cldc/src/com/sun/squawk/JavaDriverManager.java: excluded file
[initializing Java compiler tools]
[javamake not found, switching to standard compilation: add javamake.jar to builder's classpath to prevent this]
[running 'javac @cldc/preprocessed/javac.input' to compile 188 sources...]
cldc/preprocessed/com/sun/cldc/i18n/Helper.java:72: cannot find symbol
symbol : class InputStream
location: class com.sun.cldc.i18n.Helper
.
.
.
build failed: javamake compilation failed
com.sun.squawk.builder.BuildException: javamake compilation failed
at com.sun.squawk.builder.JavaCompiler.javac(JavaCompiler.java:413)
at com.sun.squawk.builder.JavaCompiler.compile(JavaCompiler.java:211)
at com.sun.squawk.builder.Build.javac(Build.java:1946)
at com.sun.squawk.builder.Target.run(Target.java:84)
at com.sun.squawk.builder.Build.run(Build.java:831)
at com.sun.squawk.builder.Build.runCommand(Build.java:787)
at com.sun.squawk.builder.Build.mainProgrammatic(Build.java:1315)
at com.sun.squawk.builder.Build.main(Build.java:1279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.squawk.builder.launcher.Launcher.main(Launcher.java:57)

cldc/preprocessed/javac.input file:
-bootclasspath cldc/classes -d cldc/classes -target 1.2 -source 1.3 -g cldc/preprocessed/com/sun/cldc/i18n/Helper.java ...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rasmussenc
Offline
Joined: 2007-10-06
Points: 0

How was the original problem in this post solved? I seem to be experiencing the same thing. (10.5, installed the Xcode tools). Seems like a basic classpath issue.?

rasmussenc
Offline
Joined: 2007-10-06
Points: 0

ok one has to run

./d copyphoneme

first.

eric_arseneau
Offline
Joined: 2004-07-15
Points: 0

I will put it back in as a requirement, too many people are being hit by this. This should resolve problems of cldc and imp not compiling.

turon
Offline
Joined: 2008-02-22
Points: 0

Great. That fixed it. I was able to build and run the test / profiling suite.

Might I suggest adding a barebones Makefile to help get people started? That tends to be what people are familiar with, and though you core developers may never run it, perhaps it would give users a less intimidating out-of-box experience.

Are there any other tests or demo classes we run straight out of the tree?

Looks good!
Martin

==================================================

# Makefile for Squawk -- just to get started.
# More detailed build commands are in the d script.
#
# $Id$

BUILD = ./d

all: clean copyphoneme builder main rom

clean:
$(BUILD) clean

copyphoneme:
$(BUILD) copyphoneme

builder:
$(BUILD) builder

main:
$(BUILD)

rom:
$(BUILD) rom cldc

test:
./squawk com.sun.squawk.Test

aircable
Offline
Joined: 2008-03-02
Points: 0

I'm slowly succeeding too, with some errors and changes:
during ./d rom I got

[compiling 'vmcore/src/vm/squawk.c' ...]
In file included from vmcore/src/vm/squawk.c:524:
vmcore/src/vm/bytecodes.c: In function ‘extendStack’:
vmcore/src/vm/bytecodes.c:3249: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c:3249: error: (Each undeclared identifier is reported only once
vmcore/src/vm/bytecodes.c:3249: error: for each function it appears in.)
vmcore/src/vm/bytecodes.c: In function ‘checkReferenceSlots’:
vmcore/src/vm/bytecodes.c:3293: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c: In function ‘invokenativemain’:
vmcore/src/vm/bytecodes.c:3554: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c: In function ‘do_throw’:
vmcore/src/vm/bytecodes.c:5414: error: ‘opcode’ undeclared (first use in this function)
build failed: Process.exec(gcc -c -DTRACE -DASSUME -DNATIVE_VERIFICATION=true -D_GNU_SOURCE -g -DSQUAWK_64=false -ffloat-store -DPLATFORM_BIG_ENDIAN=false -DPLATFORM_UNALIGNED_LOADS=false -DWRITE_BARRIER -DLISP2_BITMAP -I/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/include -I/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/include -Ivmcore/src/vm/fp -Ivmcore/src/rts/gcc-macosx -o vmcore/build/squawk.o vmcore/src/vm/squawk.c) returned 1

I modified bytecodes.c.spp

3204d3203
< /*JUERGEN*/ int opcode = -1;
3271d3269
< /*JUERGEN*/ int opcode = -1;
3487d3484
< /*JUERGEN*/ int opcode = -1;
5416d5412
< /*JUERGEN*/ int opcode = -1;

that allows the compile to succeed.

Tools: Xcode 3.0, checkout version 54

eric_arseneau
Offline
Joined: 2004-07-15
Points: 0

I believe this comes from a generated file.

Can you try the following:
d copyphone
d
d rom cldc

- d copyphoneme only needs to be done once for every fresh pull of Squawk source
- d will compile all modules
- d rom cldc will build Squawk and a bootstrap suite containing the CLDC core classes

If this is indeed the steps you followed then something weird is going on. Please let me know.

turon
Offline
Joined: 2008-02-22
Points: 0

Hi Eric,

I've been able to get some success building straight out of svn (rev 52) on an Mac OS 10.5 i86:

./d clean
./d copyphoneme
./d builder
./d
./d -nocomp rom -strip:a cldc

But then there is no squawk.exe to run the test command:

squawk com.sun.squawk.Test

where does the squawk runtime binary live? Is there an equivalent to `make install` in your `d` build system?

Finally, I get the same "opcode" undeclared in bytecodes.c error described above if I run:

./d rom cldc

Thanks,
Martin

eric_arseneau
Offline
Joined: 2004-07-15
Points: 0

You are using the -nocomp option which will not create the exe, remove the -nocomp and the strip:a is not necessary just to get it working.

Unfortunately for now, the exe is created in the root of your tree, so in the same location as the d script. So once you do the d rom cldc, you can type squawk com.sun.squawk.Test.

The opcode error should not be happening, so I am not sure what is going on there. Please let us know if the problem persists after you do a d rom cldc.

d rom is the equivalent of make install for the vm.

turon
Offline
Joined: 2008-02-22
Points: 0

Hi Eric,

You missed the portion of my message that said I get the same error as the other MacBook Pro user when running your suggested build command:

./d rom cldc

In file included from vmcore/src/vm/squawk.c:524:
vmcore/src/vm/bytecodes.c: In function ‘extendStack’:
vmcore/src/vm/bytecodes.c:3249: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c:3249: error: (Each undeclared identifier is reported only once
vmcore/src/vm/bytecodes.c:3249: error: for each function it appears in.)
vmcore/src/vm/bytecodes.c: In function ‘checkReferenceSlots’:
vmcore/src/vm/bytecodes.c:3293: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c: In function ‘invokenativemain’:
vmcore/src/vm/bytecodes.c:3554: error: ‘opcode’ undeclared (first use in this function)
vmcore/src/vm/bytecodes.c: In function ‘do_throw’:
vmcore/src/vm/bytecodes.c:5414: error: ‘opcode’ undeclared (first use in this function)
build failed: Process.exec(gcc -c -DTRACE -DASSUME -DNATIVE_VERIFICATION=true -D_GNU_SOURCE -g -DS

What tool auto-generates the bytecodes.c file?

I tried building on Cygwin and Fedora too, and have had even graver problems. The OSX-i86 build seems close however, and since that is what you use, seems like the best shot of getting going.

I updated svn, and am now on rev 56.

Thanks!

derek_white
Offline
Joined: 2006-09-08
Points: 0

Hi,

I ran across the same bug yesterday, but didn't check in the fix until now.

The bug had to do with building without the -mac option. -mac creates the interpreter loop as one giant function and a bunch of macros. When you don't specify -mac many bytecodes are implemented as function calls. For SPOT we typically build "-prod -mac -o2".

In any case, I broke this in svn 51, Fixed in svn 57.

eric_arseneau
Offline
Joined: 2004-07-15
Points: 0

Which version of Max OS X ? Intel, PPC ? 10.4, 10.5 ?

I build on Mac OS X Intel 10.5 everyday as my main work environment, so its the one I know should work at all times :)

Did you install the Developer tools from Apple ? http://developer.apple.com/tools/download/ ?

metebalci
Offline
Joined: 2007-02-07
Points: 0

OK, then I am lucky comparing to linux and windows people :) Sorry, I forgot to mention about my host platform. It is Mac OS X 10.5 Intel with Xcode 3.0. I am using JAVA_HOME=/Library/Java/Home and BUILDER_FLAGS='-info -verbose' and run ./d.sh on console.

Mete

eric_arseneau
Offline
Joined: 2004-07-15
Points: 0

I dont have JAVA_HOME nor BUILDER_FLAGS set to anything.

Just a straight ./d should work and give you a working Squawk. Remove the variables you have set and let me know what the output looks like and we can compare.

If the number of people building keeps up it may make sense to have an IRC channel opened to have these discussions more rapidly than polling RSS feeds on this forum :)

metebalci
Offline
Joined: 2007-02-07
Points: 0

It doesnt change anything to have JAVA_HOME set or unset for me, I have the same errors. Eric, I can trace build process if you tell me the candidate classes for problem. I have tried to trace it is not hard to figure out but it is not very straightforward, so if you help me a little, I can figure out where and what happens.

I strongly agree, IRC or any kind of IM would be very helpful :)