tinyos / tinyos-main

Main development repository for TinyOS (an OS for embedded, wireless devices).
1.41k stars 518 forks source link

Blink Example - Undefined Symbol: __nesc_atomic_end #375

Closed ethantmcgee closed 8 years ago

ethantmcgee commented 8 years ago

When compiling tinyos and the blink example on Ubuntu 16.04, an error is received stating that TOSSIM cannot be imported due to an undefined symbol. Execution transcript below:

ethanmcgee@ubuntu:~/tinyos-main$ cd apps/Blink/
ethanmcgee@ubuntu:~/tinyos-main/apps/Blink$ PYTHON_VERSION=2.7 make micaz sim
[INFO] placing object files in simbuild/micaz
[INFO] writing XML schema to app.xml
[INFO] compiling BlinkAppC to object file sim.o
nescc -c -shared -fPIC -o simbuild/micaz/sim.o -g -O0 -gcc=gcc -Wnesc-all -fnesc-include=tos -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask -fnesc-cfile=simbuild/micaz/app.c -fnesc-separator=__ -DTOSSIM -fnesc-nido-tosnodes=1000 -fnesc-simulate -fnesc-nido-motenumber=sim_node\(\) -fnesc-gcc=gcc -I../../tos/lib/tossim -I../../tos/platforms/micaz/sim -I../../tos/platforms/micaz -I../../tos/platforms/mica/sim -I../../tos/platforms/mica -I../../tos/platforms/micaz/chips/cc2420/sim -I../../tos/platforms/micaz/chips/cc2420 -I../../tos/chips/cc2420/sim -I../../tos/chips/cc2420 -I../../tos/chips/cc2420/alarm -I../../tos/chips/cc2420/control/sim -I../../tos/chips/cc2420/control -I../../tos/chips/cc2420/csma/sim -I../../tos/chips/cc2420/csma -I../../tos/chips/cc2420/interfaces/sim -I../../tos/chips/cc2420/interfaces -I../../tos/chips/cc2420/link/sim -I../../tos/chips/cc2420/link -I../../tos/chips/cc2420/lowpan/sim -I../../tos/chips/cc2420/lowpan -I../../tos/chips/cc2420/lpl -I../../tos/chips/cc2420/packet/sim -I../../tos/chips/cc2420/packet -I../../tos/chips/cc2420/receive/sim -I../../tos/chips/cc2420/receive -I../../tos/chips/cc2420/spi -I../../tos/chips/cc2420/transmit -I../../tos/chips/cc2420/unique/sim -I../../tos/chips/cc2420/unique -I../../tos/platforms/mica2/chips/at45db -I../../tos/platforms/mica/chips/at45db -I../../tos/chips/at45db -I../../tos/chips/atm128/sim -I../../tos/chips/atm128 -I../../tos/chips/atm128/adc -I../../tos/chips/atm128/pins/sim -I../../tos/chips/atm128/pins -I../../tos/chips/atm128/spi/sim -I../../tos/chips/atm128/spi -I../../tos/chips/atm128/timer/sim -I../../tos/chips/atm128/timer -I../../tos/lib/power -I../../tos/lib/timer -I../../tos/lib/serial -fnesc-no-debug -DPLATFORM_MICAZ -Wall -Wshadow -finline-limit=100000 -I../../tos/system -I../../tos/types -I../../tos/interfaces -I/usr/include/python2.7 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"ethanmcgee\" -DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xb6ed2784L -DIDENT_TIMESTAMP=0x5772a0b2L -DIDENT_UIDHASH=0x16437447L -Wno-nesc-data-race BlinkAppC.nc   -fnesc-dump=components -fnesc-dump=variables -fnesc-dump=constants -fnesc-dump=typedefs -fnesc-dump=interfacedefs -fnesc-dump=tags -fnesc-dumpfile=app.xml
../../tos/lib/tossim/sim_noise.c: In function ‘makeNoiseModel’:
../../tos/lib/tossim/sim_noise.c:440:78: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     dbg("Insert", "Setting history %i to be %i\n", (int)i, (int)noiseData[node_id].key[i]);
                                                                              ^
../../tos/lib/tossim/sim_noise.c: In function ‘sim_noise_gen’:
../../tos/lib/tossim/sim_noise.c:307:7: warning: variable ‘noiseIndex’ set but not used [-Wunused-but-set-variable]
   int noiseIndex = 0;
       ^
../../tos/lib/tossim/sim_lqi.c: At top level:
../../tos/chips/atm128/sim/atm128hardware.h:101:3: warning: ‘__nesc_disable_interrupt’ is static but used in inline function ‘__nesc_atomic_start’ which is not static
     __nesc_disable_interrupt();
   ^
[INFO] compiling Python support and C libraries into pytossim.o, tossim.o, and c-support.o
g++ -c  -shared -fPIC -o simbuild/micaz/pytossim.o -g -O0 -I/usr/include/python2.7 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"ethanmcgee\" -DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xb6ed2784L -DIDENT_TIMESTAMP=0x5772a0b2L -DIDENT_UIDHASH=0x16437447L  ../../tos/lib/tossim/tossim_wrap.cxx -I/include/python2.71+ -I../../tos/lib/tossim -DHAVE_CONFIG_H
../../tos/lib/tossim/tossim_wrap.cxx: In function ‘void SWIG_Python_AddErrorMsg(const char*)’:
../../tos/lib/tossim/tossim_wrap.cxx:880:42: warning: format not a string literal and no format arguments [-Wformat-security]
     PyErr_Format(PyExc_RuntimeError, mesg);
                                          ^
g++ -c  -shared -fPIC -o simbuild/micaz/tossim.o -g -O0 -I/usr/include/python2.7 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"ethanmcgee\" -DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xb6ed2784L -DIDENT_TIMESTAMP=0x5772a0b2L -DIDENT_UIDHASH=0x16437447L  ../../tos/lib/tossim/tossim.c -I/include/python2.71+ -I../../tos/lib/tossim
g++ -c  -shared -fPIC -o simbuild/micaz/c-support.o -g -O0 -I/usr/include/python2.7 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"ethanmcgee\" -DIDENT_HOSTNAME=\"ubuntu\" -DIDENT_USERHASH=0xb6ed2784L -DIDENT_TIMESTAMP=0x5772a0b2L -DIDENT_UIDHASH=0x16437447L  ../../tos/lib/tossim/hashtable.c -I/include/python2.71+ -I../../tos/lib/tossim
[INFO] linking into shared object ./_TOSSIMmodule.so
g++ -shared -fPIC  simbuild/micaz/pytossim.o simbuild/micaz/sim.o simbuild/micaz/tossim.o simbuild/micaz/c-support.o  -lstdc++ -o _TOSSIMmodule.so
[INFO] copying Python script interface TOSSIM.py from lib/tossim to local directory

[INFO] *** Successfully built micaz TOSSIM library.
ethanmcgee@ubuntu:~/tinyos-main/apps/Blink$ python 
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from TOSSIM import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "TOSSIM.py", line 7, in <module>
    import _TOSSIM
ImportError: ./_TOSSIMmodule.so: undefined symbol: __nesc_atomic_end
>>> 

Any ideas?

alexbeltran commented 8 years ago

I know this is closed, but in case anyone is looking here, the error is due to a newer version of GCC/G++ compilers. A temporary fix can be found at #373.