This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

makefile rules for invoking the linker

I refer to the makefile rule for invoking the linker in the top level makefile generated by CCS, that is <workspace>\<project>\<build configuration>\makefile

I have noticed that sometimes this rule creates a command file that is passed to the linker (ccsLinker.opt), and sometimes it passes the list of object files directly on the command line. Change most likely seems to occur when fresh copies of the project are checked out from revision control as a new CCS project, depending exactly on how the new project is set up.

With a sizeable project (a 100 or so object files) the linker fails if the object files are directly on the command line, with varying failure modes. I suspect the line length. It does not fail with the command file.

I'm running CCS Version: 5.2.0.00069, under windows 7 with v4.4.1 of the compiler tool chain

This project has been migrated from CCSv4 and ccsv5.1. I have had 4.3.9 and 4.4.0 compilers installed at different times.

Which is the preferred and supported method for invoking the linker and what determines which makefile rule is generated?

  • Hi John,

    John Fisher said:
    I have noticed that sometimes this rule creates a command file that is passed to the linker (ccsLinker.opt), and sometimes it passes the list of object files directly on the command line.

    It will use that ccsLinker.opt file if the list of linker options exceeds a certain length. As you observed below:

    John Fisher said:
    With a sizeable project (a 100 or so object files) the linker fails if the object files are directly on the command line, with varying failure modes. I suspect the line length. It does not fail with the command file.

    It is an OS limitation. Hence we workaround it with the opt file.

    My question is how you got the failure regarding the line length. CCS should have handled this for you. Did you get it calling the linker directly yourself?

    Thanks

    ki

  • I don't call the linker directly myself. What I observed was that sometimes CCS generates a makefile that does not use ccsLinker.opt for projects when it should be because of the large number of object files.

    I wasn't able to create a minimal test case or identify when exactly it does this. I'll post further if I find out more.

    I have been on leave the last 3 weeks, hence the slow reply.

  • I haven't observed this again, none of my colleagues have observed it. It happened to me on two occasions several months apart.

  • I've figured out what I was doing that led to this problem.

    To reproduce this problem, just open a big project with 100 or so object files that uses the default builder and generates makefiles automatically.

    Manually delete the entire output directory containing the generated makefiles, object files and linker output.

    CCS will automatically re-create the output directory.

    Rebuild

    The makefiles will be generated without using ccsLinker.opt, the OS line length will be exceeded and the build will fail.

    The project can be recovered by using clean project and rebuilding.

    Clean project doesn't delete loads of stuff that accumulates in the output directory. Have I found a bug, or is deleting the output directory simply not a valid thing to do?

  • This happens every time for me if I import a large project into a new workspace. The workaround is simple, build the project a second time after it fails the first time. Do not clean the project between the first build attempt and the second or rebuild, simply build twice. I'm still using the same tools as I was when I posted 3 years ago. Probably this has been fixed long ago.