# (libexif) - ERROR: Failed to build gem native extension.



## mela (Oct 28, 2018)

hey y'all

I'm setting up a ruby project here and when running a  `bundle install` I fail when building `exif 1.0.1`

I went and got libexif but during compile it fails it's checks. I'm wondering how I can go about debugging this situation? Seems that maybe ruby isn't able to find the `libexif/exif-data.h` headers and if that's the case maybe it's a simple fix of symlinking them to where it's searching. Some output from my shell:


```
current directory: /usr/home/melanie/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/exif-1.0.1/ext/exif
make "DESTDIR="
compiling exif.c
In file included from exif.c:2:
./data.h:4:10: fatal error: 'libexif/exif-data.h' file not found
#include <libexif/exif-data.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** Error code 1
```

When I look at the `mkmf.log` I catch this line here: `/usr/bin/ld: cannot find -lexif`

Any thoughts on where I can maybe pick this up? Thanks everyone!


----------



## SirDice (Oct 29, 2018)

Just install graphics/rubygem-exifr


----------



## mela (Oct 30, 2018)

hey SirDice, thanks a ton for the reply

My project is currently using this gem: https://github.com/tonytonyjan/exif

Granted when I replaced this gem with `exifr` (at your suggestion) I was able to get things to run and all seems right in the world. I'll talk with my project mates and see if we can move to this gem but _if we can't_ I'll need to get the above gem working _(for reference SirDice recommended this gem https://github.com/remvee/exifr)_

I actually managed to get exif 1.0.1 to compile yesterday using `$ CPATH=/usr/local/include gem install exif -v '1.0.1'` which got `libexif/exif-data.h` in scope

BUT! When trying to start rails I hit a new error:

`exif-1.0.1/lib/exif/exif.so: Undefined symbol "exif_data_free"`

At first I thought this may be an issue with the exif version, so I upgraded exif to 2.2.0 and used the above method with `CPATH` but still hit this error: `Undefined symbol "exif_data_free"`

I'm almost positive this has to do with something being weird during my compile because looking at the C code for `libexif` and `exif` I don't see why I'd hit this error...

https://github.com/tonytonyjan/exif...4d577bb43d17366cd1eb1c1c/ext/exif/data.c#L214

https://github.com/libexif/libexif/...c77eb28fe272d9a5b665/libexif/exif-data.c#L127

Any ideas? Thanks again SirDance!


----------

