0

I'm trying to build a standard program in tinyos. The Makefile looks like this:

COMPONENT=TestSerialAppC
BUILD_EXTRA_DEPS += TestSerial.class
CLEAN_EXTRA = *.class TestSerialMsg.java

CFLAGS += -I$(TOSDIR)/lib/T2Hack

TestSerial.class: $(wildcard *.java) TestSerialMsg.java
javac -target 1.4 -source 1.4 *.java

TestSerialMsg.java:
mig java -target=null $(CFLAGS) -java-classname=TestSerialMsg 
TestSerial.h test_serial_msg -o $@

include $(MAKERULES)

And when I make it, there is error:

In file included from /usr/lib/ncc/deputy_nodeputy.h:4:
/usr/lib/gcc/i686-linux-gnu/5/include/stddef.h:429: requested alignment 
is not a power of 2
failed to parse message file TestSerial.h
Makefile:11: recipe for target 'TestSerialMsg.java' failed
make: *** [TestSerialMsg.java] Error 1

I have no idea why this happened and how I can solve it. Is this a problem of gcc or a problem of java?

Edit: When I execute those commands in command line, I found the problem resides in:

mig java -target=null -I$(TOSDIR)/lib/T2Hack -java-classname=TestSerialMsg 
TestSerial.h test_serial_msg -o TestSerialMsg.java

mig is a message interface generator for nesC. And I think it is because I use a wrong version of gcc while calling mig.

Owen
  • 57
  • 3
  • 11
  • Not a java person (and have no clue what `mig` is...), but you're passing `$(CFLAGS)` and `TestSerial.h` into the java, which seems odd to me. Did you want o pass in `TestSerial.class`? – HardcoreHenry Dec 18 '17 at 14:43
  • What happens when you try these commands on the command line (without Make)? – Beta Dec 18 '17 at 17:50
  • @HardcoreHenry In fact I don't know much about `make` and don't know what it is doing exactly. I'm just following a get-started tutorial of tinyos. This makefile is provided by them and I think it is correct. – Owen Dec 19 '17 at 05:05
  • @Beta I don't understand. Do you mean type every line of makefile in command line? – Owen Dec 19 '17 at 05:09
  • You don't have any `@` prefixes on your recipes, so when you run make, it should echo the commands it is executing to the screen. What @Beta is suggesting is you cut and paste those an run those directly from your shell instead of running them through make. It might also help to paste those commands here in this question. You might also want to look at what's at stddef.h, line 429. – HardcoreHenry Dec 19 '17 at 14:11
  • @HardcoreHenry By following this the problem is clear and I edited the question. However, I still don't know how to fix it.. – Owen Dec 19 '17 at 17:04
  • You are showing the command that are listed in the Makefile recipe rather than the output of make when it's running that command (it should output a complete command where `$(CFLAGS)`, etc are expanded in stdout). The idea is to take that command, and run it verbatim on the bash command prompt.... – HardcoreHenry Dec 19 '17 at 18:38

0 Answers0