11-15-2020 08:53 PM
Hi All
I have 2 PC, the one is Windows, the another is NI Linux RT on PXI system
I want to create compilation environment using Eclipse 2017 on Windows
so i followed NI tutorial: Getting Started with C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition.
and i get the following errors:
cannot find crt1.o: No such file or directory
cannot find crti.o: No such file or directory
cannot find crtbegin.o: No such file or directory
cannot find /lib/libc.so.6
cannot find /usr/lib/libc_nonshared.a
cannot find /lib/ld-linux-x86-64.so.2
I can find these files and i set path in "include or library path" in Eclipse,
but still not workout.
any ideas?
11-16-2020 04:37 AM - edited 11-16-2020 04:49 AM
Crosscompilation in Eclipse/GCC should not need to add the target include and library paths to your project. Instead you need to configure the Cross Settings->Prefix correctly. The Prefix is basically the name of your cross compilation target and there should be an according directory on your harddisk, most probably x86_64-nilrt-linux- from the paths you show. (And yes the hyphen at the end of that prefix name is important!)
11-17-2020 11:21 PM
Hi rolfk,
Thanks for your reply.
My Cross Complier settings which according NI tutorial,
Prefix:x86_64-nilrt-linux-
Path:c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux
but it's not work, console still show error that ld.exe cannot find library
like this
------------------------------------------------------------------------------------------------------------------------------
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find crt1.o: No such file or directory
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find crti.o: No such file or directory
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find crtbegin.o: No such file or directory
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find /lib/libc.so.6
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find /usr/lib/libc_nonshared.a
c:/build/17.0/x64/sysroots/i686-nilrtsdk-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc
/x86_64-nilrt-linux/4.9.2/ld.exe: cannot find /lib/ld-linux-x86-64.so.2
------------------------------------------------------------------------------------------------------------------------------
i can't figure out...
08-25-2021 09:12 AM
Any luck on this? I'm seeing a similar problem.
08-25-2021 10:37 AM
A Google search came up with an obscure linker flag (-lm) that fixed my problem what added. Good luck.
08-25-2021 04:36 PM
@ndo wrote:
A Google search came up with an obscure linker flag (-lm) that fixed my problem what added. Good luck.
That’s not obscure at all. The -l flag tells the gcc linker to search for a library or object file with the name “lib<expression following the l flag>.a/obj”
libm.a is the standard library containing mathematic functions such as fmax, fmin, fmod, sqrt, etc. If you use any standard C library function in your code you must make sure to add the according linker library flag to include the necessary library to your make command.
08-25-2021 05:02 PM
LOL! Yes. I came to realize that. I was including libc expecting the math.h functions to be in there for some reason.
--ndo
08-26-2021 03:11 AM
@ndo wrote:
LOL! Yes. I came to realize that. I was including libc expecting the math.h functions to be in there for some reason.
Nobody ever said that the whole standard C library with its header mess and separation into different libraries was particularly well designed. 😁
Instead it is, over the course of 40 years, an organically grown mess that can't be untangled at this time anymore without sacrificing backwards compatibility.