Opened 4 years ago

Closed 21 months ago

#60544 closed defect (fixed)

reduce: Undefined symbols: _BrotliDecoderDecompress

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: mbrethen
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: reduce

Description

reduce fails to build:

/opt/local/bin/clang++-mp-9.0  -pipe -Os -stdlib=libc++ -arch x86_64 -I/opt/local/include/freetype2  -O3 -Wall  -L../lib -L/opt/local/lib -Wl,-headerpad_max_install_names -lintl -arch x86_64 -L/opt/local/lib -framework Carbon -framework CoreServices -framework ApplicationServices -o bootstrapreduce bootstrapreduce-arith01.o bootstrapreduce-arith02.o bootstrapreduce-arith03.o bootstrapreduce-arith04.o bootstrapreduce-arith05.o bootstrapreduce-arith06.o bootstrapreduce-arith07.o bootstrapreduce-arith08.o bootstrapreduce-arith09.o bootstrapreduce-arith10.o bootstrapreduce-arith11.o bootstrapreduce-arith12.o bootstrapreduce-arith13.o bootstrapreduce-arith14.o bootstrapreduce-isprime.o bootstrapreduce-allocate.o bootstrapreduce-bytes1.o bootstrapreduce-char.o bootstrapreduce-cslmpi.o bootstrapreduce-eval1.o bootstrapreduce-eval2.o bootstrapreduce-eval3.o bootstrapreduce-eval4.o bootstrapreduce-fns1.o bootstrapreduce-fns2.o bootstrapreduce-fns3.o bootstrapreduce-inthash.o bootstrapreduce-print.o bootstrapreduce-cslread.o bootstrapreduce-restart.o bootstrapreduce-lisphash.o bootstrapreduce-serialize.o bootstrapreduce-sysfwin.o bootstrapreduce-csl.o bootstrapreduce-fasl.o bootstrapreduce-cslgc.o bootstrapreduce-preserve.o  bootstrapreduce-stubs.o -lFOX-1.6 ../lib/libcrlibm.a ../lib/libffi.a ../lib/libsoftfloat.a  /opt/local/lib/libXrandr.a       /opt/local/lib/libXcursor.a       /opt/local/lib/libXrender.a       /opt/local/lib/libcurses.a       /opt/local/lib/libXext.a       /opt/local/lib/libX11.a       /opt/local/lib/libXft.a       /opt/local/lib/libXau.a       /opt/local/lib/libXfixes.a       /opt/local/lib/libxcb.a       /opt/local/lib/libXdmcp.a       /opt/local/lib/libpng.a       /opt/local/lib/libz.a       /opt/local/lib/libbz2.a       /opt/local/lib/libfreetype.a       /opt/local/lib/libiconv.a       /opt/local/lib/libXft.a       /opt/local/lib/libfontconfig.a       /opt/local/lib/libintl.a       /opt/local/lib/libexpat.a       -lpthread       -ldl 
ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame
Undefined symbols for architecture x86_64:
  "_BrotliDecoderDecompress", referenced from:
      _sfnt_open_font in libfreetype.a(sfnt.o)
ld: symbol(s) not found for architecture x86_64

The problem is that reduce is trying to link with MacPorts static libraries, which means that it must specify all of those libraries' dependencies. A recent freetype update added a dependency on brotli which reduce is evidently not using, hence the error about undefined brotli library symbols.

The fix should be for reduce to use MacPorts dynamic libraries instead of static libraries. This has numerous other advantages as well.

If there is absolutely no way to fix the build to do that, then the other possible fix is to instruct the build to also link with the brotli static libraries /opt/local/lib/libbrotlidec-static.a and /opt/local/lib/libbrotlicommon-static.a.

Change History (7)

comment:1 Changed 4 years ago by mbrethen

Is this reduce version 2020-03-01? I have not looked at the current release. Does it require changes to the source? I can forward your comments to the developer.

Last edited 4 years ago by mbrethen (previous) (diff)

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

From the log above, this is the 20181123_2 version of the port that's currently in the ports tree. I haven't attempted to figure out what specifically would need be changed to achieve this.

comment:3 Changed 4 years ago by mbrethen

I received this response from the developer:

“ The build on the Mac links in static mode because otherwise the resulting binary would refer to many things in /opt/local/lib, and if we tried to distribute a snapshot then the snapshot would be unusable unless everybody who wanted to try it installed macports and all the relevant libraries - something that would rather conflict with the ideal of a redistributable binary. Of course a copy distributed as a Macports port would be safe, but again only useful for people with macports set up and not available as a separate free-standing entity.

So I have added libbrotlicommon-static.a and libbrotidec-static.a to the things that CSL will link against, and added brotli to the macports setup script that I have and I then HOPE that will not hurt existing users - but I think that if it does then they can be instructed to run port selfupdate then port upgrade freetype (and possibly port install brotli) to get themselves back in a good state.”

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Sure, from the perspective of someone who wants to distribute a standalone binary, using static libraries is reasonable solution.

From the standpoint of MacPorts, we don't want that. We want to use dynamic libraries.

comment:5 Changed 4 years ago by mbrethen

He’s already using macports to build reduce. How about creating a binary package using:

$ sudo port mpkg reduce

comment:6 Changed 4 years ago by kencu (Ken)

in a custom prefix, it would work. I have often found these to be much larger than hoped, though.

A script to copy the needed libs and run install_name_tool on them usually works best, e.g.

<https://github.com/classilla/tenfourfox/blob/master/104fx_copy.sh>

comment:7 Changed 21 months ago by mbrethen

Resolution: fixed
Status: assignedclosed

In 8233b60a159e0f5c38513b2a7f0df7f538b1fb1f/macports-ports (master):

reduce: update to 20210119
Fixes: #65527
Fixes: #60778
Fixes: #60544
Fixes: #60543

Note: See TracTickets for help on using tickets.