Recently I started working on a project in IoT, using contiki-ng.
The problem I faced is when I tried to run cooja with:
$ ant run
under ~/contiki-ng/tools/cooja
.
the build failed
$ ant run
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Buildfile: /home/user/contiki-ng/tools/cooja/build.xml
init:
compile:
copy configs:
jar_cooja:
[jar] Building jar: /home/user/contiki-ng/tools/cooja/dist/cooja.jar
jar:
init:
compile:
jar:
init:
mspsim:
init:
compile:
jar:
coffee:
init:
compile:
[javac] Compiling 8 source files to /home/user/contiki-ng/tools/cooja/tools/coffee-manager/build
[javac] Note: /home/user/contiki-ng/tools/cooja/tools/coffee-manager/org/contikios/coffee/CoffeeConfiguration.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
configs:
jar:
[jar] Building jar: /home/user/contiki-ng/tools/cooja/tools/coffee-manager/coffee.jar
[copy] Copying 1 file to /home/user/contiki-ng/tools/cooja/apps/mspsim/lib
compile:
copy:
jar:
init:
compile:
jar:
init:
clean:
[delete] Deleting directory /home/user/contiki-ng/tools/cooja/apps/serial_socket/build
BUILD FAILED
/home/user/contiki-ng/tools/cooja/build.xml:200: The following error occurred while executing this line:
/home/user/contiki-ng/tools/cooja/apps/serial_socket/build.xml:23: Unable to delete file /home/user/contiki-ng/tools/cooja/apps/serial_socket/build/org/contikios/cooja/serialsocket/SerialSocketClient$5.class
Total time: 2 seconds
I tried using $ sudo ant run
, and it started working as it should, without a problem.
.
.
$ ant run -verbose 2>> log;cat log
gives:
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
BUILD FAILED
/home/user/contiki-ng/tools/cooja/build.xml:200: The following error occurred while executing this line:
/home/user/contiki-ng/tools/cooja/apps/serial_socket/build.xml:23: Unable to delete file /home/user/contiki-ng/tools/cooja/apps/serial_socket/build/org/contikios/cooja/serialsocket/SerialSocketClient$5.class
at org.apache.tools.ant.taskdefs.Delete.handle(Delete.java:775)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:822)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:818)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:818)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:818)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:818)
at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:641)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.Main.runBuild(Main.java:818)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Total time: 2 seconds
I solved the problem, first by checking the
build.xml
, the section whererun
is defined :and you can see that its depends on
jar
.so checking the
jar
section :I can see that it try to manipulate the
./apps/serail_socket
but it failed. so I checked then the owner and the right permission of those directories:The owner was
root
and not the normal user. maybe I ran the :git submodule update --init --recursive
command by mistake withsudo
or something. so I changed the owner of those files and directories :sudo chown -h -R user ./apps/serail_socket ./apps/powertracker
And then its worked as it should.