Macaulay2 / homebrew-tap

The Macaulay2 tap for Homebrew
7 stars 6 forks source link

macaulay2: 1.21 #162

Closed mahrud closed 1 year ago

mahrud commented 1 year ago

@d-torrance do you mind bottling topcom and M2 for M1? The instructions are here, and I can help fill any missing gaps!

d-torrance commented 1 year ago

@d-torrance do you mind bottling topcom and M2 for M1? The instructions are here, and I can help fill any missing gaps!

Sure, I'll give it a shot! It will be tomorrow -- the M1 laptop is on campus and I'm not. :)

mahrud commented 1 year ago

Sounds good! You should have permissions to upload the bottles to the respective releases. I'm happy to update the formula if you want.

d-torrance commented 1 year ago

The findProgram/runProgram examples are failing because apparently the gfan bottle is broken:

dtorrance@PiedmonG0Z3Q05R ~ % gfan
dyld[34880]: Symbol not found: (__ZNKSt5ctypeIcE13_M_widen_initEv)
  Referenced from: '/opt/homebrew/Cellar/gfan/0.6.2_10/bin/gfan'
  Expected in: '/usr/lib/libstdc++.6.dylib'
zsh: abort      gfan
d-torrance commented 1 year ago

Rebuilding gfan fixed the above issue. @mahrud - should I just overwrite the existing M1 tarball on the releases page and update the checksum, or does there need to be a new gfan release?

Ironically, now the build is failing loading here:

/bin/sh: brew: command not found
../../../../Macaulay2/packages/ForeignFunctions.m2:517:1:(2):[62]: error: close: process exited with code 32512

I'm assuming that /opt/homebrew/bin isn't in PATH.

d-torrance commented 1 year ago

The following patch fixes the above issue:

diff --git a/M2/Macaulay2/packages/ForeignFunctions.m2 b/M2/Macaulay2/packages/ForeignFunctions.m2
index fc4ecb45f..04d473392 100644
--- a/M2/Macaulay2/packages/ForeignFunctions.m2
+++ b/M2/Macaulay2/packages/ForeignFunctions.m2
@@ -523,7 +523,7 @@ importFrom_Core {"isAbsolutePath"}
 if (version#"operating system" == "Darwin" and
     member(version#"architecture", {"aarch64", "arm64"}))
 then (
-    brewPrefix := replace("\\s+$", "", get "!brew --prefix");
+    brewPrefix := replace("\\s+$", "", get "!PATH=\"$PATH:/opt/homebrew/bin\" brew --prefix");
     dlopen' = filename -> (
        if isAbsolutePath filename then dlopen filename
        else (

Would adding this require a new release?

d-torrance commented 1 year ago

Or maybe adding depends_on "brew" to the formula would be cleaner?

mahrud commented 1 year ago

Rebuilding gfan fixed the above issue. @mahrud - should I just overwrite the existing M1 tarball on the releases page and update the checksum, or does there need to be a new gfan release?

Update the same release, otherwise you'll need to bump the revision number and rebottle for all the other architectures also.

The following patch fixes the above issue:

The solution should not be hardcoding the path (in fact brew audit will complain if any hardcoded paths appear anywhere, even in the documentation).

Do you should have a line like this in your .zprofile, don't you?

eval $(/opt/homebrew/bin/brew shellenv)
d-torrance commented 1 year ago

Rebuilding gfan fixed the above issue. @mahrud - should I just overwrite the existing M1 tarball on the releases page and update the checksum, or does there need to be a new gfan release?

Update the same release, otherwise you'll need to bump the revision number and rebottle for all the other architectures also.

Ok, will do!

The following patch fixes the above issue:

The solution should not be hardcoding the path (in fact brew audit will complain if any hardcoded paths appear anywhere, even in the documentation).

Do you should have a line like this in your .zprofile, don't you?

eval $(/opt/homebrew/bin/brew shellenv)

I do, and brew runs just fine when I run it directly from the terminal or even from inside Macaulay2. But I'm assuming that during the build, we're in a minimal environment where /opt/homebrew/bin isn't in PATH.

mahrud commented 1 year ago

Ok, will do!

I updated the gfan bottle already!

d-torrance commented 1 year ago

Ok, will do!

I updated the gfan bottle already!

Lol yeah I figured that out after a moment of confusion when I went to change the checksum but the new one was already there!

mahrud commented 1 year ago

But we need to

But I'm assuming that during the build, we're in a minimal environment where /opt/homebrew/bin isn't in PATH.

I think this is intentional to prevent formulas from calling brew. with $HOMEBREW_PREFIX/bin/brew instead!

mahrud commented 1 year ago

If you don't want to rebuild M2 all over again it's fine with me, it might suffice to manually change this line in the tarfile.

d-torrance commented 1 year ago

Yeah, I just turned the laptop back into IT, so I'm afraid I won't be able to do any more builds for a while anyway. :)