I get the following error while compiling xpdf using make. I've tried using the command: LIBS=-l make but it doesn't work. I know the problem is that the c compiler cannot recognise the math code in the source code because the math library is not available to it, but I don't know how to fix it.

[ 71%] Linking CXX executable pdftohtml 
    /usr/bin/ld: CMakeFiles/xpdf_objs.dir/Gfx.cc.o: undefined reference to symbol 'acos@@GLIBC_2.2.5'
    //usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    make[2]: *** [xpdf/CMakeFiles/pdftohtml.dir/build.make:219: xpdf/pdftohtml] Error 1
    make[1]: *** [CMakeFiles/Makefile2:428: xpdf/CMakeFiles/pdftohtml.dir/all] Error 2
    make: *** [Makefile:130: all] Error 2

I have put my Makefile and CmakeLists.txt on pastebin for more information.

  • Well, the issue seems to be that your link command is missing -lm ("DSO missing from command line") but I don't know enough about cmake to suggest a fix - and it's probably more a question for stackoverflow than for askubuntu Jun 12, 2018 at 19:28
  • @steeldriver I was thinking thesame. I don't quite know how to add it to the command line.
    – bit
    Jun 12, 2018 at 19:46
  • Something like this perhaps? Math functions not working with “make” in C Jun 12, 2018 at 19:50
  • @steeldriver thanks for the link. I read it but I couldn't find the code add_executable in the CmakeList.txt file.
    – bit
    Jun 12, 2018 at 20:26
  • So whose code is it? where did you get it? did you write the CMakeList.txt file yourself? Jun 12, 2018 at 20:46

1 Answer 1


After debugging the code, the solution I used was to add -lpaper to the DCMAKE_CXX_FLAGS or the DCMAKE_EXE_LINKER_FLAGS during the cmake command, either works. Thanks @steeldriver for very good insights.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .