Hello, I have a question regarding the error of connot find -lm

Asked 2 years ago, Updated 2 years ago, 42 views

Hello! I am creating a development environment because I have to use the embedded board this time.

The board is an Artik board from Samsung and uses Fedora24. I wanted to debug with IDE, so I followed the link below to install it By default, Ubuntu used Eclipse.

https://developer.artik.io/documentation/developer-guide/ide/sysroot.html

When you run a build, you get the following error: cannot find -lm. For almost two weeks, I searched a lot with Google to solve errors whenever I had time, but I couldn't find a solution, so I wrote the question like this.

00:08:44 **** Incremental Build of configuration Debug for project rfid-serial-test1 ****
make all 
Building target: rfid-serial-test1
Invoking: Cross G++ Linker
arm-linux-gnueabihf-g++ -L"/opt/sysroots/artik-sysroot/usr/lib" --sysroot=/opt/sysroots/artik-sysroot -o "rfid-serial-test1" ./src/rfid-serial-test1.o -lartik-sdk-base
/opt/toolchains/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.4.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
collect2: error: ld returned 1 exit status
make: *** [rfid-serial-test1] Error 1

00:08:44 Build Finished (took 72ms)

I don't think I can find the libm

"find / -name libm.* * -print" If you search using this command, you will see the following.

/opt/sysroots/artik-sysroot/usr/lib/libm.so
/opt/sysroots/artik-sysroot/usr/lib/libm.so.6
/opt/toolchains/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/lib/libm.so.6
/opt/toolchains/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/libm.so
/opt/toolchains/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/libm.a
/usr/lib/x86_64-linux-gnu/libm.so
/usr/lib/x86_64-linux-gnu/libm.a
/usr/libx32/libm.so
/usr/libx32/libm.a
/usr/lib32/libm.so
/usr/lib32/libm.a

If you look at it, the libm file exists, but it doesn't seem to be able to find it ㅜㅜ How do I solve this?

Thank you in advance for your reply. :)

linux artik ubuntu

2022-09-21 20:05

1 Answers

If it's an error that exists when I try to find it, it's probably because it's not in LD_LIBRARY_PATH.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Required Library Pass

Please add it explicitly as follows.


2022-09-21 20:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.