Skip to content

make: provide support for listing supported and blacklisting toolchains#9730

Merged
cladmi merged 6 commits intoRIOT-OS:masterfrom
miri64:make/enh/toolchain-supported-list
Aug 16, 2018
Merged

make: provide support for listing supported and blacklisting toolchains#9730
cladmi merged 6 commits intoRIOT-OS:masterfrom
miri64:make/enh/toolchain-supported-list

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Aug 7, 2018

Contribution description

This PR introduces two things:

  • The ability of a board/cpu-family to define the toolchains they support via the TOOLCHAINS_SUPPORTED macro
  • The ability to blacklist certain toolchains for modules, applications, or pkg that does not support that particular toolchain via the TOOLCHAINS_BLACKLIST (similar to BOARD_BLACKLIST)

As a consequence of those to introductions this PR also contains:

Things that might be worth an inclusion into this:

  • A global make target that lists all boards that support a given toolchain (e.g. info-%-supporting or something)

Issues/PRs references

Errors for packages that caused blacklisting were detected in #9398.

#9734 applies the concept of blacklisting toolchains for several packets that have problems with LLVM/clang.

@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … labels Aug 7, 2018
@miri64 miri64 added this to the Release 2018.07 milestone Aug 7, 2018
@miri64 miri64 requested a review from cladmi August 7, 2018 14:40
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 7, 2018
Copy link
Copy Markdown
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.

Some review before testing remarks:

I like the idea and implementation.

I would like to also have a short documentation in https://github.com/RIOT-OS/RIOT/blob/master/makefiles/vars.inc.mk
As they do not need to be exported they can be explained in a comment like BUILDDEPS.

Some nitpicks inline.

Comparing to FEATURES, there is currently no need for a TOOLCHAINS_REQUIRED but it could be added later when/if necessary.

I did not tested the test and changes yet but will do it now.

INCLUDES += -I$(PKGDIRBASE)/micro-ecc

# LLVM/clang can't handle the inline assembler instructions in this package
TOOLCHAINS_BLACKLIST := llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be +=.

LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
endif

TOOLCHAINS_SUPPORTED := gnu llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can just use = here there is no reason to do :=.

# include common peripheral initialization
USEMODULE += periph_common

TOOLCHAINS_SUPPORTED := gnu llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can just use = here there is no reason to do :=.

INCLUDES += -I$(RIOTCPU)/$(CPU)/include
include $(RIOTCPU)/$(CPU)/Makefile.include

TOOLCHAINS_SUPPORTED ?= gnu
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe a small comment on top.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Addressed comments


# There is a problem with the LLVM assembler and the assembly part of this
# package
TOOLCHAINS_BLACKLIST += llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not get errors for BOARD=iotlab-m3 or BOARD=native using TOOLCHAIN=llvm for unittests

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mhhh.... I do get it. Are you in the right branch ;-)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR branch yes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I of course get the warning for the BLACKLISTED toolchain.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah! Mine are exactly as the murdock ones

DIRS += $(OPENTHREAD_DIR)/contrib/netdev
endif

# There is a problem with ranlib and LLVM/clang in this package
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe also add problem with unused '-mcpu' arguments and ranlib

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But those are only warnings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Which I think may be the root cause of the ranlib error.

INCLUDES += -I$(PKGDIRBASE)/micro-ecc

# LLVM/clang can't handle the inline assembler instructions in this package
TOOLCHAINS_BLACKLIST += llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here, I do not get any errors.

make -C tests/pkg_micro-ecc --no-print-directory BOARD=iotlab-m3 clean all TOOLCHAIN=llvm

Do you have a failing murdock output maybe ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok it fails with samr21-xpro but not iotlab-m3 in docker and on my computer.


Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok... I'll take the blacklisting out of this PR for now.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Addressed more comments

@miri64 miri64 force-pushed the make/enh/toolchain-supported-list branch from e43d9be to 6a598b2 Compare August 7, 2018 16:00
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Ok... I'll take the blacklisting out of this PR for now.

Done

@miri64 miri64 removed this from the Release 2018.07 milestone Aug 7, 2018
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Removed the milestone. This isn't part of the release (it just popped up during the testing procedures).

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Ok... I'll take the blacklisting out of this PR for now.

Done

See #9734 for the usage of the blacklisting.

@echo $($*)

info-toolchains-supported:
@echo $(filter-out $(TOOLCHAINS_BLACKLIST),$(TOOLCHAINS_SUPPORTED))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would also like to have something like info-toolchain-is-supported that produces an error if not

info-toolchain-is-supported:
    @exit $(if $(filter $(TOOLCHAIN), $(filter-out $(TOOLCHAINS_BLACKLIST),$(TOOLCHAINS_SUPPORTED))),1,0)

Or maybe not info- but more on assert/test/check.

So it can be used in https://github.com/RIOT-OS/RIOT/blob/master/makefiles/buildtests.inc.mk to skip the compilation in buildtest.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done (see below)

miri64 added a commit to miri64/RIOT that referenced this pull request Aug 7, 2018
RESULT=false ; \
fi ; \
$(MAKE) clean-intermediates >/dev/null 2>&1 || true; \
if $(MAKE) check-toolchain-supported; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs a terminating \ and also silencing stdout and stderr. Missing BOARD=$${board}.

Suggestion, it could be replace by an ! condition and using continue to remove one indentation.

RESULT=false ; \
fi ; \
$(MAKE) clean-intermediates >/dev/null 2>&1 || true; \
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here for \.

@echo $(filter-out $(TOOLCHAINS_BLACKLIST),$(TOOLCHAINS_SUPPORTED))

check-toolchain-supported:
@exit $(if $(filter $(TOOLCHAIN), $(filter-out $(TOOLCHAINS_BLACKLIST),$(TOOLCHAINS_SUPPORTED))),1,0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not failing:

make -C examples/hello-world/ check-toolchain-supported TOOLCHAIN=llvm QUIET=0 BOARD=hifive1
make: Entering directory '/home/harter/work/git/RIOT/examples/hello-world'
make: Leaving directory '/home/harter/work/git/RIOT/examples/hello-world'

I reversed the 1 and the 0 while writing the code… my bad

It should also be added to the .PHONY targets.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 7, 2018

Addressed comments (was already working on it, while testing it with #9734 ;-))

miri64 added a commit to miri64/RIOT that referenced this pull request Aug 7, 2018
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 8, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Aug 8, 2018

The normal TOOLCHAINS_SUPPORTED case works correctly for me here:

BOARDS="native hifive1 samr21-xpro" TOOLCHAIN=llvm make --no-print-directory -C examples/hello-world/ buildtest
Building for native ... success.
Building for samr21-xpro ... success.

When using #9734 I also correctly get the TOOLCHAINS_BLACKLISTED

BOARDS="native hifive1 samr21-xpro iotlab-m3" TOOLCHAIN=llvm make --no-print-directory -C tests/pkg_micro-ecc buildtest
Building for native ... success.
Building for iotlab-m3 ... success.

Copy link
Copy Markdown
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.

Only missing a short documentation in https://github.com/RIOT-OS/RIOT/blob/master/makefiles/vars.inc.mk
As they do not need to be exported they can be explained in a comment like BUILDDEPS.

I could propose something if it can help, but feel free to adapt/change it:

# TOOLCHAINS_SUPPORTED  List of supported toolchains by a cpu (gnu/llvm/…).
# TOOLCHAINS_BLACKLISTED List of unspported toolchains for a module or an example.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 12, 2018

Mh, BOARD_BLACKLIST and BOARD_WHITELIST aren't documented there as well. Should I open an issue or PR for that?

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 12, 2018

(TOOLCHAIN isn't either ;-))

@miri64 miri64 force-pushed the make/enh/toolchain-supported-list branch from e2434ef to 2f27f11 Compare August 12, 2018 10:27
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 12, 2018

Rebased (please check if I didn't mess up the change from bfbc9c1) and addressed comments.

miri64 added a commit to miri64/RIOT that referenced this pull request Aug 12, 2018
@miri64 miri64 force-pushed the make/enh/toolchain-supported-list branch from 2f27f11 to 7943cb0 Compare August 12, 2018 10:34
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 12, 2018

And another rebase due to #9351 being merged ;-)

miri64 added a commit to miri64/RIOT that referenced this pull request Aug 12, 2018
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 12, 2018
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 13, 2018
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 14, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Aug 16, 2018

This looks good to me, please rebase/squash, I will retest and review the commits individually after.

miri64 and others added 6 commits August 16, 2018 16:41
Assuming `TOOLCHAIN_SUPPORTED` is provided by the board and
`TOOLCHAIN_BLACKLIST` by a module or `pkg`, this outputs the fact that
a toolchain is not supported or blacklisted in a similar manner as
(un-)supported features and boards are.
@miri64 miri64 force-pushed the make/enh/toolchain-supported-list branch from 7943cb0 to 6309df6 Compare August 16, 2018 14:43
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Aug 16, 2018

Squashed

@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 Aug 16, 2018
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 16, 2018
@cladmi cladmi added CI: run tests If set, CI server will run tests on hardware for the labeled PR and removed CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Aug 16, 2018
Copy link
Copy Markdown
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.

ACK Test from #9730 (comment) work.

Note, this is not doing any murdock handling as it does not compile with llvm and that everything is currently compatible with gnu. (Tested in murdock integration #9398)

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Aug 16, 2018

I was adding CI: run tests but it is not necessary as it not changing anything for murdock.

@cladmi cladmi merged commit 623e3e1 into RIOT-OS:master Aug 16, 2018
@miri64 miri64 deleted the make/enh/toolchain-supported-list branch August 16, 2018 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system 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 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.

2 participants