Saving build log to project directory?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Saving build log to project directory?

2,759 Views
william_lyons
Contributor III

Is there a way to programmatically save a copy of the build log into the project output directory?  I've found one setting under Project->Properties->C/C++ Build->Logging but there are a couple of short comings which make it not workable for my situation:

1) I work in a multi-developer environment (on multiple OSes, setups, etc.) and so absolute paths are a problem.  Project relative paths are necessary.

2) It looks like the same file/location is used regardless of which build Configuration is run.  We'd need to separate the "debug" from the "release" logs, etc.

3) It looks like the build log itself encompasses the pre-build and post-build steps, so if either of those accessed the file (say to add a time-stamp to the file name) I suspect VeryBadThings(tm) would happen.

Is there another way to configure build logs so that for every compile I can have a unique, timestamped log saved to the correct configuration's output directory?

Tags (2)
13 Replies

2,580 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Assuming that you haven't change the default log set up for the project/workspace, then adding the following as the final (active) step in your projects post-build step should achieve what you want:

cp ${WorkspaceDirPath}/.metadata/.plugins/org.eclipse.cdt.ui/${ProjName}.build.log buildlog-${current_date}.txt

Regards,

MCUXpresso IDE Support

2,580 Views
william_lyons
Contributor III

Oops, I "liked" this too soon. This works great on Linux based systems (which is what I tried it on) but failed on my Windows system because ${WorkspaceDirPath} gets populated with Windows style slashes which then get interpreted as escape sequences in the string. Still, this is a useful bit of insight into Eclipse variables so still very helpful.

I don't suppose anyone has a trick up their sleeve that would convert a Windows path into a Linux compatible path for the purposes of this thread?

0 Kudos

2,580 Views
converse
Senior Contributor V

Have you tried placing the path in quotes?

cp “complete/path” to/path

0 Kudos

2,580 Views
william_lyons
Contributor III

I would not have expected that to work since it still has both forward and backward slashes, but at least on a Windows box and a Linux box it worked!  I'll get one of the Mac guys to give it a try but I'm optimistic. Thanks!

For completeness, this is what it looks like:

cp "${WorkspaceDirPath}/.metadata/.plugins/org.eclipse.cdt.ui/${ProjName}.build.log" buildlog-${current_date}.txt
0 Kudos

2,580 Views
converse
Senior Contributor V

One thought though. Have you tried a command line build? You could then capture the output and save to a file of your choice. See Building Eclipse and MCUXpresso IDE Projects from the Command Line | MCU on Eclipse 

2,580 Views
william_lyons
Contributor III

Something like that was going to be my next step.  Thank you for providing the link!  I'll take a look and see if I can get it working.

0 Kudos

2,580 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Not sure if I understand your questions.

I don't often use  pre/post build command,I ever use  arm-none-eabi-objdump to generate disassemble files in the project folder. there is no issue.

pastedImage_1.png

0 Kudos

2,580 Views
william_lyons
Contributor III

To clarify, I have the following setup for my project team:

  • We have multiple developers working on a shared code base.
  • The code base is revision controlled using git, but locally some developers are working on Mac, some on Windows, some on Linux.
  • Not everyone has their local project directory in the same location on their hard drive/file system - in fact I think every single one is unique.
  • Within the project itself, we have multiple build targets based on hardware configuration and options, which are controlled by having each build target set different preprocessor defines.

Currently we use the built-in "build" tool of MCUXpresso to

  • execute a custom prebuild command (figures out the git commit hash and whether it's dirty or clean so this can be inserted into the MCU program itself)
  • execute the compile/assemble/link steps using gcc, etc.
  • execute the default post-build command, which in this case just prints out the memory usage using arm-none-eabi-size

What I would *like* to do is take all of the scrolling text that whizzes by on the console during the compile/assemble/link portion of the build and save it off to a file - ideally timestamped - so that there is a record of *every* compile/assemble/link we performed.  We would like to save this in a different directory for each build target similar to how the other build artifacts are saved by MCUXpresso already.  Currently I have not found any indication this is possible so I turn to the forums to see if someone else has tried this already and either succeeded or failed.

0 Kudos

2,580 Views
william_lyons
Contributor III

Anyone else know if this is possible?

0 Kudos

2,580 Views
converse
Senior Contributor V

There doesn't appear to be any way. According to a response on the Eclipse CDT forum, one of the developers commented:

No, it does not. This location is intended to keep "temporary" log, just to support "Copy Build Log" icon on the console toolbar. The idea behind it being configurable is to allow using a different filesystem in case of problems with space.

2,580 Views
william_lyons
Contributor III

That's a shame, but good to at least know the answer so I'm not spinning my wheels.

0 Kudos

2,579 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Will

You can set build log location here

pastedImage_1.png

Have a nice day,

Jun Zhang

0 Kudos

2,580 Views
william_lyons
Contributor III

I already referenced this field in my original post, and went on at length to describe why it was not suitable for my needs.

To reiterate, I would like to be able to set a per-build configuration file or directory, relative to the project directory, where build logs are stored.  Ideally I would also like the ability to either have them time-stamped automatically, or have a way for a post-build step to time-stamp them that wasn't going to interfere with any post-build steps that the build log itself records.

0 Kudos