six demon bag
Wind, fire, all that kind of thing!
2012-08-29
Linker Errors When Building Xlock on Debian
When building xlockmore (version 5.39) on one of my Debian boxes I encountered two linker issues, one with libxext
, the other with libcrypt
. Both issues persisted even after running configure with the --without-ext
and --without-crypt
options. WTF?! Why would anyone with at least half a brain provide --without-FEATURE
options for apparently required features?
Anyway, first error was ld reporting that it couldn't find libxext
:
gcc -g -O2 -o ../xlock/xlock ../xlock/xlock.o ../xlock/passwd.o ../xlock/resource.o ../xlock/parsecmd.o ../xlock/util.o ../xlock/logout.o ../xlock/mode.o ../xlock/xlockimage.o ../xlock/ras.o ../xlock/xbm.o ../xlock/vis.o ../xlock/visgl.o ../xlock/color.o ../xlock/random.o ../xlock/iostuff.o ../xlock/automata.o ../xlock/spline.o ../xlock/sound.o ../xlock/erase.o ../xlock/magick.o ../xlock/vtlock.o ../xlock/vtlock_proc.o anemone.o ant.o ant3d.o apollonian.o ball.o bat.o blot.o bouboule.o bounce.o braid.o bubble.o bug.o clock.o coral.o crystal.o daisy.o dclock.o decay.o deco.o deluxe.o demon.o dilemma.o discrete.o dragon.o drift.o euler2d.o eyes.o fadeplot.o fiberlamp.o flag.o flame.o flow.o forest.o fzort.o galaxy.o goop.o grav.o helix.o hop.o hyper.o ico.o ifs.o image.o juggle.o julia.o kaleid.o kumppa.o laser.o life.o life1d.o life3d.o lightning.o lisa.o lissie.o loop.o lyapunov.o mandelbrot.o marquee.o matrix.o maze.o mountain.o munch.o nose.o pacman.o penrose.o petal.o petri.o polyominoes.o puzzle.o pyro.o pyro2.o qix.o rain.o roll.o rotor.o scooter.o shape.o sierpinski.o slip.o space.o sphere.o spiral.o spline.o star.o starfish.o strange.o swarm.o swirl.o t3d.o tetris.o thornbird.o tik_tak.o toneclock.o triangle.o tube.o turtle.o vines.o voters.o wator.o wire.o world.o worm.o xcl.o xjack.o solitaire.o bomb.o blank.o random.o -lSM -lICE -lX11 -lXext -lm
/usr/bin/ld: cannot find -lXext
collect2: error: ld returned 1 exit status
make[1]: *** [../xlock/xlock] Error 1
Installing the respective development package resolved this issue.
apt-get install libxext-dev
The second issue were a couple undefined references to crypt(3)
in passwd.c
:
../xlock/passwd.o: In function `gpasskey':
/usr/src/xlockmore-5.39_test/xlock/passwd.c:692: undefined reference to `crypt'
../xlock/passwd.o: In function `checkPasswd':
/usr/src/xlockmore-5.39_test/xlock/passwd.c:1396: undefined reference to `crypt'
/usr/src/xlockmore-5.39_test/xlock/passwd.c:1415: undefined reference to `crypt'
collect2: error: ld returned 1 exit status
make[1]: *** [../xlock/xlock] Error 1
crypt(3)
is provided by the glibc
development package (libc6-dev
), which was already installed, so this time the reason had to be something other than a missing package. Looking at the command that raised the error I noticed that -lcrypt
was missing from the list of libraries:
gcc -g -O2 -o ../xlock/xlock ../xlock/xlock.o ../xlock/passwd.o ../xlock/resource.o ../xlock/parsecmd.o ../xlock/util.o ../xlock/logout.o ../xlock/mode.o ../xlock/xlockimage.o ../xlock/ras.o ../xlock/xbm.o ../xlock/vis.o ../xlock/visgl.o ../xlock/color.o ../xlock/random.o ../xlock/iostuff.o ../xlock/automata.o ../xlock/spline.o ../xlock/sound.o ../xlock/erase.o ../xlock/magick.o ../xlock/vtlock.o ../xlock/vtlock_proc.o anemone.o ant.o ant3d.o apollonian.o ball.o bat.o blot.o bouboule.o bounce.o braid.o bubble.o bug.o clock.o coral.o crystal.o daisy.o dclock.o decay.o deco.o deluxe.o demon.o dilemma.o discrete.o dragon.o drift.o euler2d.o eyes.o fadeplot.o fiberlamp.o flag.o flame.o flow.o forest.o fzort.o galaxy.o goop.o grav.o helix.o hop.o hyper.o ico.o ifs.o image.o juggle.o julia.o kaleid.o kumppa.o laser.o life.o life1d.o life3d.o lightning.o lisa.o lissie.o loop.o lyapunov.o mandelbrot.o marquee.o matrix.o maze.o mountain.o munch.o nose.o pacman.o penrose.o petal.o petri.o polyominoes.o puzzle.o pyro.o pyro2.o qix.o rain.o roll.o rotor.o scooter.o shape.o sierpinski.o slip.o space.o sphere.o spiral.o spline.o star.o starfish.o strange.o swarm.o swirl.o t3d.o tetris.o thornbird.o tik_tak.o toneclock.o triangle.o tube.o turtle.o vines.o voters.o wator.o wire.o world.o worm.o xcl.o xjack.o solitaire.o bomb.o blank.o random.o -lSM -lICE -lX11 -lXext -lm
configure
defines these libraries in the variable ${XLOCKLIBS}
, so I tried injecting -lcrypt
by pre-defining that variable:
XLOCKLIBS=-lcrypt ./configure ...
With this, the xlock
binary was built without any further issues.
One other problem presented itself on NIS clients, though. NIS users were only able to unlock a locked screen with their password after I had changed the mode of the xlock
binary from SGID to SUID:
chmod u+s,g-s $(which xlock)
Posted 02:03 [permalink]