-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
async-profiler 4.0 (new formula) #222217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
async-profiler 4.0 (new formula) #222217
Conversation
Here's how I'd create this formula: class AsyncProfiler < Formula
desc "Sampling CPU and HEAP profiler for Java"
homepage "https://github.com/async-profiler/async-profiler/releases"
url "https://github.com/async-profiler/async-profiler/archive/refs/tags/v4.0.tar.gz"
sha256 "7beb736868af485d6b0b624e42141f78df0ca8403188adc17965b7153261aa55"
license "Apache-2.0"
depends_on "openjdk"
def install
system "make", "all"
bin.install Dir["build/bin/*"]
lib.install Dir["build/lib/*"]
libexec.install Dir["build/jar/*"]
end
test do
assert_match "Async-profiler #{version}", shell_output("#{bin}/asprof --version")
# TODO: add better test
# https://docs.brew.sh/Formula-Cookbook#add-a-test-to-the-formula
end
end |
b5e56e0
to
b64e5e9
Compare
b64e5e9
to
37ca88f
Compare
bin.install Dir["build/bin/*"] | ||
lib.install Dir["build/lib/*"] | ||
libexec.install Dir["build/jar/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No make install
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with make
, but I didn't see any install
target there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be better to also report the install
target missing issue
head "https://github.com/async-profiler/async-profiler.git", branch: "master" | ||
|
||
depends_on "cmake" => :build | ||
depends_on "openjdk" => [:build, :test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really not needed at runtime? It seems like this should just be
depends_on "openjdk" => [:build, :test] | |
depends_on "openjdk" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the jars are supplementary, but Async-profiler itself is native. Of course it connects to / interact with some running JVM to perform it's main duty, but it's not dependent on a JDK to be able to run.
async-profiler can then be "deployed" anywhere, e.g. in a container.
Hi, also what would be the strategy (if it's even possible) to make my formula redirect to this one? |
82539c5
to
673197d
Compare
You can add a |
So the tests are failing https://github.com/Homebrew/homebrew-core/actions/runs/14833693346/job/41640450001?pr=222217#step:3:57 The error : Is there something specific to know about macOs tests, how is the JVM run ? Error log
Locally on macOs 15.4
FYI here's what async-profiler says on this error. Could not start attach mechanism: No such file or directoryThe profiler cannot establish communication with the target JVM through UNIX domain socket.
|
You can't just write anywhere in the tests, brew usage, especially for tests, is heavily sandboxed. It might be best to set the tmp directory to |
ee72c06
to
ebc08d8
Compare
ebc08d8
to
329d787
Compare
Unfortunately the JVM doesn't work that way, the JVM temp directory is hardcoded to In order for the attach mechanism to work a socket FD is needed to be present. Locally I have the following file descriptor opened.
Notice the
What is strange is that the Note I used the I wonder if there might be another thing at play (maybe due to this sandboxing), because this test works locally ( |
That looks like the default tmp location for macOS. |
The error is pretty clear, it's not finding openjdk. ==> /opt/homebrew/Cellar/async-profiler/4.0/bin/asprof -d 2 -f /private/tmp/async-profiler-test-20250505-14459-udwwfr/test-profile-via-attach.html jps
The operation couldn’t be completed. Unable to locate a Java Runtime. |
That's the last run when I introduced the See : https://github.com/Homebrew/homebrew-core/actions/runs/14833693346/job/41640450001#step:3:64 |
By any chance is there a way to reproduce in some kind of macos container what happens in the this workflow? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I usually just leverage the macos github action workflow to do such debugging https://github.com/chenrui333/github-action-test/blob/main/.github/workflows/brew-debug.yml |
Thanks @chenrui333 I'll take a look |
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?Also :
brew style --formula async-profiler
Contributing my formula for async-profiler/async-profiler (8.1 K stars).
Note this formula is only for version 4.0, however my original formulas started with 2.8 (which was mostly a script and and lib until 3.0).