I would suggest examining the difference between:
- the commands executed by gcc when things work (run with gcc -v)
- the commands executed by ncc (as seen below)

Specifically, try things like:
- checking that the compilers you expect (gcc versions, etc) are being run
- examine the differences in arguments (see the man pages, etc)
- try running the commands explicitly, and check what's happening

(in other words, I can't magicallty find/fix your problem just by
looking at some -v output, but you should be able to as you can try
things...)


running each of the commands separt
 what happens when you do your regular gcc compile (that works, pass
-v to see exactly what it's doing) and the commands

On 9/26/07, Chan kenniel <[EMAIL PROTECTED]> wrote:
>
>
> ---------- Forwarded message ----------
> From: Enrique <[EMAIL PROTECTED]>
> Date: Sep 27, 2007 3:07 AM
> Subject: Re: Compile problem
> To: Chan kenniel <[EMAIL PROTECTED]>
>
> Dear David,
>
> I've tried making a regular c file which simply calls the external functions
> with dummy parameters and it worked. At least there were no errors during
> compilation and linking stages, using ncc, and a executable file was
> generated. As simply as:
>
> ncc test.c MYLIB.o -o test.exe
>
>
> I put -v there, but there was nothing special. The result is like:
> --------------------------------------------------------------------------------------------------------------------------------
> /usr/local/bin/nescc -DPLATFORM_PC -DBOARD_MICASB -fnesc-include=tos
> -topdir=/opt/tinyos-1.x -o build/pc/main.exe MYLIB.o -g -O0 -pthread
> -fnesc-nido-tosnodes=1000 -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all
> -fnesc-cfile=build/pc/app.c -DIDENT_PROGRAM_NAME=Blink
> -DIDENT_PROGRAM_NAME_BYTES=66,108,105,110,107,0
> -DIDENT_USER_ID=admin
> -DIDENT_USER_ID_BYTES=97,100,109,105,110,0
> -DIDENT_HOSTNAME=c430pc2
> -DIDENT_HOSTNAME_BYTES=99,52,51,48,112,99,50,0
> -DIDENT_USER_HASH=0x43d304f7L -DIDENT_UNIX_TIME=0x46faac4cL Blink.nc -lm -v
> -fnesc-target=pc -I/opt/tinyos-1.x/tos/sensorboards/micasb
> -I/opt/tinyos-1.x/tos/platform/pc -I/opt/tinyos- 1.x/tos/interfaces
> -I/opt/tinyos-1.x/tos/types -I/opt/tinyos-1.x/tos/system
> gcc -specs=/usr/local/lib/ncc/tdspecs -DPLATFORM_PC
> -DBOARD_MICASB -_fnesc-include=tos -o build/pc/main.exe MYLIB.o -g -O0
> -pthread -_fnesc-nido-tosnodes=1000 -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d
> -_Wnesc-all -_fnesc-cfile=build/pc/app.c -DIDENT_PROGRAM_NAME=Blink
> -DIDENT_PROGRAM_NAME_BYTES=66,108,105,110,107,0
> -DIDENT_USER_ID=admin
> -DIDENT_USER_ID_BYTES=97,100,109,105,110,0
> -DIDENT_HOSTNAME=c430pc2
> -DIDENT_HOSTNAME_BYTES=99,52,51,48,112,99,50,0
> -DIDENT_USER_HASH=0x43d304f7L -DIDENT_UNIX_TIME=0x46faac4cL Blink.nc -lm -v
> -_fnesc-target=pc -I/opt/tinyos-1.x/tos/sensorboards/micasb
> -I/opt/tinyos-1.x/tos/platform/pc -I/opt/tinyos- 1.x/tos/interfaces
> -I/opt/tinyos-1.x/tos/types -I/opt/tinyos-1.x/tos/system -DNESC=112
> Reading specs from
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
> Reading specs from /usr/local/lib/ncc/tdspecs
> Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
> --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
> --mandir=/usr/share/man --infodir=/usr/share/info
> --enable-languages=c,ada,c++,d,f77,java,objc,pascal
> --enable-nls --without-included-gettext --enable-libgcj --with-system-zlib
> --enable-interpreter --enable-threads=posix --enable-java-gc=boehm
> --enable-sjlj-exceptions
> --disable-version-specific-runtime-libs
> --disable-win32-registry
> Thread model: posix
> gcc version 3.3.3 (cygwin special)
>  perl -S nesc-compile -_fnesc-include=tos -_fnesc-nido-tosnodes=1000
> -_Wnesc-all -_fnesc-cfile=build/pc/app.c -_fnesc-target=pc -DPLATFORM_PC
> -DBOARD_MICASB -DDEF_TOS_AM_GROUP=0x7d -DIDENT_PROGRAM_NAME=Blink
> -DIDENT_PROGRAM_NAME_BYTES=66,108,105,110,107,0
> -DIDENT_USER_ID=admin
> -DIDENT_USER_ID_BYTES=97,100,109,105,110,0
> -DIDENT_HOSTNAME=c430pc2
> -DIDENT_HOSTNAME_BYTES=99,52,51,48,112,99,50,0
> -DIDENT_USER_HASH=0x43d304f7L -DIDENT_UNIX_TIME=0x46faac4cL -DNESC=112
> -I/opt/tinyos- 1.x/tos/sensorboards/micasb -I/opt/tinyos-1.x/tos/platform/pc
> -I/opt/tinyos-1.x/tos/interfaces -I/opt/tinyos-1.x/tos/types
> -I/opt/tinyos-1.x/tos/system -g -O0 -Wall -Wshadow -v -pthread -o
> /tmp/ccSNzP9T.o Blink.nc
> nesc1 -_fnesc-include=tos -_fnesc-nido-tosnodes=1000 -_Wnesc-all
> -_fnesc-target=pc -DPLATFORM_PC -DBOARD_MICASB -DDEF_TOS_AM_GROUP=0x7d
> -DIDENT_PROGRAM_NAME=Blink
> -DIDENT_PROGRAM_NAME_BYTES=66,108,105,110,107,0
> -DIDENT_USER_ID=admin
> -DIDENT_USER_ID_BYTES=97,100,109,105,110,0
> -DIDENT_HOSTNAME=c430pc2
> -DIDENT_HOSTNAME_BYTES=99,52,51,48,112,99,50,0
> -DIDENT_USER_HASH=0x43d304f7L -DIDENT_UNIX_TIME=0x46faac4cL -DNESC=112
> -I/opt/tinyos- 1.x/tos/sensorboards/micasb -I/opt/tinyos-1.x/tos/platform/pc
> -I/opt/tinyos-1.x/tos/interfaces -I/opt/tinyos-1.x/tos/types
> -I/opt/tinyos-1.x/tos/system -Wall -Wshadow -v -pthread Blink.nc -o
> build/pc/app.c
> preprocessing /opt/tinyos-1.x/tos/system/tos.h
> preprocessing Blink.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/Main.nc
> preprocessing /opt/tinyos-1.x/tos/types/AM.h
> preprocessing /opt/tinyos- 1.x/tos/platform/pc/PCRadio.h
> preprocessing /opt/tinyos-1.x/tos/interfaces/StdControl.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/Nido.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/nido.h
> preprocessing /opt/tinyos- 1.x/tos/interfaces/ReceiveMsg.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/Pot.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/PowerState.nc
> preprocessing /opt/tinyos- 1.x/tos/system/PotC.nc
> preprocessing /opt/tinyos-1.x/tos/system/PotM.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/HPLPot.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/HPLPotC.nc
> preprocessing /opt/tinyos- 1.x/tos/platform/pc/PowerStateM.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/powermod.h
> preprocessing
> /opt/tinyos-1.x/tos/sensorboards/micasb/sensorboard.h
> preprocessing BlinkM.nc
> preprocessing mylib.h
>  preprocessing /opt/tinyos-1.x/tos/interfaces/Timer.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/Timer.h
> preprocessing /opt/tinyos-1.x/tos/interfaces/Leds.nc
> preprocessing SingleTimer.nc
> preprocessing /opt/tinyos- 1.x/tos/platform/pc/TimerC.nc
> preprocessing /opt/tinyos-1.x/tos/system/TimerM.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/Clock.nc
> preprocessing /opt/tinyos-1.x/tos/interfaces/Clock.h
> preprocessing /opt/tinyos-
> 1.x/tos/interfaces/PowerManagement.nc
> preprocessing /opt/tinyos-1.x/tos/system/ClockC.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/HPLClock.nc
> preprocessing /opt/tinyos-1.x/tos/system/NoLeds.nc
> preprocessing /opt/tinyos-
> 1.x/tos/platform/pc/HPLPowerManagementM.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/LedsC.nc
> preprocessing /opt/tinyos-1.x/tos/platform/pc/LedsM.nc
> gcc -B/usr/local/lib/ncc -g -O0 -Wall -Wshadow -v -pthread -o
> /tmp/ccSNzP9T.o -c -fdollars-in-identifiers build/pc/app.c
> Reading specs from
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
> gcc: unrecognized option `-pthread'
> Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
> --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
> --mandir=/usr/share/man --infodir=/usr/share/info
> --enable-languages=c,ada,c++,d,f77,java,objc,pascal
> --enable-nls --without-included-gettext --enable-libgcj --with-system-zlib
> --enable-interpreter --enable-threads=posix --enable-java-gc=boehm
> --enable-sjlj-exceptions
> --disable-version-specific-runtime-libs
> --disable-win32-registry
> Thread model: posix
> gcc version 3.3.3 (cygwin special)
>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1.exe -quiet -v
> -isystem /usr/local/lib/ncc/include -D__GNUC__=3 -D__GNUC_MINOR__=3
> -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__
> -D__unix -idirafter
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api
> -idirafter
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api
> build/pc/app.c -quiet -dumpbase app.c -auxbase-strip /tmp/ccSNzP9T.o -g -O0
> -Wall -Wshadow -version -fdollars-in-identifiers -o /tmp/ccFUyWYq.s
> ignoring nonexistent directory "/usr/local/lib/ncc/include"
> GNU C version 3.3.3 (cygwin special) (i686-pc-cygwin)
>     compiled by GNU C version 3.3.3 (cygwin special).
> GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32641
> ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
> ignoring duplicate directory
> "/usr/i686-pc-cygwin/lib/../../include/w32api"
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/local/include
>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
>  /usr/include
>  /usr/include/w32api
> End of search list.
> C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/pc/PowerStateM.nc:
> In function `__nesc_nido_initialise':
> C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/pc/PowerStateM.nc:478:
> warning: passing arg 1 of `memset' discards qualifiers from pointer target
> type
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/as.exe
> --traditional-format -o /tmp/ccSNzP9T.o /tmp/ccFUyWYq.s
>  /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/collect2.exe
> -Bdynamic --dll-search-prefix=cyg -o build/pc/main.exe
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../crt0.o
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtbegin.o
> -L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3
> -L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../.. MYLIB.o
> /tmp/ccSNzP9T.o -lm -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32
> -lgcc /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtend.o
> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:
> MYLIB.o: Relocations in generic ELF (EM: 83)
> MYLIB.o: could not read symbols: File in wrong format
> collect2: ld returned 1 exit status
> make: *** [exe0] Error 1
>
>
> 2007/9/27, Chan kenniel < [EMAIL PROTECTED]>:
>
> >
> >
> > ---------- Forwarded message ----------
> > From: David Gay <[EMAIL PROTECTED]>
> > Date: Sep 27, 2007 12:16 AM
> > Subject: Re: Compile problem
> > To: Chan kenniel <[EMAIL PROTECTED]>
> > Cc: tinyos forum < tinyos-help@millennium.berkeley.edu >
> >
> > On 9/26/07, Chan kenniel <[EMAIL PROTECTED]> wrote:
> > > Dear David,
> > >
> > > I tried what you said and I changed the rules for pc compilation. But
> some
> > > mistake showed up. Something like:
> > > mkdir -p build/pc
> > >
> > > compiling Blink to a pc binary
> > >
> > > ncc -o build/pc/main.exe MYLIB.o -g -O0 -pthread
> -fnesc-nido-tosnodes=1000
> > > -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=pc
> > > -fnesc-cfile=build/pc/app.c -board=micasb -DIDENT_PROGRAM_NAME="Blink"
> > > -DIDENT_PROGRAM_NAME_BYTES="66
> > > ,108,105,110,107,0" -DIDENT_USER_ID="admin"
> > > -DIDENT_USER_ID_BYTES="97,100,109,105,110,0"
> > > -DIDENT_HOSTNAME="c430pc2"
> > > -DIDENT_HOSTNAME_BYTES="99,52,51,48,112,99,50,0"
> > > -DIDENT_USER_HASH=0x43d304f7L -DIDENT_UNIX_TIME=0x46fa5102L Blink.nc -lm
> > >
> > > gcc: unrecognized option
> > >
> `-pthread'C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/pc/PowerStateM.nc:
> > > In
> > >
> function`__nesc_nido_initialise':C:/PROGRA~1/UCB/cygwin/opt/tinyos-
> > > 1.x/tos/platform/pc/PowerStateM.nc:478: warning:
> passing
> > > arg 1 of `memset' discards qualifiers from pointer target
> > >
> type/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:
> > > MYLIB.o: Relocations in generic ELF (EM: 83)
> > > MYLIB.o: could not read symbols: File in wrong format
> > > collect2: ld returned 1 exit status
> > > make: *** [exe0] Error 1
>
> -----------------------------------------------------------------------------------------------------
> Where is the information that helps out of the 'wrong format'?
> Thank you.
>
> > It's not liking your mylib.o file. Try:
> > - linking a regular C file with mylib.o to see if mylib.o actually works
> > - pass -v to ncc to see exactly what commands are being executed, and
> > try and track down what's going wrong
> >
> > David Gay
> >
> >
> > --
> > Best wishes,
> > Kenneth Chan
> >
> > ------------------------
> > Wish you have a good day!
>
>
>
> --
> Best wishes,
> Kenneth Chan
>
> ------------------------
> Wish you have a good day!
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to