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

dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib #7

Closed
ivankravets opened this issue Feb 5, 2018 · 37 comments
Closed
Assignees
Labels

Comments

@ivankravets
Copy link
Member

ivankravets commented Feb 5, 2018

macOS

yosys -p "synth_ice40 -blif .pioenvs/icestick/hardware.blif" -q src/counter.v
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
Referenced from: /Users/ikravets/.platformio/packages/toolchain-icestorm/bin/yosys
Reason: image not found
@ivankravets
Copy link
Member Author

@Jesus89 do you have an updated toolchain?

@Jesus89
Copy link
Collaborator

Jesus89 commented Feb 6, 2018

Hi @ivankravets!

The toolchain is the same. You need to install libffi in Mac OS in order to execute yosys. The same for libftdi to enable uploading the bitstream to the FPGA.

I use brew to install these packages.

@ivankravets
Copy link
Member Author

Do you need header files of libffi? If no, we can put libffi.6.dylib directly to that package in the folder where binary file is located. In this case, no need to install brew or libffi. What do you think?

@jcw
Copy link

jcw commented Mar 13, 2018

Yep, can confirm, same issue here. Solved with brew install libffi. No headers involved, AFAICT.

@abuisman
Copy link

In my case linking libffi (which was already installed, but unlinked) fixed the issue

@ivankravets
Copy link
Member Author

@jcw @abuisman could run brew uninstall libffi and run pio update? Does it work now?

@hqms
Copy link

hqms commented Nov 15, 2018

In my case linking libffi (which was already installed, but unlinked) fixed the issue

or you can export variables to determine the libraries

libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

@ivankravets
Copy link
Member Author

@hqms what is your macOS version? Do you use the latest version of dev/platform?

@sqaview
Copy link

sqaview commented Mar 15, 2019

I'm running macOS Mojave, 10.14.2
I had to uninstall libffi, then reinstall it:

brew uninstall libffi
brew install libffi

And then, set the env vars in my .bash_profile as indicated above:

# homebrew required vars
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

That worked 👍

@tomachinz
Copy link

I got it working after a re-install of libffi, without changing my env vars.

I got this message about Brew refusing to link macOS-provided software on the way but all was well...


➜   brew install libffi
Updating Homebrew...
Warning: libffi 3.2.1 is already installed, it's just not linked
You can use `brew link libffi` to link this version.
➜   brew link libffi
Warning: Refusing to link macOS-provided software: libffi
For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
➜   brew uninstall libffi
➜   brew install libffi
Uninstalling /usr/local/Cellar/libffi/3.2.1... (16 files, 296.9KB)
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.2.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libffi-3.2.1.mojave.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/libffi/3.2.1: 16 files, 296.8KB

Seems to work!

➜   ffmpeg
ffmpeg version 4.1.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.4_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

@manjeethike
Copy link

I'm running macOS Mojave, 10.14.2
I had to uninstall libffi, then reinstall it:

brew uninstall libffi
brew install libffi

And then, set the env vars in my .bash_profile as indicated above:

# homebrew required vars
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

That worked 👍

@neowinston
Copy link

In my case I had installed both libffi 3.2.1 and libffi 3.3, then I switched from 3.3 back to 3.2.1 like so:

brew switch libffi 3.2.1

@pedrorrivero
Copy link

As of today, dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib pops up when calling ffmpeg on a fresh install of libffi.

/usr/local/opt/libffi/lib/libffi.6.dylib does not exist anymore apparrently, it has been renamed to /usr/local/opt/libffi/lib/libffi.7.dylib.

I fixed the issue by running:

cp 
/usr/local/opt/libffi/lib/libffi.7.dylib /usr/local/opt/libffi/lib/libffi.6.dylib

Notice however that when libffi is installed through hombrew (i.e. brew install libffi), it creates a symlink /usr/local/opt/libffi/lib/libffi.dylib to /usr/local/opt/libffi/lib/libffi.7.dylib. That suggests that ffmpeg should start using this alternative path instead to avoid any errors.

@saleh-old
Copy link

I ended up fixing it by downgrading libffi using this guide:
https://dae.me/blog/2516/downgrade-any-homebrew-package-easily

@freeslugs
Copy link

yeah man it's just a different version libffi.6.dylib vs libffi.7.dylib

@freeslugs
Copy link

This will do the trick

cd /usr/local/opt/libffi/lib
ln -s libffi.7.dylib libffi.6.dylib

then try ffmpeg

@diegoulloao
Copy link

This will do the trick

cd /usr/local/opt/libffi/lib
ln -s libffi.7.dylib libffi.6.dylib

then try ffmpeg

Yes, that works!!!! thanks.

@tupizz
Copy link

tupizz commented Jun 4, 2020

In my case I had installed both libffi 3.2.1 and libffi 3.3, then I switched from 3.3 back to 3.2.1 like so:

brew switch libffi 3.2.1

tyyy

@scqin
Copy link

scqin commented Jun 8, 2020

As of today, dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib pops up when calling ffmpeg on a fresh install of libffi.

/usr/local/opt/libffi/lib/libffi.6.dylib does not exist anymore apparrently, it has been renamed to /usr/local/opt/libffi/lib/libffi.7.dylib.

I fixed the issue by running:

cp 
/usr/local/opt/libffi/lib/libffi.7.dylib /usr/local/opt/libffi/lib/libffi.6.dylib

Notice however that when libffi is installed through hombrew (i.e. brew install libffi), it creates a symlink /usr/local/opt/libffi/lib/libffi.dylib to /usr/local/opt/libffi/lib/libffi.7.dylib. That suggests that ffmpeg should start using this alternative path instead to avoid any errors.

Thank you very much indeed! Your suggestion
"cp /usr/local/opt/libffi/lib/libffi.7.dylib /usr/local/opt/libffi/lib/libffi.6.dylib" solved my problem (after spending two nights trying to install why3 (before frama-c) but got stuck due to this problem. Does anybody know why not everyone has this issue? Why ....6.dylib is required by there is only a ....7.dylib? Three of us installed the same thing and the other two didn't have this issue at all

@gilles6
Copy link

gilles6 commented Jun 30, 2020

I fixed it this way on macos:

brew reinstall php

@TianyiShi2001
Copy link

This will do the trick

cd /usr/local/opt/libffi/lib
ln -s libffi.7.dylib libffi.6.dylib

then try ffmpeg

That magically works! Thank you!

@obrien-k
Copy link

brew reinstall libffi fixed this for me.

@sosaucily
Copy link

For me this error was being thrown when running pod install on a Flutter project.

I needed to gem install a newer version of ffi.

@kumardurgesh91
Copy link

kumardurgesh91 commented Mar 22, 2021

Updating libffiworked for me on macOS catalina 10.15.6
`brew install libffi
Error: libffi 3.3_2 is already installed.
To upgrade to 3.3, run:
brew upgrade libffi

❯ brew upgrade libffi
==> Upgrading 1 outdated package:
libffi 3.3_2 -> 3.3_3
==> Upgrading libffi 3.3_2 -> 3.3_3
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.3_3.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libffi-3.3_3.catalina.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"

For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/libffi/3.3_3: 17 files, 540.3KB
Removing: /usr/local/Cellar/libffi/3.2.1... (16 files, 297.0KB)
Removing: /usr/local/Cellar/libffi/3.3_2... (17 files, 540.5KB)
==> Upgrading 7 dependents:
cairo 1.16.0_2 -> 1.16.0_5, glib 2.62.0 -> 2.68.0, gnutls 3.6.9 -> 3.6.15, harfbuzz 2.6.1 -> 2.8.0, libass 0.14.0_1 -> 0.15.0, p11-kit 0.23.17 -> 0.23.22, ffmpeg 4.1.4_2 -> 4.3.2_1

..........
.........

==> gnutls
If you are going to use the Guile bindings you will need to add the following
to your .bashrc or equivalent in order for Guile to find the TLS certificates
database:
export GUILE_TLS_CERTIFICATE_DIRECTORY=/usr/local/etc/gnutls/`

@yeukfei02
Copy link

yeukfei02 commented Oct 14, 2021

same issue but no this lib, I am using rails in mac m1.

already done brew install libffi

rails --help got a similar error.

Library not loaded: /opt/homebrew/opt/libffi/lib/libffi.7.dylib (LoadError)

fixed with this:

cp /opt/homebrew/opt/libffi/lib/libffi.8.dylib /opt/homebrew/opt/libffi/lib/libffi.7.dylib

thanks the above answer

@shkim21
Copy link

shkim21 commented Oct 22, 2021

check the libffi path.
in my case, /opt/homebrew/opt/libffi/lib/libffi.7.dylib .
thanks to @pedrorrivero , i resolve the problem. thank you.

cp /opt/homebrew/opt/libffi/lib/libffi.8.dylib /opt/homebrew/opt/libffi/lib/libffi.7.dylib

this works for me.

@ilessing
Copy link

some brew install upgraded my libffi which broke php@7.4 command line application.
I was getting error:

dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.7.dylib
  Referenced from: /usr/local/opt/php@7.4/bin/php
  Reason: image not found
Abort trap: 6

My system: MacOS Mojave

system_profiler SPSoftwareDataType  -detailLevel mini
Software:
    System Software Overview:
      System Version: macOS 10.14.6 (18G9323)
      Kernel Version: Darwin 18.7.0

was able to fix it with:

cd /usr/local/opt/libffi/lib
ln -s libffi.8.dylib libffi.7.dylib

in other words I linked libffi.7.dylib to libffi.8.dylib
at which point my PHP version 7.4 CLI app started working again.

@scottrblock
Copy link

some brew install upgraded my libffi which broke php@7.4 command line application. I was getting error:

dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.7.dylib
  Referenced from: /usr/local/opt/php@7.4/bin/php
  Reason: image not found
Abort trap: 6

My system: MacOS Mojave

system_profiler SPSoftwareDataType  -detailLevel mini
Software:
    System Software Overview:
      System Version: macOS 10.14.6 (18G9323)
      Kernel Version: Darwin 18.7.0

was able to fix it with:

cd /usr/local/opt/libffi/lib
ln -s libffi.8.dylib libffi.7.dylib

in other words I linked libffi.7.dylib to libffi.8.dylib at which point my PHP version 7.4 CLI app started working again.

thanks @ilessing, this also worked for me!

@viertelb
Copy link

This helped me use my old easy-tag on High Sierra after brew updated.

@agilebean
Copy link

agilebean commented Dec 29, 2021

Notice however that when libffi is installed through hombrew (i.e. brew install libffi), it creates a symlink /usr/local/opt/libffi/lib/libffi.dylib to /usr/local/opt/libffi/lib/libffi.7.dylib. That suggests that ffmpeg should start using this alternative path instead to avoid any errors.

Note For M1 (Apple Silicon) Chips:
The libraries are stored on different paths so linking is done by:

# libffi linking
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

@loong0306
Copy link

macOS 12.1 Monterey

cd /usr/local/opt/libffi/lib
ln -s libffi.8.dylib libffi.6.dylib

@bsikander
Copy link

@dragon-yuan solution works for Monterey. In my case, I was using python 3.7 and it was requiring libffi.7.dylib. So, i created a soft link for that.

cd /usr/local/opt/libffi/lib
ln -s libffi.8.dylib libffi.7.dylib

@asad-shakil
Copy link

same issue but no this lib, I am using rails in mac m1.

already done brew install libffi

rails --help got a similar error.

Library not loaded: /opt/homebrew/opt/libffi/lib/libffi.7.dylib (LoadError)

fixed with this:

cp /opt/homebrew/opt/libffi/lib/libffi.8.dylib /opt/homebrew/opt/libffi/lib/libffi.7.dylib

thanks the above answer

I've tried every other solutions but only this one worked for My M1 Mac.

@LuigiVampa92
Copy link

Faced the same issue. In my case libffi.6.dylib wasn't loading. Seems that some other library tries to load a direct version of ffilib instead of its general symlink. I only had libffi.8.dylib version:

$ cd /opt/local/lib
$ ls -la | grep libffi
-rwxr-xr-x   1 root     admin    71176 сен 24 08:34 libffi.8.dylib
-rw-r--r--   1 root     admin    42456 сен 24 08:34 libffi.a
lrwxr-xr-x   1 root     admin       14 сен 24 08:34 libffi.dylib -> libffi.8.dylib

So I had to make a copy of lib and rename in to 6, and made a 7 copy as well, just in case. After that everything was fixed and my software started working:

sudo cp /opt/local/lib/libffi.8.dylib /opt/local/lib/libffi.7.dylib
sudo cp /opt/local/lib/libffi.8.dylib /opt/local/lib/libffi.6.dylib

Hope it helps someone

@Dorapopy
Copy link

fixed this for me:
pip3 install --force-reinstall cryptography

@edmondja
Copy link

fixed this for me: pip3 install --force-reinstall cryptography

I love you dude, nothing works besides your method.

@Dorapopy
Copy link

Dorapopy commented Feb 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests