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.

Building CCS Project through Jenkins on Linux

Other Parts Discussed in Thread: TMS320F280049C

Hi,

I have a project using TMS320F280049C microcontroller built in CCSv1040. I am now trying to setup a Jenkins pipeline to set up a CI/CD server. I was originally having trouble building the project through Jenkins but changing the write rights on the folder resolved that issue. Now even though my project is building, the Jenkins build is failing because of this error:

"Unable to init server: Could not connect: Connection refused

Eclipse: Cannot open display:

Eclipse:

An error has occurred. See the log file"

Below you can see that the project is building without any errors:

16:55:59 + /home/cicdserver/ti/ccs1040/ccs/eclipse/eclipse -noSplash -data /home/cicdserver/workspaces/workspace_temp -application com.ti.ccstudio.apps.projectBuild -ccs.projects sw20200507 -ccs.configuration CPU1_FLASH -ccs.listErrors
16:56:04 
16:56:04 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16:56:04 CCS headless build starting... [Tue Dec 07 16:56:04 CET 2021] 
16:56:04 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16:56:04 
16:56:04 ================================================================================
16:56:04 Pre processing...
16:56:04 
16:56:04 
16:56:04 ================================================================================
16:56:04 Building...
16:56:04 
16:56:06 
16:56:06 **** Build of configuration CPU1_FLASH for project sw20200507 ****
16:56:06 
16:56:06 /home/cicdserver/ti/ccs1040/ccs/utils/bin/gmake -k -j 4 all -O 
16:56:06  
16:56:07 gmake[1]: 'sw20200507.out' is up to date.
16:56:07 gmake[1]: Nothing to be done for 'secondary-outputs'.
16:56:07 
16:56:07 **** Build Finished ****
16:56:07 
16:56:07 ================================================================================
16:56:07 
16:56:07 --------------------------------------------------------------------------------
16:56:07 Errors for project 'sw20200507' (0):
16:56:07 
16:56:07 
16:56:07 
16:56:07 
16:56:07 ================================================================================
16:56:07 CCS headless build complete! 0 out of 1 projects have errors.
16:56:07 Unable to init server: Could not connect: Connection refused
16:56:07 Eclipse: Cannot open display: 
16:56:07 Eclipse:
16:56:07 An error has occurred. See the log file
16:56:07 /home/cicdserver/workspaces/workspace_temp/.metadata/.log.
16:56:07 Build step 'Execute shell' marked build as failure
16:56:07 New run name is '#40'
16:56:07 Finished: FAILURE


Can anyone please help with this?
  • Here is the log file mentioned in the error message.

    4174.log.txt

  • Hello,

    The bulk of the errors in the log seem to be various permission errors with folder in the workspace and some of the generated makefiles in the project. Can you check that the permissions for those are ok also?

    Thanks

    ki

  • Hi,

    Since I also want to understand what's happening, what part of the log file indicates permission errors? Is there any way to ensure that Jenkins has all the permissions to all the folders/files, etc so these issues don't occur? There is only one user on this computer..

    Also, so far as I understand, as long as the system doesn't try to open Eclipse i.e. just ends after the headless build step, the issue should be resolved. Is that an incorrect assumption?

    Thanks!

  • Since I also want to understand what's happening, what part of the log file indicates permission errors?

    I see many "permission denied" type messages:

    !ENTRY org.eclipse.osgi 4 0 2021-12-07 16:56:07.641
    !MESSAGE Application error
    !STACK 1
    org.eclipse.core.internal.resources.ResourceException(/)[568]: java.io.FileNotFoundException: /home/cicdserver/workspaces/workspace_temp/.metadata/.plugins/org.eclipse.core.resources/.root/8.tree (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)

    .....

    !ENTRY org.eclipse.core.filesystem 4 277 2021-12-07 16:56:06.506
    !MESSAGE Parent of resource: /home/cicdserver/Documents/random/jenkinsTest/sw20200507/CPU1_FLASH/makefile is marked as read-only.
    !STACK 0
    java.io.FileNotFoundException: /home/cicdserver/Documents/random/jenkinsTest/sw20200507/CPU1_FLASH/makefile (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)

    .....

    !ENTRY org.eclipse.core.filesystem 4 277 2021-12-07 16:56:06.506
    !MESSAGE Parent of resource: /home/cicdserver/workspaces/workspace_temp/.metadata/.plugins/org.eclipse.core.resources/.history/60 is marked as read-only.
    !STACK 0
    java.nio.file.AccessDeniedException: /home/cicdserver/workspaces/workspace_temp/.metadata/.plugins/org.eclipse.core.resources/.history/60
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)

    ....

    doing a search of "permission denied" in the log file yields many hits

    Is there any way to ensure that Jenkins has all the permissions to all the folders/files, etc so these issues don't occur? There is only one user on this computer..

    ensure jenkis has write permiisions to the project and workspace folders and subfolders

    Also, so far as I understand, as long as the system doesn't try to open Eclipse i.e. just ends after the headless build step, the issue should be resolved. Is that an incorrect assumption?

    The CLI build commands rely on several eclipse/cdt and ccs components. Is the build completely successful despite the errors?

    Thanks

    ki

  • No the build is failing because Jenkins keeps trying to open display.

    I got one build to run successfully but I had to manually go the folders and change their permissions to 777 which allowed Jenkins access to everything. But this change in permissions can't be automated and every time a new project is cloned, the permissions will change. When the Jenkins build runs it runs as system:

    Started by user CI/CD Server
    18:14:50 Running as SYSTEM
    18:14:50 Building in workspace /var/lib/jenkins/workspace/Freestyle
    18:14:50 The recommended git tool is: NONE
    18:14:50 No credentials specified

    Why does SYSTEM not have read/write access to the folders?
  • No the build is failing because Jenkins keeps trying to open display.

    it looks like that error can also occur when there is no Xserver present.

    https://github.com/DrSnowbird/eclipse-docker/issues/1

    Why does SYSTEM not have read/write access to the folders?

    with what permissions was CCS installed with? 

  • I'm not running this in a Docker container. Should I do that?
    There's only one user on the this system, the one I'm using..

  • Does it even make sense to do this CI pipeline this way? Would it be better to use a makefile even if it's the autogenerated one?

  • What does "sudo password Jenkins" mean here?

    looks like he used the command to create a password for the jenkins account:

    https://stackoverflow.com/questions/25041125/default-jenkins-user-password

    Then he was able to log in with the jenkins account using that password and install CCS/SDK and so on...

    Does it even make sense to do this CI pipeline this way? Would it be better to use a makefile even if it's the autogenerated one?

    I don't have much experience with jenkins so unfortunately I am unable to provide much suggestions regarding best practices with building CCS projects via CLI via jenkins. I will see if I can find someone who has more experience to comment.

    Thanks

    ki