Re: How to write/append the compiler output to a logfile
"Arndt Pauschardt" <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <trinity-2adbc2dc-33bc-45f3-9e54-56a0e195561f-1576145204418@3c-app-webde-bap11> |
Hi, Bill thanks for your answer, see below. Arndt Gesendet: Mittwoch, 11. Dezember 2019 um 16:57 Uhr Von: "Bill Deegan" <[email protected]> An: "SCons users mailing list" <[email protected]> Betreff: Re: [Scons-users] How to write/append the compiler output to a logfile So you want to collect all C compilations output into a file which is the input of a builder? PRINT_CMD_LINE_FUNC is likely not the solution for that. [Arndt:] I would like to collect both the actual command line of e.g. gcc and its output (if there is any, like warnings, ...) into one accumlative file. "accumulative" in the sense that all gcc invocations (compile, link, ..) for one target (like in trgt = env.Program(sources = all-the-objs) or trgt = env.StaticLibrary(source = all-the-objs) appear in the same log file. But I haven't really decided yet, maybe 2 files are also ok. One which simply collects all the actual command lines (=> using PRINT_CMD_LINE_FUNC) and one other which collects all the gcc outputs (=> using a tweaked CCCOM). Changing CCCOM is o.k. It's not forbidden or advised against. It's normal practice. Also a command line with "command source > output file" Will overwrite the output file on each invocation. So you'd end up with only the last one. [Arndt:] yes, you are right, I know that. I left out the 2nd ">" With this example: 'CCCOM': '$CC -o $TARGET[0] -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' > $TARGET[1]' but that's really changing CCCOM, so the (gcc) builder will not be happy. Would TARGET[1] be different for every target? [Arndt:] no, its supposed to be accumulative, so one log file per environment What is the post link/compile step. Is this run per compile and link? or is this meant to run after all link and compiles are completed? [Arndt:] After all link/compiles are complete. My idea is/was sth like env.StaticLibrary(target = [mylib.a, mylog.txt], source = all-the-objs] and then feed mylog.txt as source in the next build step. THis next step is a new to-be-added static code analyzer. This thing seems to be "semi-hard-wired" to CMake and CMake seems to do all this sequentially: First compile/link all the stuff, collect the output, feed the output to the linter's parsing tool, then run the linter. I'm not really familiar with CMake, so far our linter builder has NOT been doing this sequentially because there is no real sequential operation needed - the CMake way of doing this seems questionable to me, but as said, not familiar with it. -Bill On Wed, Dec 11, 2019 at 8:48 AM Arndt Pauschardt <[email protected] > wrote: Hi, I have found PRINT_CMD_LINE_FUNC, so sorry for asking about logging the actual command line, I should have read the manual more thoroughly. PRINT_CMD_LINE_FUNC allows to do exactly what I want for the actual command line. On the output of the command I still would like your advice - in my example the object is a target and the logfile is (another) target. Thx Arndt Gesendet: Mittwoch, 11. Dezember 2019 um 13:10 Uhr Von: "Arndt Pauschardt" <[email protected] > An: [email protected] Betreff: [Scons-users] How to write/append the compiler output to a logfile Hi, everyone I would need a little advice ... I would like to write/append the compiler command line and the actual compiler output (its warnings, errors, ...) into a logfile. At the same time, I would like to keep the *COMSTR functionality of SCons so that the console output is showing what e.g CCCOMSTR is set to and the logfile has the output of CCCOM. I guess a possible solution is to tweak CCCOM from 'CCCOM': '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES', to sth like 'CCCOM': '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES > $CCLOGFILE' but I'm not sure whether this is good solution: - to me, CCCOM is "owned" by the builder, in this case it would tbe gcc builder. So tweaking it is like reaching out into someone else's pocket. - I would like to use logfile as a source for a post-compile/link step, so it is not only a logfile, but also a target of the compile step and a source of a post-compile step. Therefore, CCCOM should look more like 'CCCOM': '$CC -o $TARGET[0] -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' > $TARGET[1]' but that's really changing CCCOM, so the (gcc) builder will not be happy. So, all in all: How would/are you doing this? I googled it and searched the mailing list, but nothing substantial turned up so far. Thx Arndt _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users