plk/biber

Biber 2.20 error

Closed this issue · 14 comments

On macBook with m1 and Sonoma 14.4 and after todays TeXLive update, which should be 2.20:

voss >biber --version
Can't load '/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/auto/XML/LibXML/LibXML.bundle' for module XML::LibXML: dlopen(/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/auto/XML/LibXML/LibXML.bundle, 0x0001): Symbol not found: _iconv
  Referenced from: <4FABCE36-0023-3D1B-A158-3499EFD82412> /private/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/libxml2.2.dylib
  Expected in:     <E05EA2EB-4F11-36B6-87E5-41C89C1BCC5D> /private/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cach
plk commented

Universal binary?

macBook Sonoma with m1 and up-to-date TL24 and universal-darwin bin dir

plk commented

Looking at it. Can reproduce, something to do with homebrew on M1s doing something strange.

And the same output with the extracted Biber version in subdirectory .../thin/:

voss>thin:$ ./biber --version
Can't load '/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/auto/XML/LibXML/LibXML.bundle' for module XML::LibXML: dlopen(/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/auto/XML/LibXML/LibXML.bundle, 0x0001): Symbol not found: _iconv
  Referenced from: <4FABCE36-0023-3D1B-A158-3499EFD82412> /private/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/libxml2.2.dylib
  Expected in:     <E05EA2EB-4F11-36B6-87E5-41C89C1BCC5D> /private/var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/libiconv.2.dylib at /loader/HASH(0x14e082700)/DynaLoader.pm line 210.
 at /loader/HASH(0x14e0fce90)/PAR/Heavy.pm line 104.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/XML/LibXML.pm line 156.
Compilation failed in require at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/XML/LibXML/Simple.pm line 21.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/XML/LibXML/Simple.pm line 21.
Compilation failed in require at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/LaTeX/Recode.pm line 16.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/LaTeX/Recode.pm line 16.
Compilation failed in require at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/Utils.pm line 19.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/Utils.pm line 19.
Compilation failed in require at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/Internals.pm line 8.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber/Internals.pm line 8.
Compilation failed in require at /loader/HASH(0x14e0b2868)/parent.pm line 16.
BEGIN failed--compilation aborted at /var/folders/46/kr8jdrld7d324jpscgrlw2fh0000gn/T/par-766f7373/cache-351a9b4d1739a271ecf0be692d0ec1ef0a81d258/inc/lib/Biber.pm line 5.
Compilation failed in require at script/biber-darwin line 17.
BEGIN failed--compilation aborted at script/biber-darwin line 17.

Same issue here (M1 Pro and M2 Pro CPUs).

In the meantime, restoring the previous versions of biber (68188/2.19) and biber.universal-darwin (66402) via the TeX Live Utility helps.

Making a long story short (see full message at https://tug.org/pipermail/tex-live/2024-March/050284.html), the problem seems to be a mismatch between libiconv and libxml in the ARM part of biber.

Namely, libiconv.2.dylib links to the Homebrew version of libiconv, /opt/homebrew/opt/libiconv/lib/libiconv.2.dylib, which defines symbols _libiconv*:

% otool -L libiconv.2.dylib
libiconv.2.dylib:
/opt/homebrew/opt/libiconv/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)

% dsymutil -s libiconv.2.dylib | grep -E "iconv"
Symbol table for: 'libiconv.2.dylib' (arm64)
[   455] 0000207d 1e (PEXT SECT    ) 01     0000   000000000001b170 '_libiconv_relocate'
[   456] 00002090 1e (PEXT SECT    ) 01     0000   000000000001b250 '_libiconv_relocate2'
[  1322] 00000002 0f (     SECT EXT) 0a     0000   0000000000108020 '__libiconv_version'
[  1323] 00000015 0f (     SECT EXT) 01     0000   00000000000051ac '_iconv_canonicalize'
[  1324] 00000029 0f (     SECT EXT) 01     0000   00000000000049a4 '_libiconv'
[  1325] 00000033 0f (     SECT EXT) 01     0000   00000000000049c8 '_libiconv_close'
[  1326] 00000043 0f (     SECT EXT) 01     0000   0000000000003858 '_libiconv_open'
[  1327] 00000052 0f (     SECT EXT) 01     0000   00000000000049e0 '_libiconv_open_into'
[  1328] 00000066 0f (     SECT EXT) 01     0000   000000000001b0b0 '_libiconv_set_relocation_prefix'
[  1329] 00000086 0f (     SECT EXT) 01     0000   0000000000004df8 '_libiconvctl'
[  1330] 00000093 0f (     SECT EXT) 01     0000   0000000000004f2c '_libiconvlist'

while libxml2.2.dylib links to the OS version of libiconv, /usr/lib/libiconv.2.dylib, which defines symbols _iconv*:

% otool -L libxml2.2.dylib
libxml2.2.dylib:
/opt/homebrew/opt/libxml2/lib/libxml2.2.dylib (compatibility version 15.0.0, current version 15.6.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib (compatibility version 74.0.0, current version 74.2.0)
/opt/homebrew/opt/icu4c/lib/libicuuc.74.dylib (compatibility version 74.0.0, current version 74.2.0)
/opt/homebrew/opt/icu4c/lib/libicudata.74.dylib (compatibility version 74.0.0, current version 74.2.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

% dsymutil -s libxml2.2.dylib | grep -E "iconv"
[  2894] 0000884d 01 (     UNDF EXT) 00     0500   0000000000000000 '_iconv'
[  2895] 00008854 01 (     UNDF EXT) 00     0500   0000000000000000 '_iconv_close'
[  2896] 00008861 01 (     UNDF EXT) 00     0500   0000000000000000 '_iconv_open'

Can you try the corrected version on SF? https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/MacOS/biber-darwin_universal.tar.gz/download

This works:

% arch --arm64 biber --version
biber version: 2.20

I see that you've switched to using OS libraries all along:

 % otool -L libiconv.2.dylib
libiconv.2.dylib:
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libcharset.1.dylib (compatibility version 1.0.0, current version 1.0.0, reexport)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.80.1)

% otool -L libxml2.2.dylib 
libxml2.2.dylib:
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 72.1.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.80.1)

The new libiconv defines all sorts of iconv symbols, the new libxml defines none.

Can you try the corrected version on SF? https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/MacOS/biber-darwin_universal.tar.gz/download

Works for me! (I first updated biber to the buggy version via TeX Live Utility, checked again that it did not work, and then replaced /usr/local/texlive/2024/bin/universal-darwin/biber with the extracted binary.)

Thanks a lot for addressing the issue so quickly!

plk commented

Thanks for confirming. I will send an update to TL tonight. The issue was, as indicated above, lib mismatches. It was unfortunate I had switched to homebrew from macports as the latter has completely self-contained libraries but homebrew tends to use the system libraries a lot more. Also, since MacOS 11, the system libraries in /usr/lib are not physically present but are in a cache which dlopen() knows how to work with but PAR::Packer's linker doesn't and so I have to materialise the cache libs so they can be packed. Coupled with the fact that homebrew doesn't link system-conflicting libs into /opt/homebrew/lib and there was a perfect storm of technical irritations.

Also, since MacOS 11, the system libraries in /usr/lib are not physically present but are in a cache which dlopen() knows how to work with but PAR::Packer's linker doesn't and so I have to materialise the cache libs so they can be packed.

Thanks for the lightning-fast fix.

I was curious to see how you implemented the above: call dyld-shared-cache-extractor, which builds upon /usr/lib/dsc_extractor.bundle to extract the libraries from their cache
/System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/dyld_shared_cache_arm64e to /tmp/libraries, then use the latter as in

  --link=/tmp/libraries/usr/lib/libiconv.2.dylib \
  --link=/tmp/libraries/usr/lib/libxml2.2.dylib \

Impressive!

plk commented

It's a pain that Apple aren't really considering all the third-party ways of linking/including libs. If you need to access a file rather than use some cache-aware interface, you have to materialise the cache.

Has biber updated on CTAN? I didn’t noticed an update on CTAN. While I can download the latest version on SF, it would be convenient to update it via tlmgr on the server. Thanks for your work!

Has biber updated on CTAN? I didn’t noticed an update on CTAN. While I can download the latest version on SF, it would be convenient to update it via tlmgr on the server. Thanks for your work!

I have just updated biber.universal-darwin to version 70749 from CTAN (more specifically, from https://ftp.rrze.uni-erlangen.de/ctan/systems/texlive/tlnet/) via the TeX Live Utility, and everything is working again. Not all CTAN mirrors seem to have received the updated version yet.