'OSX monterey -> ld: library not found for -lintl

When pipenv install uwsgi

This error comes, ld: library not found for -lintl

I guess it requires X-code library ?

I tried this as well

$xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

However it is already installed.

How can I solve this?


I checked the verbose log with

pipenv install uwsgi -v

  *** uWSGI linking ***
  clang -o /Users/whitebear/.local/share/virtualenvs/aicomposer-Enqobsfe/bin/uwsgi  core/utils.o core/protocol.o core/socket.o core/logging.o core/master.o core/master_utils.o core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o core/sendfile.o core/async.o core/master_checks.o core/fifo.o core/offload.o core/io.o core/static.o core/websockets.o core/spooler.o core/snmp.o core/exceptions.o core/config.o core/setup_utils.o core/clock.o core/init.o core/buffer.o core/reader.o core/writer.o core/alarm.o core/cron.o core/hooks.o core/plugins.o core/lock.o core/cache.o core/daemons.o core/errors.o core/hash.o core/master_events.o core/chunked.o core/queue.o core/event.o core/signal.o core/strings.o core/progress.o core/timebomb.o core/ini.o core/fsmon.o core/mount.o core/metrics.o core/plugins_builder.o core/sharedarea.o core/rpc.o core/gateway.o core/loop.o core/cookie.o core/querystring.o core/rb_timers.o core/transformations.o core/uwsgi.o proto/base.o proto/uwsgi.o proto/http.o proto/fastcgi.o proto/scgi.o proto/puwsgi.o core/zlib.o core/regexp.o core/routing.o core/yaml.o core/json.o core/xmlconf.o core/dot_h.o core/config_py.o plugins/python/python_plugin.o plugins/python/pyutils.o plugins/python/pyloader.o plugins/python/wsgi_handlers.o plugins/python/wsgi_headers.o plugins/python/wsgi_subhandler.o plugins/python/web3_subhandler.o plugins/python/pump_subhandler.o plugins/python/gil.o plugins/python/uwsgi_pymodule.o plugins/python/profiler.o plugins/python/symimporter.o plugins/python/tracebacker.o plugins/python/raw.o plugins/gevent/gevent.o plugins/gevent/hooks.o plugins/ping/ping_plugin.o plugins/cache/cache.o plugins/nagios/nagios.o plugins/rrdtool/rrdtool.o plugins/carbon/carbon.o plugins/rpc/rpc_plugin.o plugins/corerouter/cr_common.o plugins/corerouter/cr_map.o plugins/corerouter/corerouter.o plugins/fastrouter/fastrouter.o plugins/http/http.o plugins/http/keepalive.o plugins/http/https.o plugins/http/spdy3.o plugins/signal/signal_plugin.o plugins/syslog/syslog_plugin.o plugins/rsyslog/rsyslog_plugin.o plugins/logsocket/logsocket_plugin.o plugins/router_uwsgi/router_uwsgi.o plugins/router_redirect/router_redirect.o plugins/router_basicauth/router_basicauth.o plugins/zergpool/zergpool.o plugins/redislog/redislog_plugin.o plugins/mongodblog/mongodblog_plugin.o plugins/router_rewrite/router_rewrite.o plugins/router_http/router_http.o plugins/logfile/logfile.o plugins/router_cache/router_cache.o plugins/rawrouter/rawrouter.o plugins/router_static/router_static.o plugins/sslrouter/sslrouter.o plugins/spooler/spooler_plugin.o plugins/cheaper_busyness/cheaper_busyness.o plugins/symcall/symcall_plugin.o plugins/transformation_tofile/tofile.o plugins/transformation_gzip/gzip.o plugins/transformation_chunked/chunked.o plugins/transformation_offload/offload.o plugins/router_memcached/router_memcached.o plugins/router_redis/router_redis.o plugins/router_hash/router_hash.o plugins/router_expires/expires.o plugins/router_metrics/plugin.o plugins/transformation_template/tt.o plugins/stats_pusher_socket/plugin.o -lpthread -lm -lz -L/opt/homebrew/Cellar/pcre/8.45/lib -lpcre -L/opt/homebrew/Cellar/jansson/2.14/lib -ljansson -lexpat -lintl -ldl -framework CoreFoundation /Users/whitebear/.pyenv/versions/3.9.10/lib/python3.9/config-3.9-darwin/libpython3.9.a
  ld: library not found for -lintl
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  *** error linking uWSGI ***
  error: subprocess-exited-with-error
  
  × Running setup.py install for uwsgi did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/whitebear/.local/share/virtualenvs/aicomposer-Enqobsfe/bin/python -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/private/var/folders/bg/d6c8dpss5gg4qpnyy5y640rr0000gn/T/pip-install-o3nusm15/uwsgi_bf359134a4234fd890ca6dc16550331a/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /private/var/folders/bg/d6c8dpss5gg4qpnyy5y640rr0000gn/T/pip-record-30vh_20n/install-record.txt --single-version-externally-managed --compile --install-headers /Users/whitebear/.local/share/virtualenvs/aicomposer-Enqobsfe/include/site/python3.9/uwsgi
  cwd: /private/var/folders/bg/d6c8dpss5gg4qpnyy5y640rr0000gn/T/pip-install-o3nusm15/uwsgi_bf359134a4234fd890ca6dc16550331a/
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> uwsgi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Using pip 22.0.4 from /Users/whitebear/.local/share/virtualenvs/aicomposer-Enqobsfe/lib/python3.9/site-packages/pip (python 3.9)
Collecting uwsgi
  Using cached uwsgi-2.0.20.tar.gz (804 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: uwsgi
  Building wheel for uwsgi (setup.py): started
  Building wheel for uwsgi (setup.py): finished with status 'error'
  Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi: started
  Running setup.py install for uwsgi: finished with status 'error'


Solution 1:[1]

This https://github.com/unbit/uwsgi/issues/1364 post suggests to do:

brew update
brew unlink libxml2
brew uninstall libxml2

brew install --with-python libxml2
brew link libxml2 --force

(take care to have those one outside of any virtualenv it is mentioned) and then

pip install uwsgi

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Floh