undefined reference to `lzma_code'

2019-06-03 01:40发布

问题:

I try to pack my application and static link all libraries. But I get this error.The Makefile is shown below:

CC          = gcc
INCPATH     = -I/home/johnny/Application/FileBasedReG/include/RealityGrid
LIBS        = -L/home/johnny/Application/FileBasedReG/lib/RealityGrid -lReG_Steer -l:libxml2.a -l:libncurses.a -l:libm.a -l:libz.a -l:libtermcap.a

OBJECTS     = mini_steerer.o

TARGET      = mini_steerer

###### Compile ######
all: $(TARGET)

$(TARGET): $(OBJECTS)
    $(CC) $(INCPATH) -o $(TARGET) $(OBJECTS) $(LIBS)

mini_steerer.o: ./mini_steerer.c ./mini_steerer.h
    $(CC) -c $(INCPATH) -o mini_steerer.o ./mini_steerer.c

I think I need to add one or two more static libraries, but I can't find what they are.

回答1:

On a debian / ubuntu system, apt-get install liblzma-dev will do the trick. Link with -llzma.



回答2:

You're probably missing the liblzma.a, which should have come as a dependency from libxml2, if you had got it from a package.