1

After much research, trying to find out how to link libraries to gcc, going to /usr/bin and /usr/lib confirming the stuff are there. When I try to compile my keygen file, this is the error it blurts out.

$ gcc keygen.c -W -Wall /usr/bin/libgcrypt-config
/usr/bin/libgcrypt-config: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

I've been told by numerous sources that I should compile this way to check if libgcrypt installed correctly.

$ gcc -o foo foo.c 'libgcrypt-config --cflags --libs'

But everytime I try to do that this is what it blurts out:

gcc: error: libgcrypt-config --cflags --libs: No such file or directory

I've confirmed that libgcrypt20 and libgcrypt20-dev are installed using dpkg --get-selections>installed. But I am just so utterly confused as to what may be wrong.

Any form of help would be much appreciated.

zodkc
  • 43
  • 1
  • 6
  • Did the person telling to do that also mention it may be worth your time to investigate whether you're trying to link non-matching *architectures* (i.e. 64bit lib against a 32bit process, or vice-versa) ? And fyi, the libgcrypt-config is a utility that should be executed inside ticks, not quotes. `\`` vs `'`. The key to the left of your keyboard top-row numeric `1`. Ex: `gcc -o foo foo.c \`libgcrypt-config --cflags --libs\`` – WhozCraig May 18 '16 at 10:16
  • Sorry for the trouble. I did come across the non-matching architectures in my research. I could barely understand them though. However, I used sudo apt-get install to install libgcrypt, I don't know if that's going to have problems. And Boy, oh boy, do I feel stupid. I was looking at images from two differents .pdfs. which uses fonts that make ' and ` look ridiculously similar. Thank you. That resolved my problem. – zodkc May 18 '16 at 10:30

1 Answers1

3

Try:

$ gcc -o foo foo.c `libgcrypt-config --cflags --libs`

` instead of '

David Ranieri
  • 39,972
  • 7
  • 52
  • 94
  • 1
    Yes, this resolved my problem. Thank you. The images I looked at which were from .pdfs used fonts that made ' and ` look very similar... Now I feel like an idiot. On that note though. what does text started and ended with ` signify when you're using it in this context? I would like to know. Thank you. – zodkc May 18 '16 at 10:32
  • You are welcome, everything you type between backticks is evaluated (executed) by the shell before the main command: http://unix.stackexchange.com/questions/27428/what-does-backquote-backtick-mean-in-bash – David Ranieri May 18 '16 at 12:27