Skip to content

Build fails starting with OSX Big Sur #3

Description

@twang817

The zinit module build run would report that the module built successfully without actually producing the bundle file on OSX.

Updated `zsh.mdh'.
/Library/Developer/CommandLineTools/usr/bin/make -f Makemod prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' libdir='/usr/local/lib' MODDIR='/usr/local/lib/zsh/5.3.1-dev-0' infodir='/usr/local/share/info' mandir='/usr/local/share/man' datadir='/usr/local/share' fndir='/usr/local/share/zsh/5.3.1-dev-0/functions' htmldir='/usr/local/share/zsh/htmldoc' runhelpdir='/usr/local/share/zsh/5.3.1-dev-0/help' CC='gcc' CPPFLAGS='-I/usr/local/include' DEFS='-DHAVE_CONFIG_H' CFLAGS='-g -Wall -O3' LDFLAGS='-L/usr/local/lib' EXTRA_LDFLAGS='-rdynamic' DLCFLAGS='-fno-common' DLLDFLAGS='-bundle -flat_namespace -undefined suppress' LIBLDFLAGS='' EXELDFLAGS='' LIBS='-liconv -ldl -ltermcap -lm  -lc' DL_EXT='so' DLLD='gcc' AWK='gawk' ANSI2KNR=': ansi2knr' YODL=': yodl ' YODL2TXT=': yodl2txt' YODL2HTML=': yodl2html' FUNCTIONS_INSTALL='' tzsh='zsh' prep
echo 'timestamp for *.mdd files' > ../Src/modules.stamp
Module has been built correctly.
To load the module, add following 2 lines to .zshrc, at top:
    module_path+=( "/Users/Tommy.Wang/.dotfiles/zsh/zinit/module/Src" )
    zmodload zdharma_continuum/zinit

After loading, use command `zpmod' to communicate with the module.
See `zpmod -h' for more information.
zdharma_continuum % ls -la
total 136
drwxr-xr-x    7 Tommy.Wang  staff    224 Dec 25 10:00 .
drwxr-xr-x  118 Tommy.Wang  staff   3776 Dec 25 10:02 ..
-rw-r--r--    1 Tommy.Wang  staff    156 Dec 24 14:14 .cvsignore
-rw-r--r--    1 Tommy.Wang  staff     18 Dec 24 14:14 .distfiles
-rw-r--r--    1 Tommy.Wang  staff     16 Dec 24 14:14 .exrc
-rw-r--r--    1 Tommy.Wang  staff  50209 Dec 24 14:14 zinit.c
-rw-r--r--    1 Tommy.Wang  staff     86 Dec 24 14:14 zinit.mdd

This is because configure somehow determined that dynamically linked modules were unavailable, and disabled the module in config.modules:

# Edit this file to change the way modules are loaded.
# The format is strict; do not break lines or add extra spaces.
# Run `make prep' if you change anything here after compiling
# (there is no need if you change this just after the first time
# you run `configure').
#
# Values of `link' are `static', `dynamic' or `no' to compile the
# module into the shell, link it in at run time, or not use it at all.
# In the final case, no attempt will be made to compile it.
# Use `static' or `no' if you do not have dynamic loading.
#
# Values of `load' are `yes' or `no'; if yes, any builtins etc.
# provided by the module will be autoloaded by the main shell
# (so long as `link' is not set to `no').
#
# Values of `auto' are `yes' or `no'. configure sets the value to
# `yes'.  If you set it by hand to `no', the line will be retained
# when the file is regenerated in future.
#
# Note that the `functions' entry extends to the end of the line.
# It should not be quoted; it is used verbatim to find files to install.
#
# You will need to run `config.status --recheck' if you add a new
# module.
#
# You should not change the values for the pseudo-module zsh/main,
# which is the main shell (apart from the functions entry).
name=zsh/main modfile=Src/zsh.mdd link=static auto=yes load=yes functions=Functions/Chpwd/* Functions/Exceptions/* Functions/Math/* Functions/Misc/* Functions/MIME/* Functions/Prompts/* Functions/VCS_Info/* Functions/VCS_Info/Backends/*
name=zdharma_continuum/zinit modfile=Src/zdharma_continuum/zinit.mdd link=no auto=yes load=no

I tested this on OSX Monterey, but according to this thread, the issue with the configure affects zsh 5.8 starting on OSX Big Sur that prevents it from properly detecting the platform features.

This has since been fixed in the 5.9 branch (via this patch), but 5.9 has also changed such that the zinit module no longer builds.

Investigating how the homebrew formula built zsh, I found that I could get the module to build from the zsh repo by setting CFLAGS as shown in the formula. I tried setting CFLAGS prior to running zinit module build, but that unfortunately didn't work right out of the box.

Here are the step that I took to finally get this to build:

$ git clone https://github.com/zsh-users/zsh.git
$ git clone https://github.com/zdharma-continuum/zinit-module.git
$ cd zsh
$ git checkout -b 5.8 zsh-5.8
$ cp -R ../zinit-module/Src/zdharma_continuum Src
$ ./Util/preconfig
$ CFLAGS="-Wno-implicit-function-declaration" ./configure \
    --prefix=/usr/local/Cellar/zsh/5.8_1 \
    --enable-fndir=/usr/local/Cellar/zsh/5.8_1/share/zsh/functions \
    --enable-scriptdir=/usr/local/Cellar/zsh/5.8_1/share/zsh/scripts \
    --enable-site-fndir=/usr/local/share/zsh/site-functions \
    --enable-site-scriptdir=/usr/local/share/zsh/scripts \
    --enable-runhelpdir=/usr/local/Cellar/zsh/5.8_1/share/zsh/help \
    --enable-cap \
    --enable-maildir-support \
    --enable-multibyte \
    --enable-pcre \
    --enable-zsh-secure-free \
    --enable-unicode9 \
    --enable-etcdir=/etc \
    --with-tcsetpgrp \
    DL_EXT=bundle
$ make

Before running make, I confirmed that the file config.modules contained the zdharma-continuum/zinit plugin and that the link option was set to dynamic:

$ cat config.modules
name=zdharma_continuum/zinit modfile=Src/zdharma_continuum/zinit.mdd link=dynamic auto=yes load=no

Finally, after running, I simply copied zsh/Src/zdharma_continuum/zinit.bundle wherever it needed to go (see ZINIT[MODULE_DIR]) and was able to get it load.

% zpmod -h
Usage: zpmod {subcommand} {subcommand-arguments}
       zpmod report-append {plugin-ID} {new-report-body}
       zpmod source-study [-l]

Command <report-append>:

Used by Zinit internally to speed up loading plugins with tracking (reporting).
It extends the given field {plugin-ID} in $ZINIT_REPORTS hash, with the given string
{new-report-body}.

Command <source-study>:

Displays list of files loaded via `source' or `.' builtins, with duration that each
loading lasted, in milliseconds. The module tracks all calls to those builtins and
measures the time each call took. This can be used to e.g. profile loading of plugins,
regardless of the plugin manager used.

Option -l shows full paths to the files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions