Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I moved from Archlinux to Kubuntu 12.04 yesterday.

I compiled buildroot 2012.08 on Archlinux without any problem. Though on Kubuntu libcrypt seems to be broken. sysvinit can't find it anywhere. glibc-dev and all dependencies are installed.

How do I link to libcrypt? Or, which package containts that library?

bc-gcc   sulogin.o    -o sulogin
sulogin.o: In function `main':
sulogin.c:(.text+0x49d): undefined reference to `crypt'
collect2: ld returned 1 exit status
share|improve this question

Try adding '-lcrypt' after any objects used in linking; I've had a couple of instances where gcc would complain about crypt if -lcrypt wasn't near the end of the link list.

In other words, try something like:

gcc -D FOO -D BAR -W -Wall -pedantic -O2 foo.o bar.o -lnsl -lcrypt -o baz

as opposed to

gcc -D FOO -D BAR -W -Wall -pedantic -O2 -lnsl -lcrypt foo.o baz.o -o baz
share|improve this answer

undefined reference to 'crypt' is a linker error.

Try linking with -lcrypt : gcc ....-lcrypt

share|improve this answer
No. It tries to link, but can't. Configuration script changes linkage options. Specifically buildroot sets variable LCRYPT="-lcrypt" – sorush-r Sep 28 '12 at 9:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.