WARNING: Do not make "bak" directories within workspace

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
JasonWhiteman
Active Member
Posts: 63
Joined: Mon Jul 15, 2013 11:39 pm

WARNING: Do not make "bak" directories within workspace

Post by JasonWhiteman »

Forum,

Maybe this will save someone down the line. My goal was to fork off a new attempt at some code. I didn't want to lose my old code. Normally, I would #ifdef new vs. old code. However, there are times when the #ifdef method becomes too obtrusive if there are lots of "surgical" changes (large count, distributed within source). Times like this, I like to employ the poor-man's revision control by creating a "bak" directory (or bak_mmddyy directory) to give me breadcrumbs back to the old/working method(s).

If you do this and use the tutorial makefiles within the IDE - beware. The makefiles are setup to scarf anything in the sub-directories of your workspace. Since I had my main.xc file in a bak directory, the compiler had duplicate mains, pars, etc... All of which blew up in a pretty obvious way.

During the compile stage, I saw two console messages:

"Compiling main.xc"
"Compiling main.xc"

That was clue enough to quickly fix the problem. I turned on verbose messages in the Makefile (VERBOSE=1) which now shows full path for everything.

This line stuck out (among others):

-DCONFIG=Debug "../src/bak/main.xc" ".././src/XK-SK-L2.xn" -o "../.build_Debug/src/bak/main.xc.o"
../src/bak/main.xc: In function `main': [error message not copied]

My fix is going to copy the backup somewhere else. The purists would probably have me setup a better revision control system.

Hope this helps someone who finds themself in a similar situation.

And for the search engines, a few more keywords from the error console that should be generic save the offsets:

../src/bak/main.xc:(.netinfo+0x3a): Error: Multiple definition of 'main.parinfo'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0xa): Error: Multiple definition of 'clock_thread.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1): Error: Multiple definition of 'clock_thread.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of 'clock_thread.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of 'clock_thread.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x4): Error: Multiple definition of 'chartohex.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1): Error: Multiple definition of 'chartohex.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of 'chartohex.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of 'chartohex.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_0.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_0.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_0.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_0.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_1.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_1.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_1.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_1.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_2.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_2.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_2.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_2.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_3.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_3.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_3.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_3.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_4.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_4.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_4.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_4.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_5.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_5.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_5.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_5.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_6.nstackwords'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_6.maxcores'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_6.maxtimers'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x0): Error: Multiple definition of '__main_xm_6.maxchanends'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1a66): Error: Multiple definition of '__main_xm_0'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1a9c): Error: Multiple definition of '__main_xm_1'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1ad2): Error: Multiple definition of '__main_xm_2'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1b54): Error: Multiple definition of '__main_xm_4'
../src/main.xc: Error: first defined here
../src/bak/main.xc:(SHN_ABS+0x1b62): Error: Multiple definition of '__main_xm_5'

Regards,
Jason Whiteman


TjBordelon
Active Member
Posts: 39
Joined: Mon Jul 29, 2013 4:41 pm

Post by TjBordelon »

I got burned by this one too. Same goes for renaming files to temporarily save a "working state" copy before you do some code mangling. I'm not a fan of this, and miss the days where you had to explicitly drop files in the project.