Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghostscript: Fix build error on Apple silicon #58493

Merged
merged 1 commit into from
Nov 7, 2020

Conversation

Watson1978
Copy link
Contributor

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

When build ghostscript on Apple silicon, it fails about compiling arm neon code with following message.

==> make install
Last 15 lines from /Users/watson/Library/Logs/Homebrew/ghostscript/02.make:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gpcl6] Error 1
make: *** Waiting for unfinished jobs....
Undefined symbols for architecture arm64:
  "_png_init_filter_functions_neon", referenced from:
      _png_read_filter_row in pngrutil.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gs] Error 1
Undefined symbols for architecture arm64:
  "_png_init_filter_functions_neon", referenced from:
      _png_read_filter_row in pngrutil.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gxps] Error 1

This patch will disable compiling arm neon of libpng bundled in ghostscript.

Related to Homebrew/brew#7857

@SeekingMeaning SeekingMeaning added the 11 Big Sur is specifically affected label Jul 24, 2020
Formula/ghostscript.rb Outdated Show resolved Hide resolved
@Bo98
Copy link
Member

Bo98 commented Jul 24, 2020

Does this happen with the libpng formula? Can we make Ghostscript link to that?

@Watson1978
Copy link
Contributor Author

Watson1978 commented Jul 25, 2020

Does this happen with the libpng formula?

No

Seems that ghostscript is built with its own rules at https://github.com/ArtifexSoftware/ghostpdl/blob/3244573621b1daa2997fbea0c13ce7f891b42203/base/png.mak

Can we make Ghostscript link to that?

Looks for me that there is no configuration to use external libpng.

@BrewTestBot BrewTestBot added the missing license Formula has a missing license which should be added label Jul 31, 2020
@dawidd6 dawidd6 removed the missing license Formula has a missing license which should be added label Jul 31, 2020
@stale
Copy link

stale bot commented Aug 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Aug 22, 2020
@stale stale bot removed the stale No recent activity label Aug 26, 2020
@Watson1978
Copy link
Contributor Author

Watson1978 commented Aug 26, 2020

Rebased with master branch

@jonchang
Copy link
Contributor

jonchang commented Sep 1, 2020

It looks like it's possible to avoid building against vendored libpng if make is called as make SHARE_LIBPNG=1.

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Oct 4, 2020
@fxcoudert fxcoudert removed the stale No recent activity label Oct 5, 2020
@fxcoudert
Copy link
Member

Has this been reported upstream, and how are they fixing the issue?

@fxcoudert
Copy link
Member

fxcoudert commented Nov 7, 2020

Reported upstream: https://bugs.ghostscript.com/show_bug.cgi?id=703095

The build mechanism actually knows how to handle this, but it's being tripped by not detecting the build triplet correctly. We should patch to include the latest config.guess and config.sub from https://git.savannah.gnu.org/gitweb/?p=config.git

I confirm this makes the build pass.

When build ghostscript on Apple silicon, it fails about compiling arm neon code with following message.

```
==> make install
Last 15 lines from /Users/watson/Library/Logs/Homebrew/ghostscript/02.make:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gpcl6] Error 1
make: *** Waiting for unfinished jobs....
Undefined symbols for architecture arm64:
  "_png_init_filter_functions_neon", referenced from:
      _png_read_filter_row in pngrutil.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gs] Error 1
Undefined symbols for architecture arm64:
  "_png_init_filter_functions_neon", referenced from:
      _png_read_filter_row in pngrutil.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/gxps] Error 1
```

This patch updates the config.guess and config.sub files, so
the build triplet is correctly detected
@fxcoudert fxcoudert merged commit 7106cbc into Homebrew:master Nov 7, 2020
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 8, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
11 Big Sur is specifically affected outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants