Haxe: Crash when build to android target - java

I am new to Haxe. Today I install it by reading the instructions in the http://www.haxenme.org;
and download the "Acurate Example".
I run the example with FalshDevelop, when I build it to flash(nme test "Acurate Example.nmml" flash), it goes well!
But when I use nme test "Acurate Example.nmml" android, it crashes!!
I have setting the android variables ok.
Please help me, thanks in advance!
PS: Errors here:
C:\Documents and Settings\Neusoft\桌面\11yue\HaXe\Demos\Actuate_Example>nme test
"Actuate Example.nmml" android
haxelib run hxcpp Build.xml haxe -Dactuate -Dandroid -Dcpp -Dhaxe_208 -Dmobile -
Dnme -Dnme_install_tool -Dtrue
mkdir obj/android
mkdir obj/android/src
mkdir obj/android/src/nme
mkdir obj/android/src/nme/display
mkdir obj/android/src/nme/events
mkdir obj/android/src/nme/geom
mkdir obj/android/src/nme/text
mkdir obj/android/src/nme/errors
mkdir obj/android/src/nme/utils
mkdir obj/android/src/com
mkdir obj/android/src/com/eclecticdesignstudio
mkdir obj/android/src/com/eclecticdesignstudio/motion
mkdir obj/android/src/com/eclecticdesignstudio/motion/actuators
mkdir obj/android/src/haxe
mkdir obj/android/src/haxe/io
mkdir obj/android/src/nme/media
mkdir obj/android/src/cpp
mkdir obj/android/src/com/eclecticdesignstudio/motion/easing
mkdir obj/android/src/cpp/zip
mkdir obj/android/src/nme/filters
mkdir obj/android/src/cpp/rtti
mkdir obj/android/src/nme/net
mkdir obj/android/src/nme/installer
mkdir obj/android/src/cpp/io
mkdir obj/android/src/com/eclecticdesignstudio/motion/_Actuate
mkdir obj/android/src/cpp/io/_Process
mkdir obj/android/__pch
mkdir obj/android/__pch/haxe
Creating obj/android/__pch/haxe/hxcpp.h.gch...
arm-linux-androideabi-g++ -Iinclude --sysroot=D:/AndroidDev/android-ndk-r5/platf
orms/android-5/arch-arm -ID:/AndroidDev/android-ndk-r5/sources/cxx-stl/gnu-libst
dc++/4.4.3/include -ID:/AndroidDev/android-ndk-r5/sources/cxx-stl/gnu-libstdc++/
4.4.3/libs/armeabi/include -ID:\HaXe_ProgramFiles\Motion-Twin\haxe\lib\hxcpp\2,0
8,1//include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-ta
bles -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__A
RM_ARCH_5E__ -D__ARM_ARCH_5TE__ -D_LINUX_STDDEF_H -Wno-psabi -march=armv5te -mt
une=xscale -msoft-float -fomit-frame-pointer -fexceptions -fno-strict-aliasing -
finline-limit=10000 -DANDROID -Wa,--noexecstack -O2 -DNDEBUG -c -frtti -o obj/an
droid/__pch/haxe/hxcpp.h.gch D:\HaXe_ProgramFiles\Motion-Twin\haxe\lib\hxcpp\2,0
8,1//include/hxcpp.h
Called from ? line 1
Called from BuildTool.hx line 1342
Called from BuildTool.hx line 591
Called from BuildTool.hx line 626
Called from BuildTool.hx line 760
Called from BuildTool.hx line 791
Called from BuildTool.hx line 174
Uncaught exception - Error creating pch: 1 - build cancelled
Error : Build failed
And It popup a Error dialog with message:
cc1plus.exe-error;Application cannot normally initiate(0xc0000005).

Could you try testing the Pirate Pig sample, to see if that compiles alright?

Related

JNI make file is not working. Multiple definitions

So I am trying to make a jni library but the make file gives a strange error that I don't really understand.
/tmp/ccPWlMuy.o: In function `Java_GameLogic_setMap':
GameLogic.c:(.text+0x0): multiple definition of `Java_GameLogic_setMap'
/tmp/ccajmgva.o:GameLogic.c:(.text+0x0): first defined here
/tmp/ccPWlMuy.o: In function `Java_GameLogic_hello':
GameLogic.c:(.text+0x1c): multiple definition of `Java_GameLogic_hello'
/tmp/ccajmgva.o:GameLogic.c:(.text+0x1c): first defined here
collect2: ld returned 1 exit status
make: *** [GameLogic.o] Error 1
and the make file is:
# Define a variable for classpath
CLASS_PATH = .
# Define a virtual path for .class in the bin directory
vpath %.class $(CLASS_PATH)
all : libGameLogic.so
# $# matches the target, $< matches the first dependancy
libGameLogic.so : GameLogic.o
gcc -W1 -shared -o $# $<
# $# matches the target, $< matches the first dependancy
GameLogic.o : GameLogic.c GameLogic.h
gcc -fPIC -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include/linux -shared GameLogic.c -o libGameLogic.so Map.c GameLogic.c
GameLogic.h: GameLogic.class PlayGame.class Bot.class
javah -classpath $(CLASS_PATH) GameLogic
GameLogic.class: GameLogic.java
javac *.java
PlayGame.class: PlayGame.java
javac *.java
Bot.class: Bot.java
javac *.java
clean :
rm GameLogic.o libGameLogic.so
To run the make file I type in make into the terminal and this is the error that it creates. For this I need to have it so that JNI makes a c call which then calls a method in another c file.
So Java <-> JNI <-> GameLogic <-> Map
In that order.
Any advice is much appreciated many thanks.
gcc -fPIC -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include/linux -shared -o libGameLogic.so Map.c GameLogic.c
Map.h:7: warning: array ‘name’ assumed to have one element
Map.h:10: warning: array ‘map’ assumed to have one element
gcc -W1 -shared -o libGameLogic.so GameLogic.o
gcc: GameLogic.o: No such file or directory
gcc: no input files
make: *** [libGameLogic.so] Error 1
-bash-4.1$
You are compiling and linking GameLogic.c twice in this line:
# $# matches the target, $< matches the first dependancy
GameLogic.o : GameLogic.c GameLogic.h
gcc -fPIC -I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include
-I /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.38.x86_64/include/linux
-shared GameLogic.c -o libGameLogic.so Map.c GameLogic.c

run java project using .sh file in jenkins in mac

i want to run a java project in jenkins in mac.i have the following .sh file and its code is given below:
#!/bin/bash
echo $#
${jvmargs[#]}
DIR=$(dirname $0)
args=( "$#" )
javaProps=( )
server_jvmargs=( -Djava.awt.headless=true -Xms1024m -Xmx1024m"${jvmargs[#]}" )
XX_HOME="$DIR"
client_classpath="$XX_HOME/lib/others/*:$XX_HOME/lib/http/*:$XX_HOME/lib/selenium-java-2.37.0/*:$XX_HOME/lib/selenium-java-2.37.0/libs/*:$XX_HOME/lib/TestNG/*:$XX_HOME/lib/mailactivation/*:$XX_HOME/bin"
BIN_PATH="$XX_HOME/bin"
SRC_PATH="$XX_HOME/src"
rm -rfv "$BIN_PATH"
chmod 777 "$BIN_PATH"
mkdir -p "$BIN_PATH"
cd $DIR
javac \
-cp "$client_classpath" \
-d "$BIN_PATH" \
-sourcepath $SRC_PATH src/com/*.java
java \
"${server_jvmargs[#]}" \
"${javaProps[#]}" \
-Dxx.home="$XX_HOME" \
-Duser.dir="$XX_HOME" \
-cp "$client_classpath" \
org.testng.TestNG temp-testng-customsuite.xml
i set the custom workspace and use this run.sh file in build setup(Execute Shell). But it shows the following error:
Started by user Ali Azam JenkinTest
Building in workspace /Users/aliazam/Desktop/App/eclipse/workspace/Training
java.io.IOException: Failed to mkdirs: /Users/aliazam/Desktop/App/eclipse/workspace/Training
at hudson.FilePath.mkdirs(FilePath.java:1164)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1268)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild. java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
can anyone please help me to solve this problem????

Linking Exception when calling C++ function from inside source object (.so) file in java using JNA.

I am trying to access functions from a c++ .so file in java(JNA). I am able to call simple "Hello" type function from this .so file. But when I am trying to access other functions which internally calls functions from other files (.so file which is written in C), I am getting exception like:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/stpl/workspace/TestJNA/bin/libhello.so: undefined symbol: PInit
I am stuck in this. Any help will be appreciated.
Now my problem is solved.
In case anyone have the same problem, the problem was in .so file.
Below is the script for .mk file to create .so file.
CC=g++
CFLAG= -g -O0
PRNINC= -I ./Include -I ./PRT.IF -I./app
PRNLIBS= -lHWIGotPrinter -lcommon -lpthread -ldl
ASTYLE=astyle
ASTYLEFLAGS= --style=ansi -t -p -b -S -K
compiledate=$(shell date '+%F %T')
DEFS=-D DEFINE_MKDATE="\"$(compiledate)\""
INC_PUB= -I./Include -I./PRT.IF -I./SCANNER.IF -I ./Include
INCLUDE=$(INC_PUB)
%.o: %.cpp
$(CC) $(CFLAG) $(DEFS) -fPIC $(INCLUDE) -c $< -shared -o $#
%.o: %.c
$(CC) $(CFLAG) $(DEFS) -fPIC $(INCLUDE) -c $< -shared -o $#
.PHONY:all
all: PRN
HSCAN CDU UPS
PRNAPPS= bin/libprntest.so
PRN: $(PRNAPPS)
bin/libprntest.so: app/prn_proc.cpp app/prntest.cpp app/myCpp.cpp
$(CC) $(CFLAG) $(DEFS) $(PRNINC) $(PRNLIBS) $^ -shared -o $#
dist: all
mkdir -p insttest
rm -rf insttest/*
cp -a bin insttest/
cp -f Makefile inst/
tar -czf inst-$(MAJOR).$(MINOR).tgz insttest/
rm -rf insttest
install:
install -m 755 $(PRNAPPS) /usr/bin
cleanbak:
find . -name *.o |xargs rm -f
find . -name *~ |xargs rm -f
find . -name *.bak |xargs rm -f
find . -name *.orig |xargs rm -f
find . -name *.cpp |xargs chmod 644
find . -name .h |xargs chmod 644
chmod 644 ./etc-lib/gotlib.
clean:
find . -name *.o |xargs rm -f
find . -name *~ |xargs rm -f
find . -name *.bak |xargs rm -f
find . -name *.orig |xargs rm -f
find . -name *.cpp |xargs chmod 644
find . -name *.h |xargs chmod 644
rm -f $(PRNAPPS) $(SCANAPPS) $(HSCANAPPS) $(UPSAPPS) $(CDUAPPS) $(HARDWAREAPPS) $(CMOSAPPS) $(TOOLSAPPS)
help:
echo "make style "
echo "make cleanbak"
echo "make clean"
echo "make"
echo "make dist"
echo "make install"

Makefile run more than once

I'm trying to compile my Java code with this Makefile. How ever when I run make, it compiles the code more than once.
Makefile:
.PHONY: all clean run
SOURCES = \
Models/CustomException \
Models/Forest \
Models/ForestContainer \
Models/Owner \
Models/OwnerContainer \
Models/Tree
SRC = $(addprefix src/, $(addsuffix .java, $(SOURCES)))
BIN = $(addprefix bin/, $(addsuffix .class, $(SOURCES)))
all: ${BIN}
clean:
-rm -f ${BIN};
${BIN}: ${SRC}
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin ${SRC};
run: all
java -cp bin Program;
Output:
┌─( klim ) - ( ~/workspace/Forest-mvc )
└─> make
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
mkdir -p bin/Controllers;
mkdir -p bin/Models;
mkdir -p bin/Views;
javac -d bin src/Models/CustomException.java src/Models/Forest.java src/Models/ForestContainer.java src/Models/Owner.java src/Models/OwnerContainer.java src/Models/Tree.java;
As you can see it runs the commands more than once, actually 6 times. The number of times it run the commands increase/decrease as number of SOURCES are added/removed
How can this be?
just add the main classes after javac.
${BIN}: ${SRC}
javac -d bin -cp . Models/Tree.java
All the classes and the folders (packages) that depend of the main classes will be automatically compiled. Your make is compiling again and again some classes that have already been compiled.
The first target in your Makefile, all, depends on 6 different sub-targets. Presumably, at the beginning of the run, none of these exists, so make thinks it needs to build each of those 6 sub-targets. However, building any one of those sub-targets actually builds all 6 of them the way you have this defined - but make doesn't know that.
The bottom line is, it's doing what you told it to. The fact that what you told it to do is redundant doesn't matter to make.
For each target int ${BIN} make will invoke the ${BIN}: ${SRC} rule but you give it all the sources on the command line for javac. You probably want to replace the ${SRC} with $< on the javac line.

making DLL for JNI in Netbeans problem

I am trying to create a DLL to use it with Java JNI. I am using Netbeans C/C++ plugin to create the dll.
but after compile i am getting the following error (.o objects already created)
any idea? am i missing something?
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/c/projects/hdijni'
rm -f -r build/Debug
rm -f dist/Debug/MinGW-Windows/libhdijni.dll
make[1]: Leaving directory `/c/projects/hdijni'
CLEAN SUCCESSFUL (total time: 18s)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/projects/hdijni'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/libhdijni.dll
make[2]: Entering directory `/c/projects/hdijni'
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/ByteJNI.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include -MMD -MP -MF build/Debug/MinGW-Windows/src/ByteJNI.o.d -o build/Debug/MinGW-Windows/src/ByteJNI.o src/ByteJNI.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/HDIJNI.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include -MMD -MP -MF build/Debug/MinGW-Windows/src/HDIJNI.o.d -o build/Debug/MinGW-Windows/src/HDIJNI.o src/HDIJNI.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/common.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include -MMD -MP -MF build/Debug/MinGW-Windows/src/common.o.d -o build/Debug/MinGW-Windows/src/common.o src/common.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src
rm -f build/Debug/MinGW-Windows/src/Generic.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include -MMD -MP -MF build/Debug/MinGW-Windows/src/Generic.o.d -o build/Debug/MinGW-Windows/src/Generic.o src/Generic.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p build/Debug/MinGW-Windows/src/Windows
rm -f build/Debug/MinGW-Windows/src/Windows/win.o.d
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -c -g -Isrc/Windows -Isrc -I../../MinGW/jni/include/win32 -I../../MinGW/jni/include -MMD -MP -MF build/Debug/MinGW-Windows/src/Windows/win.o.d -o build/Debug/MinGW-Windows/src/Windows/win.o src/Windows/win.c
gcc.exe: --add-stdcall-alias: linker input file unused because linking not done
mkdir -p dist/Debug/MinGW-Windows
gcc.exe -mno-cygwin -Wl,--add-stdcall-alias -shared -m32 -shared -o dist/Debug/MinGW-Windows/libhdijni.dll build/Debug/MinGW-Windows/src/ByteJNI.o build/Debug/MinGW-Windows/src/HDIJNI.o build/Debug/MinGW-Windows/src/common.o build/Debug/MinGW-Windows/src/Generic.o build/Debug/MinGW-Windows/src/Windows/win.o
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `callRuntimePropertiesMethod':
C:/projects/hdijni/src/HDIJNI.c:142: multiple definition of `callRuntimePropertiesMethod'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:288: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `closeJVM':
C:/projects/hdijni/src/HDIJNI.c:192: multiple definition of `closeJVM'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:402: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getFailedCalls':
C:/projects/hdijni/src/HDIJNI.c:251: multiple definition of `getFailedCalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:800: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getJNIStatus':
C:/projects/hdijni/src/HDIJNI.c:266: multiple definition of `getJNIStatus'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:900: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getStrategyInfo':
C:/projects/hdijni/src/HDIJNI.c:282: multiple definition of `getStrategyInfo'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1090: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getSuccessfulCalls':
C:/projects/hdijni/src/HDIJNI.c:339: multiple definition of `getSuccessfulCalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1154: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getTotalDACalls':
C:/projects/hdijni/src/HDIJNI.c:354: multiple definition of `getTotalDACalls'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1169: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `getTotalDACallsFor':
C:/projects/hdijni/src/HDIJNI.c:375: multiple definition of `getTotalDACallsFor'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1190: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `initialiseJVM':
C:/projects/hdijni/src/HDIJNI.c:464: multiple definition of `initialiseJVM'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1229: first defined here
build/Debug/MinGW-Windows/src/HDIJNI.o: In function `loadStrategy':
C:/projects/hdijni/src/HDIJNI.c:836: multiple definition of `loadStrategy'
build/Debug/MinGW-Windows/src/ByteJNI.o:C:/projects/hdijni/src/ByteJNI.c:1907: first defined heremake[2]: Leaving directory `/c/projects/hdijni'
make[1]: Leaving directory `/c/projects/hdijni'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/libhdijni.dll] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
sorry guys,
it was duplicate methods problem. ;)
question closed.

Categories