platformio / platform-lattice_ice40

Lattice iCE40: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/lattice_ice40
Apache License 2.0
39 stars 15 forks source link

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

Closed ivankravets closed 4 years ago

ivankravets commented 6 years ago

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 commented 6 years ago

@Jesus89 do you have an updated toolchain?

Jesus89 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

abuisman commented 6 years ago

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

ivankravets commented 5 years ago

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

hqms commented 5 years ago

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 commented 5 years ago

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

sqaview commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

freeslugs commented 4 years ago

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

freeslugs commented 4 years ago

This will do the trick

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

then try ffmpeg

diegoulloao commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I fixed it this way on macos:

brew reinstall php
TianyiShi2001 commented 4 years ago

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 commented 4 years ago

brew reinstall libffi fixed this for me.

sosaucily commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

agilebean commented 2 years ago

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 commented 2 years ago

macOS 12.1 Monterey

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

bsikander commented 2 years ago

@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 commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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

edmondja commented 7 months ago

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

I love you dude, nothing works besides your method.

Dorapopy commented 7 months ago

裴雪琴已收到,会尽快回复