8000 try to fix GAP build on some arm64 macOS systems by dimpase · Pull Request #40116 · sagemath/sage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

try to fix GAP build on some arm64 macOS systems #40116

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

Merged
merged 2 commits into from
Jun 1, 2025

Conversation

dimpase
Copy link
Member
@dimpase dimpase commented May 17, 2025

as reported on
#40106

Proposed Merged upstream as gap-system/gap#5992

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@jhpalmieri
Copy link
Member

This doesn't work for me, same error as before. Is LINK_SHLIB_FLAGS used in the build/gap-install target? I think that's where the error arises.

@jhpalmieri
Copy link
Member
jhpalmieri commented May 18, 2025

In case it helps, I am attaching two logs: one (with 40116 in its name) from trying the build with your change on this branch, and another (with LDFLAGS in its name) where I instead made this change:

diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
index 7d207a47a4..422a210888 100644
--- a/build/pkgs/gap/spkg-install.in
+++ b/build/pkgs/gap/spkg-install.in
@@ -16,6 +16,8 @@ if [ "$SAGE_DEBUG" = yes ] ; then
     export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS"
 fi
 
+export LDFLAGS="-Wl,-headerpad_max_install_names $LDFLAGS"
+
 sdh_configure $SAGE_CONFIGURE_GMP --prefix=$SAGE_LOCAL
 sdh_make
 sdh_make_install

The second log shows -Wl,-headerpad_max_install_names a few more times.

gap-4.14.0 40116.log
gap-4.14.0 LDFLAGS.log

@dimpase
Copy link
Member Author
dimpase commented May 18, 2025

it's obviously an upstream bug, the problem is to reproduce it.

@dimpase
Copy link
Member Author
dimpase commented May 18, 2025

Can you try building GAP on Homebrew (so that gmp+readline comes from there), but outside of Sage, just by cloning
https://github.com/gap-system/gap.git, then

cd gap
./autogen.sh && ./configure --prefix=/tmp && make && make install

I can't reporoduce this on William's M1, which is Darwin 24.3.0, not 24.4.0, like yours

@jhpalmieri
Copy link
Member

It failed on the documentation but the earlier part succeeded:

% make install
   C       build/main.c => build/obj/build/main.c.o
   LINK    build/gap-install
# install a special build of gap with SYS_DEFAULT_PATHS set suitably
/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/bin
/opt/homebrew/bin/ginstall -c -m 0755 build/gap-install /tmp/bin/gap
# install gac
sed -e "s;@SYSINFO_GAPROOT@;/tmp/lib/gap;" < ./cnf/gac.in > /tmp/bin/gac
chmod 0755 /tmp/bin/gac
/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/share/gap
/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/lib/gap
/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/share/gap/pkg
/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/share/gap/doc
/opt/homebrew/bin/ginstall -c -m 0644 ./doc/gapmacro.tex /tmp/share/gap/doc/
/opt/homebrew/bin/ginstall -c -m 0644 ./doc/manualindex /tmp/share/gap/doc/
for book in ref tut hpc ; do \
		/opt/homebrew/bin/ginstall -c -d -m 0755 /tmp/share/gap/doc/$book ; \
		for ext in css html js txt pdf six lab; do \
			/opt/homebrew/bin/ginstall -c -m 0644  ./doc/$book/*.$ext /tmp/share/gap/doc/$book/ ; \
		done \
	done
ginstall: cannot stat './doc/ref/*.css': No such file or directory
ginstall: cannot stat './doc/ref/*.html': No such file or directory
...

The executable /tmp/bin/gap fails to run because it hasn't installed the library:

% /tmp/bin/gap
dyld[67869]: Library not loaded: /tmp/lib/libgap.10.dylib
  Referenced from: <CCD67413-3CDA-38A2-8E8D-93553B9E526F> /private/tmp/bin/gap
  Reason: tried: '/tmp/lib/libgap.10.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/lib/libgap.10.dylib' (no such file), '/tmp/lib/libgap.10.dylib' (no such file), '/private/tmp/lib/libgap.10.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/private/tmp/lib/libgap.10.dylib' (no such file), '/private/tmp/lib/libgap.10.dylib' (no such file)
[1]    67869 abort      /tmp/bin/gap

@dimpase
Copy link
Member Author
dimpase commented May 19, 2025

The executable /tmp/bin/gap fails to run because it hasn't installed the library:

can in be that libgap.dylib is installed somewhere in /tmp/, just not where /tmp/bin/gap is looking ?

@jhpalmieri
Copy link
Member

The executable /tmp/bin/gap fails to run because it hasn't installed the library:

can in be that libgap.dylib is installed somewhere in /tmp/, just not where /tmp/bin/gap is looking ?

No, it's not there at all. Aside from a .tex file and a documentation index, the only things that were installed are two executables (gap and gac) and some empty directories.

@dimpase
Copy link
Member Author
dimpase commented May 19, 2025

@jhpalmieri - can you try the new version? (without your LDFLAGS add-on, just the PR itself)

details here: gap-system/gap#5989 (comment)

@jhpalmieri
Copy link
Member

This one works for me (on one machine, I won't be able to test the other one until tomorrow).

@dimpase
Copy link
Member Author
dimpase commented May 20, 2025

The executable /tmp/bin/gap fails to run because it hasn't installed the library:

can in be that libgap.dylib is installed somewhere in /tmp/, just not where /tmp/bin/gap is looking ?

No, it's not there at all. Aside from a .tex file and a documentation index, the only things that were installed are two executables (gap and gac) and some empty directories.

well, this is a bug (probably the same we see in Sage)! All what's "normally" broken in GAP's "make install" into a non-standard location is that packages are not quite at the right place, so GAP starts, but errors out with #I gapdoc package is not available. Check that the name is correct.

Does it also happen with the branch of my GAP's PR: gap-system/gap#5992 ?
(so at GAP's source dir obtained from GIT you'd git pull pull/5992/head before doing the usual ./autogen... etc)

@dimpase
Copy link
Member Author
dimpase commented May 20, 2025

@jhpalmieri - if you're running into the more issues on GAP, it would be great to see output of make with V=1 options, for more info.

@jhpalmieri
Copy link
Member

This one works for me (on one machine, I won't be able to test the other one until tomorrow).

Works on two other machines: all three exhibited the same problem and the branch here fixes it for all of them.

@dimpase
Copy link
Member Author
dimpase commented May 21, 2025

For the upstream bug report, on one or better two machines affected, could you please do build and make install of GAP with and without
gap-system/gap#5992 ?
And report whether libgap*.dylib appeared at install targets, better directly on gap-system/gap#5992 ?

@dimpase
Copy link
Member Author
dimpase commented May 26, 2025

GAP upstream has merged our fix, yay! Thanks for the efforts. Now the question is how to deal with it here. Use the patch from my upstream PR?

@dimpase
Copy link
Member Author
dimpase commented May 26, 2025

@jhpalmieri - please test this, it should fix your issue

@jhpalmieri
Copy link
Member

Sorry for not responding earlier to your various questions. Using your upstream patch makes sense to me, and this does fix my issue. Thanks for your work on it!

vbraun pushed a commit to vbraun/sage that referenced this pull request May 28, 2025
sagemathgh-40116: try to fix build on some arm64 macOS systems
    
as reported on
sagemath#40106

~Proposed~ Merged upstream as https://github.com/gap-
system/gap/pull/5992

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40116
Reported by: Dima Pasechnik
Reviewer(s): John H. Palmieri
@dimpase dimpase changed the title try to fix build on some arm64 macOS systems try to fix GAP build on some arm64 macOS systems Jun 1, 2025
@vbraun vbraun merged commit 138c5b0 into sagemath:develop Jun 1, 2025
20 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0