Skip to content

Instantly share code, notes, and snippets.

@loe
Created February 8, 2009 06:25
Show Gist options
  • Save loe/60256 to your computer and use it in GitHub Desktop.
Save loe/60256 to your computer and use it in GitHub Desktop.
have_library: checking for magic_open() in -lmagic... -------------------- no
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64 -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fPIC conftest.c -L. -L/usr/lib -L. -rdynamic -Wl,-export-dynamic -lruby-static -lmagic -lpthread -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:3: error: 'magic_open' undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))magic_open; return 0; }
/* end */
"gcc -o conftest -I. -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64 -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fPIC conftest.c -L. -L/usr/lib -L. -rdynamic -Wl,-export-dynamic -lruby-static -lmagic -lpthread -ldl -lcrypt -lm -lc"
conftest.c: In function 't':
conftest.c:3: warning: implicit declaration of function 'magic_open'
/usr/bin/ld: cannot find -lmagic
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { magic_open(); return 0; }
/* end */
--------------------
@craigmarksmith
Copy link

Hi, did you work out how to fix this error message?

@loe
Copy link
Author

loe commented Sep 6, 2010

I believe this fails because it doesn't find the header files, be sure you have Image/GraphicsMagick installed.

@caiofbpa
Copy link

It doesn't seem to be related to ImageMagick or GraphicsMagick, it should depend only on libmagic. Have you guys figured how to solve that? I have all of them installed and still have_library can't find it.

@caiofbpa
Copy link

Solved it by installing ruby-filemagic with the following command:

sudo env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment