libnl-3 includes broken? - linux

I am trying to use libnl 3 (http://www.infradead.org/~tgr/libnl/) under Ubuntu to use netlink in order to get some information from the IPv6 Neighbour Cache.
I am including a bunch of headers for this lib, but gcc already fails for the first one:
#include <libnl3/netlink/netlink.h>
There is no "main header", like libnl.h.
>$ gcc netlink_test.c
In file included from netlink_test.c:11:0:
/usr/include/libnl3/netlink/netlink.h:24:36: fatal error: netlink/netlink-compat.h: No such file or directory
compilation terminated.
The file netlink.h includes "netlink/netlink-compat.h". Unfortunately, there is no "/usr/include/netlink/" folder. There is only "/usr/include/libnl3/netlink/"
Including "netlink/netlink.h" thus gives me:
netlink_test.c:10:29: fatal error: netlink/netlink.h: No such file or directory
compilation terminated.
I have installed the following packages under Ubuntu 12.04:
libnl-3-200
libnl-3-200-dbg
libnl-3-dev
libnl-3-doc
libnl-genl-3-200
libnl-genl-3-200-dev
libnl-route-3-200
libnl-route-3-200-dev
Am I missing here something or is this genuinely broken?

OK, so the package is not broken, I am ;)
A short while ago, they introduced a mechanism to enable users to install different versions of this library.
Now you can configure it using "pkg-config" or just pass the precise directory to the compiler with "-I /usr/include/libnl3/".
And it works.

Related

GNU Prolog (glpc): error trying to execute as: No such file or directory

I'm trying to use the GNU Prolog Compiler to build an executable from my Prolog program like so:
$ gplc solution.prolog -o prog
and it's failing with a really cryptic error:
error trying to execute as: No such file or directory
I can't figure out what it's trying to tell me is missing. Does anyone know?
I'm using Fedora Silverblue 37, and glpc is running inside of a 'toolbox' that is also Fedora 37.
The issue appears to have been that I didn't have a C compiler installed. I installed the gcc package, and got a different error:
gcc: fatal error: cannot read spec file ‘/usr/lib/rpm/redhat/redhat-hardened-ld’: No such file or directory
Apparently to get that file, I needed to install the redhat-rpm-config package. I found that package name from this relevant comment on the RedHat bugzilla.
Compilation succeeds now!

warning libgfortran.so.3 needed by may conflict with libgfortran.so.5

while compiling I get the following warning:
/usr/bin/ld: warning: libgfortran.so.3, needed by /usr/openmpi-4.0.3rc4/lib64/libmpi_usempi.so, may conflict with libgfortran.so.5
It does create the .exe but when executing it an error occurs:
ideal.exe: error while loading shared libraries: libgfortran.so.5: cannot open shared object file: No such file or directory
I search for it to try and link it but it didn't work
whereis libgfortran.so.5
libgfortran.so: /usr/lib64/libgfortran.so.3
I don't have much knowlegde about linux or compilers and I'm working on a SUSE server without sudo permission. The gnu fortran compiler I'm using is in my home directory /home/gomezmr/gcc . Does anyone know how to solve this? Thank you.
Your OpenMPI library was compiled for a different version of GCC/gfortran than the version you are using for compiling. The MPI library must be compiled for the same compiler version that you are using for compiling.
In simple cases it may happen that it will somehow work anyway, but problems like yours can happen. When using the mpi or mpi_f08 modules, the major release version must match (e.g. both GCC9 or both GCC 11,...).

arm-none-eabi-objdump: error while loading shared libraries: libdebuginfod.so.1: cannot open shared object file

If you have an answer for this, or further information, I'd welcome it. I'm following advice from here, to offer some unsolicited help by posting this question then an answer I've already found for it.
I have a bare-metal ARM board for which I'm building a cross-toolchain, from sources for GNU binutils, gcc and gdb, and for SourceWare's Newlib. I got those four working and cross-built a DoNothing.c into an ELF file - but I couldn't disassemble it with this:
$ arm-none-eabi-objdump -S DoNothing.elf
The error was:
$ arm-none-eabi-objdump: error while loading shared libraries: libdebuginfod.so.1: cannot open shared object file: No such file or directory
I'll follow up with a solution.
The error was correct - my system didn't have libdebuginfod.so.1 installed - but I have another cross-binutils, installed from binary for a different target, and its objdump -S works fine on the same host. Why would one build of objdump complain about missing that shared library, when clearly not all builds of objdump need it?
First I tried rebuilding cross binutils, specifying --without-debuginfod as a configure option. No change, which seems odd: surely that should build tools that not only don't use debuginfod but which don't depend on it in any way. (If someone can answer that, or point out what I've misunderstood, it may help people.)
Next I figured debuginfod was inescapable (for my cross-tools built from source at least), so I'd install it to get rid of the error. It's a component of the elfutils package, but installing the latest elfutils available for my Ubuntu 20.04 system didn't bring libdebuginfod.so.1 with it.
I found a later one, for Arch Linux, whose package contents suggested it would - but its package format doesn't match Ubuntu's and installing it was going to involve a lot of work. Instead I opted to build it from the Arch Linux source package. However, running ./configure on that gave a couple of infuriatingly similar errors:
configure: checking libdebuginfod dependencies, --disable-libdebuginfod or --enable-libdebuginfo=dummy to skip
...
configure: error: dependencies not found, use --disable-libdebuginfod to disable or --enable-libdebuginfod=dummy to build a (bootstrap) dummy library.
No combination of those suggestions would allow configure for elfutils-0.182 to run to completion.
The problem of course was my own lack of understanding. The solution came from the Linux From Scratch project: what worked was to issue configure with both of the suggested options, like this:
$ ./configure --prefix=/usr \
--disable-debuginfod \
--enable-libdebuginfod=dummy \
--libdir=/lib
That gave a clean configure; make worked first time, as did make check and then sudo make install which of course installed libdebuginfod.so.1 as required. I then had an arm-none-eabi-objdump which disassembles cross-compiled ELF files without complaining.

Compiling alsa-lib with Buildroot: C preprocessor fails sanity check

Trying to compile a Linux image for LPC3250 ARM using Buildroot.
Stock settings, it compiles fine.
I'm getting this error when I try to add alsa-lib and alsa-utils:
configure: error: in `/home/user/projects/buildroot/output/build/alsa-lib-1.0.26 ':
configure: error: C preprocessor "/home/user/projects/buildroot/output/host/usr/ bin/arm-buildroot-linux-uclibcgnueabi-cpp" fails sanity check
See `config.log' for more details
Excerpt of alsa-lib's config.log. It kinda sucks because half the error messages have been cut off for some reason:
/home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/features.h:219:5: error: #error It appears you have defined _FILE_OF$
In file included from /home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/stdio.h:72,
from conftest.c:12:
/home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/uClibc_stdio.h:61:2: error: #error Sorry... uClibc was built wi$
In file included from conftest.c:12:
/home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/stdio.h:83: error: expected '=', ',', ';', 'asm' or '__attribute__' $
In file included from conftest.c:12:
/home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/stdio.h:721: error: expected declaration specifiers or '...' before $
/home/user/projects/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/stdio.h:723: error: expected ';', ',' or ')' before '*' token
Similar question here says something about "unsetting" CPP and CPPFlags.
Not sure where I would do this or check for it within the Buildroot environment. I'm not sure if this is even the same issue. I'm guessing its not related since in that other question it's talking about compiling GCC, which I'm not doing.
My #1 hunch right now is that I have to edit the configure file for lib-alsa. I'm just not sure what edits to make.
Edit: Did some aggressive Googling and came up with what I think is the full version of one of my errors: ...features.h:329:2: #error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, uClibc was built without large file support enabled.
Checked my uClibc config file and UCLIBC_HAS_LFS=y is present. ???
The root of the issue here is Buildroot is using the uClibc config file located at: output/toolchain/uClibc-0.9.33.2/.config
rather than toolchain/uClibc/uClibc-0.9.33.config as specified in the Buildroot configuration menu.
I ran make uclibc-menuconfig (which defaults to saving the configuration in .config) and selected General Library Settings->Large File Support and everything compiled just fine.
Well, output/toolchain/uClibc-0.9.33.2/.config is generated from toolchain/uClibc/uClibc-0.9.33.config when Buildroot configures and builds uClibc. So it doesn't make any sense to use output/toolchain/uClibc-0.9.33.2/.config as the uClibc configuration. You should leave the default of toolchain/uClibc/uClibc-0.9.33.config.
Regarding Large File Support, normally all the packages have a proper dependency on it. So if a package needs large file support, the package cannot be selected until you enable large file support in Buildroot. If it is not the case, then it is a bug, and the Buildroot community would be interested in having a bug report about this (which details the Buildroot version being, the Buildroot configuration file being used, and the build error that you get).
Now, if Large File support is indeed needed, you should enable it at the Buildroot level rather than at the uClibc level. If you enable it only at the uClibc level, then Buildroot will not now about this, and will not show you all the packages that have a dependency on large file support.
So, what you should do is enable the BR2_TOOLCHAIN_BUILDROOT_LARGEFILE configuration option in Buildroot, and then do a complete rebuild: make clean all.

Building GCC 4.6 - libmpfr.so.4 - cannot open shared object file

I'm trying to build GCC 4.6 under CentOS release 5.5 (Final). I've freshly built GMP-5.0.1, MPC-0.9, and MPFR-3.0.1, and have used the following configure command:
../configure --prefix=/users/xxxx/apps/mygcc4.6 --disable-checking --enable-threads=posix --enable-languages=c,c++,fortran --with-mpfr=/users/xxxx/code/gcc/mpfr-3.0.1-install-cyprus --with-gmp=/users/xxxx/code/gcc/gmp-5.0.1-install-cyprus --with-mpc=/users/xxxx/code/gcc/mpc-0.9-install-cyprus
After this, I run make and after about 5 minutes get the following error message:
checking for suffix of object files... configure: error: in /users/xxxx/code/gcc/gcc-4.6.0/obj/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
Seeconfig.log' for more details.
The config.log indicates that a recently generated program (cc1) is involved:
/users/xxxx/code/gcc/gcc-4.6.0/obj/./gcc/cc1
Indeed if I run this program with no arguments I get the same error message found in config.log:
error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
However, libmpfr.so.4 is in the lib subdirectory of that provided to configure using the --with-mpfr flag, as seen above. I have LD_LIBRARY_PATH and LIBRARY_PATH empty. Any idea how I can get past this error?
Make sure your library is acutally in the directory given and not in some lib subdirectory. Use export LD_LIBRARY_PATH=/users/xxxx/code/gcc/mpfr-3.0.1-install-cyprus as you have already suggested ;-)
I know this thread is pretty outdated. But, I had to comment and say that after 5+ hours of banging my head against the wall on a very similar issue (checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile) and having read the install manual, a multitude of forums, and trying various things on the system in question I found this brief but very useful post. The issue was precisely related to LD_LIBRARY_PATH.
Long story short, when building from source if you hit this wall export the LD_LIBRARY_PATH variable to point into the source build directory for the libs.
Worked for me anyway.
Good luck folks.
I know that this thread is pretty outdated. I faced similar issues while installing mpfr on WSL. The build was fine and mpfr installed correctly but when I wrote a small C file to see if I could access the header file and print the version fo the installation - I could compile the C file but When I tried to run the compiled object - it would give me an error. The C file was,
#include <stdio.h>
#include <mpfr.h>
int main (void) {
printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n",
mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
return 0;
}
I was compiling this with,
gcc -o version mpfr_presence.c -lmpfr -lgmp
But when I tried to run this with ./version, I would get the following error,
./version: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory
I solved this error using,
sudo apt-get update
sudo apt-get install libmpfr4
And then when it said that libmpfr4 was already at its latest version, just to be sure,
sudo apt-get install --reinstall libmpfr4
Now ./version gives me,
MPFR library: 4.0.1
MPFR header: 4.0.1 (based on 4.0.1)

Resources