Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Add more complete linux build instructions - #101631

Merged
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow
Jul 8, 2024
Merged

Add more complete linux build instructions#101631
agocke merged 10 commits into
dotnet:mainfrom
agocke:automated-workflow

Conversation

@agocke

Copy link
Copy Markdown
Member

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.

Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.

I'm trying to make it slightly easier to install the needed requirements, and add some validation if a user hasn't installed the requirements.
Also, I validated that these instructions still work for Ubuntu 24.04 and have noted that other installs are only community-supported.
@ghostghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2024
@am11

am11 commented Apr 26, 2024

Copy link
Copy Markdown
Member

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

Comment threadeng/native/build-commons.sh Outdated
Comment threaddocs/workflow/requirements/linux-requirements.md Outdated
@jkotasjkotas added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@agocke

Copy link
Copy Markdown
MemberAuthor

I'm using eng/install-native-dependencies.sh in Debian/Ubuntu, Alpine and macOS. It works well. Do we need another mechanism; another list to maintain?

I didn't know about that entry point. I'm happy to integrate with that.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

I'm happy to integrate with that.

I think it would be good to just point to the (self-documenting) helper script. On fresh machine (baremetal, cloud VM, CI, container) it installs the prereqs in a few second enough to build all default subsets.

# replace 'ubuntu' with 'alpine' without changing the steps
$ docker run --rm -v$(pwd):/runtime -w /runtime --platform linux/arm64/v8 ubuntu sh -c '	eng/install-native-dependencies.sh;	./build.sh -c Release'

@agocke

Copy link
Copy Markdown
MemberAuthor

I think it would be good to just point to the (self-documenting) helper script

I'm fine with this but the lists are currently inconsistent.

Our docs:

build-essential
clang
cmake
curl
git
libicu-dev
libkrb5-dev
liblttng-ust-dev
libssl-dev
lld
lldb
llvm
ninja-build
python-is-python3
zlib1g-dev

Script

build-essential
clang
cmake
gettext
libicu-dev
libkrb5-dev
liblldb-dev
liblttng-ust-dev
libssl-dev
libunwind8-dev
lldb
llvm
locales
zlib1g-dev

Diff:

build-essential
clang
cmake
-curl-git+gettext
libicu-dev
libkrb5-dev
+liblldb-dev
liblttng-ust-dev
libssl-dev
-lld+libunwind8-dev
lldb
llvm
-ninja-build-python-is-python3+locales
zlib1g-dev

Thoughts? I personally think ninja-build should be in there even if it's not strictly necessary.

@am11

am11 commented Apr 29, 2024

Copy link
Copy Markdown
Member

Yup, agreed.

  • ninja-build can be added in both debian and alpine (it has the same package name).
  • curl and python3 on debian, and python3 on alpine are implicitly installed (but we can explicitly specify them)
  • lld can be added in both debian and alpine.
  • git is not strictly needed (but can be added).

@agocke

agocke commented Apr 30, 2024

Copy link
Copy Markdown
MemberAuthor

OK, I took the most conservative approach of just taking the union, since I'm not sure what's actually necessary.

Also, docs have been updated to point to the shell script.

fi
elif [[ "$__HostOS" == "linux" ]]; then
# Check presence of cmake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md"; exit 1; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are already testing it in gen-buildsys.sh. Also why is this linux only?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer. Ideally I'd like this check to happen even earlier, but I think that belongs in another PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

I think if we are bringing it back, we should do it for all platforms, not just linux. CMake is needed on all platforms alike.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

And this is linux-only because I think checking for pkg-config is better on Mac. What we're looking for is the thing least-likely to have been installed by-default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use else instead of elif, that will cover mac+linux+{everything-else}:

else# Check presence of cmake on the pathcommand -v cmake 2>/dev/null || { echo>&2"Please install cmake before running this script, see https://github.com/dotnet/runtime/tree/main/docs/workflow/requirements";exit 1; }

User can then read {platform}-instructions.md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is happening earlier and is clearer.

It is rendering this check redundant which can be deleted:

if! cmake_command=$(command -v cmake);then
echo"CMake was not found in PATH."

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

We used to have an upfront check for a while and it was deleted in #39044.

Not quite the same -- that's a version check, here I'm just doing a basic check to see if it exists at all. The intent is to catch people who have not installed the prereqs at all, not people who have misconfigured prereqs.

Comment threadeng/install-native-dependencies.sh Outdated
* libkrb5-dev
* zlib1g-dev
* ninja-build (optional, enables building native code with ninja instead of make)
Install the packages listed in [debian-reqs.txt](/eng/debian-reqs.txt).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/eng/debian-reqs.txt no longer exists

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that's right. Now I remembered why I structured it like this: so that users could easily see exactly what they were installing without having to scan a bash script and also without having the risk of the list going out of date. I prefer my previous solution. I'm going to revert the last commit.

Comment threadeng/install-native-dependencies.sh Outdated

apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev
xargs apt-get install -y < eng/debian-reqs.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
xargs apt-get install -y < eng/debian-reqs.txt
apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev zlib1g-dev

lets keep them separate then. I was proposing to deduplicate it the other way around. Makes less sense to change it for one distro leaving others on the table.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Could you elaborate? Ubuntu is the only Linux dev platform we "officially" support developing on. Wouldn't it make sense to go through more work to make it a good "reference" platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This script is idempotent in nature; as it just calls package managers of that nature (worst case: print "package is already installed"; exit 0). It supports multiple platforms and has room for more. In the context of this script, there is no official precedence. Currently, it is providing support for Ubuntu, Alpine and Apple platforms.

The suggestion above was to just point people to the usage of this self-documenting script regardless of the distro. If/when someone will hit Unsupported distro. distro: $ID branch, they will likely get encouraged to add support for their platform.

Unless we think listing the dependencies for Debian/Ubuntu (without further description) separately is meaningful, IMO, it's better to keep it simple. On the other hand, seeing that we have eng/Brewfile also separated (as opposed to brew install <the whole grocery list>), we can probably live with this separate file as well. 😅

If we are going to use the separate version, please make sure to use absolute path (so it can be called from any location as before): agocke/runtime@automated-workflow...am11:runtime:patch-35.

@agockeagockeMay 22, 2024

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah brewfile was what I was copying in spirit. I'm hoping this is useful for others -- if it's not we can fold back into the script.

@agocke
agocke enabled auto-merge (squash) July 8, 2024 21:50
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@agocke@am11@danmoseley@jkotas