Library problem : Two different include trees ?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
BeauWebber
Member++
Posts: 17
Joined: Thu Sep 27, 2012 11:41 pm

Library problem : Two different include trees ?

Post by BeauWebber »

Hi,
I am afraid I seem to have another library related problem.
I can now compile a library, and link a .c file using it, successfully.
However at link time I get complaints of differing definitions.

Both the library and the .c file appear to be pointing to
C:\Applications\XMOS\11.11.1\target\include
for their .h files.

But I get error messages :

Code: Select all

**** Build of configuration Debug for project Add_aplc ****

xmake CONFIG=Debug all 
"Updating eclipse config"
No modules used.
cd ./.build_Debug && xcc -target="XC-1A" -l aplc   ..\.\.build_Debug\src\add.c.o ..\.\.build_Debug\src\Add_aplc.xc.o   -o "..\bin\Debug\Add_aplc_Debug.xe"
../../../../../src/newlib/libc/syscalls/sysgettod.c: Error: Type of symbol gettimeofday has mismatch with previous definition:
../../../../../src/newlib/libc/syscalls/sysgettod.c: Error:   found:    signed int gettimeofday( struct timeval *, struct timezone * )
../src/runio.c: Error:   previous: signed int gettimeofday( struct timeval {...} *, void * )

../../../../../src/newlib/libc/syscalls/sysfcntl.c: Error: Type of symbol fcntl has mismatch with previous definition:
../../../../../src/newlib/libc/syscalls/sysfcntl.c: Error:   found:    signed int fcntl( signed int, signed int, signed int )
../src/runio.c: Error:   previous: signed int fcntl( signed int, signed int, ... )

../../../../../src/newlib/libc/syscalls/sysfcntl.c: Error: Type of symbol fcntl has mismatch with previous definition:
../../../../../src/newlib/libc/syscalls/sysfcntl.c: Error:   found:    signed int fcntl( signed int, signed int, signed int )
../src/runio_f.c: Error:   previous: signed int fcntl( signed int, signed int, ... )

../../../../../src/newlib/libc/syscalls/sysstat.c: Error: Type of symbol stat has mismatch with previous definition:
../../../../../src/newlib/libc/syscalls/sysstat.c: Error:   found:    signed int stat( unsigned char *, struct stat * )
../src/runio_f.c: Error:   previous: signed int stat( const unsigned char *, struct stat {...} * )

xmake[1]: *** [bin/Debug/Add_aplc_Debug.xe] Error 1
xmake: *** [bin/Debug/Add_aplc_Debug.xe] Error 2
I have no idea where ../../../../../src/newlib is, it does not appear to be a legal location on my D: drive. Part of my troubles seem to come from that I do not think the current working directory is actually set at the current project.

When I try using xmake using the XMOS shell, it seems to ignore the Makefile in the current project - it does not link to the library.

Is there an example script that I can use to define the necessary cross-assembler definitions, so that I can use a cygwin shell ?

Or even better, a set of scripts I can add to a ./configure script to make it cross-compile to an XMOS device (the XC-1A) ?

[Edit]
I have re-built both the library and the add program, this time on the C partition, in case D: was causing problems. I have tried to do identical things for both, and have still ended up with miss-matched definitions.

The system includes for both purport to be :

Code: Select all

C:\Applications\XMOS\11.11.1\target\include
C:\Applications\XMOS\11.11.1\target\include\c++\4.2.1
C:\Applications\XMOS\11.11.1\target\include\c++\4.2.1\xcore-xmos-elf
C:\Applications\XMOS\11.11.1\target\include\gcc
The only difference I can think of is that the library make uses :
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.library
and the add make uses
-include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common

Does anyone have any idea how to make both compiles use the same definitions ?

[Edit]
I have combined the add.c function with the library functions and still get the same problems when building ....
cheers,
Beau


User avatar
BeauWebber
Member++
Posts: 17
Joined: Thu Sep 27, 2012 11:41 pm

Post by BeauWebber »

BeauWebber wrote: I am afraid I seem to have another library related problem.
I can now compile a library, and link a .c file using it, successfully.
However at link time I get complaints of differing definitions.
Well I have not solved that, but I have bypassed it, by commenting out the code that was calling these library functions.

So I can now successfully compile Apl for the XMOS XC-1A module.
However I have effectively had to gut the multi-processing code that was in the Apl to c compiler. I how have to work to get it up and running again, to communicate between processors.

Anyway, for a very short test, of summing a vector :
Apl running in MicroApl's AplX :

Code: Select all

      V ← ⍳ 9
      ⎕ ← V
1 2 3 4 5 6 7 8 9
      S ← +/V
      ⎕ ← S
45
XMOS :
Translated to c and compiled and running on a single core of the XC-1A module :

Code: Select all

 1 2 3 4 5 6 7 8 9
 45
cheers,
Beau Webber