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

Specialize the build for some expensive components for Arch & Debian. #1713

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sp1ff
Copy link
Contributor

@sp1ff sp1ff commented Mar 12, 2024

Summary:

This patch adds files p-{clang,llvm,libcxx}-linux-debian.inc; this will greatly speed-up Debian & Arch builds when LLVM has been installed via the distribution-specific packages.

Remove the extra "lib*" directory level in install_libcxx() when building form LLVM version < 14. At least on Debian, using LLVM 13.0 from the apt repos, this doesn't exist & breaks bitcode extraction.

Checklist:

  • The PR addresses a single issue. If it can be divided into multiple independent PRs, please do so.
  • The PR is divided into a logical sequence of commits OR a single commit is sufficient.
  • There are no unnecessary commits (e.g. commits fixing issues in a previous commit in the same PR).
  • Each commit has a meaningful message documenting what it does.
  • All messages added to the codebase, all comments, as well as commit messages are spellchecked.
  • The code is commented OR not applicable/necessary.
  • The patch is formatted via clang-format OR not applicable (if explicitly overridden leave unchecked and explain).
  • N/A: There are test cases for the code you added or modified OR no such test cases are required.

Note to reviewers: I believe the "SpellCheck" errors to be spurious.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

shellcheck found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.19%. Comparing base (cc7f3ff) to head (8b44143).

❗ Current head 8b44143 differs from pull request most recent head 49cdb09. Consider uploading reports for the commit 49cdb09 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1713      +/-   ##
==========================================
+ Coverage   69.57%   70.19%   +0.62%     
==========================================
  Files         159      162       +3     
  Lines       18775    19405     +630     
  Branches     4503     4634     +131     
==========================================
+ Hits        13062    13622     +560     
- Misses       3723     3744      +21     
- Partials     1990     2039      +49     

see 13 files with indirect coverage changes

@ccadar
Copy link
Contributor

ccadar commented Mar 23, 2024

@sp1ff thanks for the PR.
I'll let @MartinNowack review this PR, but please take a look at the shellcheck warnings.

@sp1ff
Copy link
Contributor Author

sp1ff commented Apr 17, 2024

@sp1ff thanks for the PR. I'll let @MartinNowack review this PR, but please take a look at the shellcheck warnings.

I believe the spellcheck warnings to be spurious; since the build scripts are sourced into the master script, they define variables that are intended to be used there, rather than locally.

@MartinNowack
Copy link
Contributor

@jamacku Is it possible to provide the used shall globally?
It would be great to solve the following warning:

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

@jamacku
Copy link
Contributor

jamacku commented Apr 18, 2024

@MartinNowack You can either mask the error message or globally set the shell used in your scripts. I'll prepare PR.

MartinNowack pushed a commit that referenced this pull request Apr 18, 2024
- set default shell to bash

#1713 (comment)
@MartinNowack
Copy link
Contributor

@sp1ff Sorry for the long delay, can you rebase your changes and I'll have a look at them.

The general warnings should be fixed. Thanks @jamacku .

This patch adds files p-{clang,llvm,libcxx}-linux-debian.inc; this
will greatly speed-up Debian & Arch builds when LLVM has been
installed via the distribution-specific packages.

Remove the extra "lib*" directory level in `install_libcxx()` when
building form LLVM version < 14. At least on Debian, using LLVM 13.0
from the apt repos, this doesn't exist & breaks bitcode extraction.
bin_path="$(dirname "$(readlink -f "${bin_path}")")"
[[ -z "${bin_path}" ]] && return 1

BITCODE_CC="${bin_path}/clang"

Check warning

Code scanning / shellcheck

BITCODE_CC appears unused. Verify use (or export if used externally). Warning

BITCODE_CC appears unused. Verify use (or export if used externally).
[[ -z "${bin_path}" ]] && return 1

BITCODE_CC="${bin_path}/clang"
BITCODE_CXX="${bin_path}/clang++"

Check warning

Code scanning / shellcheck

BITCODE_CXX appears unused. Verify use (or export if used externally). Warning

BITCODE_CXX appears unused. Verify use (or export if used externally).
bin_path="$(dirname "$(readlink -f "${bin_path}")")"
[[ -z "${bin_path}" ]] && return 1

BITCODE_CC="${bin_path}/clang"

Check warning

Code scanning / shellcheck

BITCODE_CC appears unused. Verify use (or export if used externally). Warning

BITCODE_CC appears unused. Verify use (or export if used externally).
[[ -z "${bin_path}" ]] && return 1

BITCODE_CC="${bin_path}/clang"
BITCODE_CXX="${bin_path}/clang++"

Check warning

Code scanning / shellcheck

BITCODE_CXX appears unused. Verify use (or export if used externally). Warning

BITCODE_CXX appears unused. Verify use (or export if used externally).

check_llvm_config_version() {
local check_mode=1
strict_mode="$1" # if llvm-config should be checked strictly

Check warning

Code scanning / shellcheck

strict_mode appears unused. Verify use (or export if used externally). Warning

strict_mode appears unused. Verify use (or export if used externally).
[[ $(to_bool "${DISABLE_ASSERTIONS}") -ne $(to_bool "${assertion}") ]] || return 1

local shared_mode
shared_mode="$(${lc} --shared-mode)" || return 1

Check warning

Code scanning / shellcheck

shared_mode appears unused. Verify use (or export if used externally). Warning

shared_mode appears unused. Verify use (or export if used externally).
is_ins=$(check_llvm_config_version 1 "${lc}") || return 1
fi

LLVM_CONFIG="${lc}"

Check warning

Code scanning / shellcheck

LLVM_CONFIG appears unused. Verify use (or export if used externally). Warning

LLVM_CONFIG appears unused. Verify use (or export if used externally).
fi

LLVM_CONFIG="${lc}"
LLVM_INSTALL="$(${lc} --prefix)"

Check warning

Code scanning / shellcheck

LLVM_INSTALL appears unused. Verify use (or export if used externally). Warning

LLVM_INSTALL appears unused. Verify use (or export if used externally).
LLVM_CONFIG="${lc}"
LLVM_INSTALL="$(${lc} --prefix)"
LLVM_BIN="$(${lc} --bindir)"
BITCODE_CC="${LLVM_BIN}/clang"

Check warning

Code scanning / shellcheck

BITCODE_CC appears unused. Verify use (or export if used externally). Warning

BITCODE_CC appears unused. Verify use (or export if used externally).
LLVM_INSTALL="$(${lc} --prefix)"
LLVM_BIN="$(${lc} --bindir)"
BITCODE_CC="${LLVM_BIN}/clang"
BITCODE_CXX="${LLVM_BIN}/clang++"

Check warning

Code scanning / shellcheck

BITCODE_CXX appears unused. Verify use (or export if used externally). Warning

BITCODE_CXX appears unused. Verify use (or export if used externally).
@sp1ff
Copy link
Contributor Author

sp1ff commented Apr 24, 2024

@sp1ff Sorry for the long delay, can you rebase your changes and I'll have a look at them.

The general warnings should be fixed. Thanks @jamacku .

@MartinNowack Sorry, missed this. Re-based. TBH the warnings RE strict_mode & shared_mode look legitimate to me. A bit embarrassed to admit I copied the code over from p-llvm-linux-ubuntu.inc and modified as needed. Want me to address it all three files (debian, ubuntu & arch)?

Beyond that, I'm a bit confused-- all of the .inc files define certain variables expected by the main script-- how are these warnings not popping-up all over? I checked & didn't see any sort of linter pragma...

@jamacku
Copy link
Contributor

jamacku commented Apr 29, 2024

@sp1ff

Beyond that, I'm a bit confused-- all of the .inc files define certain variables expected by the main script-- how are these warnings not popping-up all over? I checked & didn't see any sort of linter pragma...

It is because of Differential ShellCheck GHA. It performs differential ShellCheck scans (base and additions) and reports only newly introduced defects. You don't have to use ShellCheck directives to mute the suggestions/warnings. However, maintainers have access to all warnings in the Security tab on GitHub. You don't have to fix/mute all defects before introducing ShellCheck to your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants