What is arm-linux-gnueabihf-gcc flag -lm for?

Jan 13, 2014 4 Replies

Using static library



$arm-linux-gnueabihf-gcc ?O2 -o sample sample.c -I$NE10_INC_PATH -l:$NE1



0_LIB_PATH/libNE10.a


Using dynamic library



$arm-linux-gnueabihf-gcc ?O2 -o sample sample.c -I$NE10_INC_PATH -l:$NE10 _LIB_PATH/libNE10.so -lm


The puzzled thing is that when I use static library, it generates undefined reference error. If I build the application with:



$arm-linux-gnueabihf-gcc ?O2 -o sample sample.c -I$NE10_INC_PATH -l:$NE1



0_LIB_PATH/libNE10.a -lm

The application works on the ARM target, even without PATH variables includ ing libNE10.a library.



I wonder the author made a mistake of -lm with the dynamic library. I am ne w to Linux. I would like to know the meaning of -lm. Could you help me?



Thanks,


math library. sin, cos etc.

-lm = libm.so

-lGL = libGL.so etc.

Hi Artem

I have a question. During building a QT program, Qt Creator 3.0.0 compiler issues the following error: /usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status I had solved this problem by installing a library using apt-get or Ubuntu software center, but I can't recall. Which library should I install to wipe out this error?

TIA, -- Saeed Amrollahi Boyouki

libgl1-mesa*

$ dpkg -S libGL.so libgl1-mesa-dev: /usr/lib/x86_64-linux-gnu/mesa/libGL.so libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/libGL.so.1 libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 libgl1-mesa-dev: /usr/lib/x86_64-linux-gnu/libGL.so

Problem solved! I wrote it down. Thank you -- Saeed

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required