Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

murdock: also compile with LLVM/clang #9398

Merged
merged 1 commit into from
Aug 20, 2018

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Jun 22, 2018

Contribution description

This is just an RFC and just a sketch at the moment, as I don't know how good this idea is (may slow down Murdock builds, but so would any new board) or if what I'm doing here is even correct.

But there are two major reasons for this:

  1. clang picks up different errors sometimes than GCC.
  2. OSX support is hardened as it is usually the toolchain used there.

Issues/PRs references

None (but idea sparked by #8646 (comment))

@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: CI Area: Continuous Integration of RIOT components labels Jun 22, 2018
@miri64
Copy link
Member Author

miri64 commented Jun 22, 2018

Requested review by @kaspar030 since it is his code I'm fiddling around with and by @gebart since IIRC he introduced the TOOLCHAIN feature.

@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 22, 2018
@miri64
Copy link
Member Author

miri64 commented Jun 22, 2018

Seems to work now + Murdock already picked out some errors ;-)

.murdock Outdated
echo "gnu llvm"
else
echo "gnu"
fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this construct could be replaced with some BOARD=$board make info-toolchains-supported target? This way also the ARM platforms will be build with LLVM.

@miri64
Copy link
Member Author

miri64 commented Jun 22, 2018

Seems to work now + Murdock already picked out some errors ;-)

Except for one error in can all seem to be in pkgs...

@vincent-d
Copy link
Member

Except for one error in can all seem to be in pkgs...

Funny one, this seems to come from LL_PREPEND_ELEM from utlist.h. Not a clue how to fix it though!

@jnohlgard
Copy link
Member

I think the best way is just to ignore the Wtautological-pointer-compare warning for that line.
See http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas

Use something in utlist.h like the example in the clang manual

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"

Blah

#pragma clang diagnostic pop

@cladmi
Copy link
Contributor

cladmi commented Jul 3, 2018

I would really like to have llvm for native and llvm for at least few reference boards.
Just doing one board per architecture could already help maintaining the build system.

@miri64
Copy link
Member Author

miri64 commented Jul 3, 2018

@cladmi any idea how to achieve this based on the changes I already provided (keeping #9398 (comment) in mind)?

@cladmi
Copy link
Contributor

cladmi commented Jul 6, 2018

@miri64 I did not really review for the moment.

@cladmi
Copy link
Contributor

cladmi commented Jul 9, 2018

@miri64 I would say it depends, on what is wanted, test all possible boards or just some.

If it is focusing first only on CI where some boards are selected for testing, adding other names at the place where you put native and check if the board is in the "test with llvm" list. Using https://stackoverflow.com/a/24495744/395687 oneliner for example.
Good thing, it starts small and does not double the number of jobs.

If it is meant to be global, the info-toolchains-supported or maybe only info-toolchains-supported-on-ci could be an idea too as the configuration could be put in cpu common directories. But for the global info-toolchains-supported, as a user I think I would expect to check the computer configuration, like is llvm installed, does it support this architecture, which is a feature on its own and maybe not only read a static configuration that could fail for me.

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 9, 2018
@miri64
Copy link
Member Author

miri64 commented Jul 9, 2018

Just doing one board per architecture could already help maintaining the build system.

If it is focusing first only on CI where some boards are selected for testing, adding other names at the place where you put native and check if the board is in the "test with llvm" list. Using https://stackoverflow.com/a/24495744/395687 oneliner for example.
Good thing, it starts small and does not double the number of jobs.

[…] which is a feature on its own and maybe not only read a static configuration that could fail for me.

Ok, then considering these three statements and with the urge to keep it simple for now, I would then check platform is native or a selection of a few other ARM-based boards in the hard-coded manner I applied for now and we later on select to provide a make target.

@miri64
Copy link
Member Author

miri64 commented Jul 9, 2018

or a selection of a few other ARM-based boards

(to my knowledge non of our other architectures have llvm-support at the moment)

@miri64
Copy link
Member Author

miri64 commented Jul 9, 2018

I added samr21-xpro and one random nucleo board with Cortex-M4 now. Most other boards I tried did not compile :(

@cladmi
Copy link
Contributor

cladmi commented Jul 9, 2018

It looks like murdock cannot generated the aggregated report with this added parameter.

From guessing and if I understand correctly I would imagine that adding -E TOOLCHAIN to DWQ_ENV may help there.
If this is used to separate jobs, I think it would prevent two different build to generate an output. @kaspar030 would know.

@miri64
Copy link
Member Author

miri64 commented Jul 9, 2018

Let's try that ;-)

@miri64
Copy link
Member Author

miri64 commented Jul 9, 2018

From guessing and if I understand correctly I would imagine that adding -E TOOLCHAIN to DWQ_ENV may help there.

Nope, with that it doesn't show any build results anymore ;-)

.murdock Outdated
local board=$1

# TODO provide make target in similar fashion as the info-boards-supported one
for b in native samr21-xpro nucleo-f401re
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have this list in a global variable outside of the function to not have this "magic" list in the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, similar to TEST_BOARDS_AVAILABLE

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@cladmi
Copy link
Contributor

cladmi commented Jul 17, 2018

@kaspar030 do you have any idea how to fix the output ?

.murdock Outdated
local board=$1

# TODO provide make target in similar fashion as the info-boards-supported one
for b in native samr21-xpro nucleo-f401re
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please re-use the is_in_list function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kaspar030
Copy link
Contributor

do you have any idea how to fix the output ?

I'll have a look.

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 16, 2018
@miri64
Copy link
Member Author

miri64 commented Aug 16, 2018

Rebased

@miri64
Copy link
Member Author

miri64 commented Aug 17, 2018

I talked about this PR with @cladmi over lunch and we decided to remove the failing architectures from the build list for add them in follow-ups, so we can finally proceed with this PR.

@miri64
Copy link
Member Author

miri64 commented Aug 17, 2018

Done

@miri64 miri64 force-pushed the murdock/enh/llvm branch 2 times, most recently from d739fa8 to 42c5b00 Compare August 17, 2018 14:25
@miri64
Copy link
Member Author

miri64 commented Aug 17, 2018

Note to self: old state of .murdock is in dfc7c68

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR State: waiting for other PR State: The PR requires another PR to be merged first labels Aug 17, 2018
@miri64
Copy link
Member Author

miri64 commented Aug 17, 2018

@kaspar030 can you have another look?

.murdock Outdated
@@ -9,7 +12,7 @@ export DLCACHE_DIR=${DLCACHE_DIR:-~/.dlcache}
NIGHTLY=${NIGHTLY:-0}
RUN_TESTS=${RUN_TESTS:-${NIGHTLY}}

DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS"
DWQ_ENV="-E BOARDS -E APPS -E NIGHTLY -E RUN_TESTS -E TOOLCHAIN"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cladmi and I weren't really sure if this is required

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand now, it should not be necessary.

The compile tasks including toolchain will be listed by

RIOT/.murdock

Lines 125 to 127 in a8c53ec

dwqc ${DWQ_ENV} -s \
"$0 get_app_board_toolchain_pairs \${1}" \
| xargs '-d\n' -n 1 echo $0 compile

And set from the argument in

RIOT/.murdock

Lines 136 to 139 in a8c53ec

compile() {
local appdir=$1
local board=$(echo $2 | cut -f 1 -d':')
local toolchain=$(echo $2 | cut -f 2 -d':')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this change, so let's see how murdock might react.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work regardless :-)

Copy link
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me. You can squash.

There are two major reasons for this:

1. clang picks up different errors sometimes than GCC.
2. OSX support is hardened as it is usually the toolchain used there.
@miri64
Copy link
Member Author

miri64 commented Aug 20, 2018

Squashed

@cladmi
Copy link
Contributor

cladmi commented Aug 20, 2018

@kaspar030 do you have any remarks left before merging ?

@kaspar030
Copy link
Contributor

I'm happy here. Good job guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CI Area: Continuous Integration of RIOT components Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants