EmbeddedRelated.com
Forums
Memfault Beyond the Launch

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

Started by Unknown January 12, 2014
Hi,

I build NE10 library for ARM on Ubuntu 12.04, 32 bit. The ARM library description said:

    Using static library

$arm-linux-gnueabihf-gcc �O2 -o sample sample.c  -I$NE10_INC_PATH -l:$NE10_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:$NE10_LIB_PATH/libNE10.a -lm

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

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

Thanks,
On Monday, January 13, 2014 5:36:58 AM UTC+2, rxj...@gmail.com wrote:
> I wonder the author made a mistake of -lm with the dynamic library. I am new to Linux. I would like to know the meaning of -lm. Could you help me?
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
On Monday, January 13, 2014 8:29:42 AM UTC+2, amrolla...@gmail.com wrote:
> 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?
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
On Monday, January 13, 2014 10:16:59 AM UTC+3:30, Artem wrote:
> On Monday, January 13, 2014 8:29:42 AM UTC+2, amrolla...@gmail.com wrote: > > > 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? > > > > 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

Memfault Beyond the Launch