Yocto project cannot find asm/errno.h - gcc

I'm trying to compile a program that requires asm/errno.h header.
Building C object CMakeFiles/modem.dir/src/client.c.o
| /home/kristupas/yocto/oe-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc -Dmodem_EXPORTS -std=gnu99 -march=armv7-a -mfloat-abi=softfp -mfpu=neon --sysroot=/home/kristupas/yocto/oe-core/build/tmp-glibc/sysroots/mdm9607 -O2 -fexpensive-optimizations -frename-registers -fomit-frame-pointer -fPIC -I/home/kristupas/yocto/oe-core/build/tmp-glibc/work/armv7a-vfp-neon-oe-linux-gnueabi/libmodem/1.0-r0/libmodem/src -I/home/kristupas/yocto/oe-core/build/tmp-glibc/work/armv7a-vfp-neon-oe-linux-gnueabi/libmodem/1.0-r0/libmodem/include -o CMakeFiles/modem.dir/src/client.c.o -c /home/kristupas/yocto/oe-core/build/tmp-glibc/work/armv7a-vfp-neon-oe-linux-gnueabi/libmodem/1.0-r0/libmodem/src/client.c
| [ 83%] /home/kristupas/yocto/oe-core/build/tmp-glibc/work/armv7a-vfp-neon-oe-linux-gnueabi/libmodem/1.0-r0/libmodem/src/client.c:14:25: fatal error: asm/ernno.h: No such file or directory
| #include <asm/ernno.h>
^
The --sysroot argument is set correctly to my targets sysroot, but gcc still can't find the header, even though it's clearly there:
ls -la /home/kristupas/yocto/oe-core/tmp-glibc/sysroots/mdm9607/usr/include/asm/ | grep "errno\.h"
-rw-r--r-- 3 kristupas kristupas 31 Kov 9 16:06 errno.h
Doing
echo | /home/kristupas/yocto/oe-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc -R -Wp. -v -
returns this:
--includedir=/home/kristupas/yocto/oe-core/build/tmp-glibc/sysroots/x86_64-linux/usr/include
This is the include directory for the host, which does not contain asm/errno.h. Shouldn't it point to targets sysroot instead?

Turns out I misspelled errno and failed to notice it for hours!

Related

Building lrzip-next on cygwin on Windows 11

I've been trying to build lrzip-next on cygwin on Windows 11 but I couldn't succeed.
I end up with this error:
Making install in src
make[1]: ingresso nella directory «/cygdrive/c/Users/giova/Downloads/lrzip-next-0.10.0/src»
depbase=`echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I.. -I . -I .. -I ../src/include -I ../src/lzma/include -g -O2 -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.c &&\
mv -f $depbase.Tpo $depbase.Po
main.c: In function ‘main’:
main.c:351:20: warning: ‘optind’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
351 | extern int optind;
| ^~~~~~
main.c:505:49: error: ‘PRIO_MIN’ undeclared (first use in this function)
505 | if (control->nice_val < PRIO_MIN || control->nice_val > PRIO_MAX)
| ^~~~~~~~
main.c:505:49: note: each undeclared identifier is reported only once for each function it appears in
main.c:505:81: error: ‘PRIO_MAX’ undeclared (first use in this function); did you mean ‘PRIoMAX’?
505 | if (control->nice_val < PRIO_MIN || control->nice_val > PRIO_MAX)
| ^~~~~~~~
| PRIoMAX
make[1]: *** [Makefile:551: main.o] Error 1
make[1]: uscita dalla directory «/cygdrive/c/Users/giova/Downloads/lrzip-next-0.10.0/src»
make: *** [Makefile:502: install-recursive] Error 1
I'm on Windows 11 22H2
I'm using cygwin version (uname -a output) CYGWIN_NT-10.0-22621 DellXPS15 3.4.5-1.x86_64 2023-01-19 19:09 UTC x86_64 Cygwin
I've tried asking for suggestion on the github issue page but I was told windows is not a supported platform, but since cygwin should enable software such as this to run (and in fact the normal lrzip version is actually included in cygwin's repo) I was wonder whether there was anything I could do to make it run on this platform.
Does anyone have any suggestion?
Here is the full build log.

cross-compile iperf from x86_64 for ARM64 target

I want to cross compile iperf-2.0.5 from my x86_64 ubuntu linux machine for a ARM64 target. Therefore I installed the cross compiler:
sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
then I tried to configure:
./configure --build=aarch64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --enable-static --disable-shared
which gives me this warning: configure: WARNING: unrecognized options: --enable-static, --disable-shared
apart from this warning i'm not getting any errors but I'm not sure how to verify that the build and host parameters are selected correctly.
When I run make I get the following error.
make all-recursive
make[1]: Entering directory '/home/recherma/Documents/iperf-2.0.5'
Making all in compat
make[2]: Entering directory '/home/recherma/Documents/iperf-2.0.5/compat'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -Wall -O2 -MT delay.o -MD -MP -MF ".deps/delay.Tpo" -c -o delay.o delay.cpp; \
then mv -f ".deps/delay.Tpo" ".deps/delay.Po"; else rm -f ".deps/delay.Tpo"; exit 1; fi
In file included from /usr/include/c++/9/stdlib.h:36,
from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/cstdlib:151:11: error: ‘::malloc’ has not been declared
151 | using ::malloc;
| ^~~~~~
In file included from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/stdlib.h:65:12: error: ‘std::malloc’ has not been declared
65 | using std::malloc;
| ^~~~~~
In file included from /usr/include/c++/9/cmath:42,
from /usr/include/c++/9/math.h:36,
from ../include/headers.h:85,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/bits/cpp_type_traits.h:214:12: error: redefinition of ‘struct std::__is_integer<int>’
214 | struct __is_integer<int>
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/cpp_type_traits.h:138:12: note: previous definition of ‘struct std::__is_integer<int>’
138 | struct __is_integer<bool>
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:273: delay.o] Error 1
make[2]: Leaving directory '/home/recherma/Documents/iperf-2.0.5/compat'
make[1]: *** [Makefile:252: all-recursive] Error 1
make[1]: Leaving directory '/home/recherma/Documents/iperf-2.0.5'
make: *** [Makefile:190: all] Error 2
So I guess the configuration failed. Does anyone know now to configure it correctly?
EDIT:
I think --host should be changed to aarch64-unknown-linux-gnu. But this changes nothing and I get the exact same errors.
Try removing DAST_CHECK_BOOL from configure.ac and try reconfigure again.
If that didn't help, after configure, comment #define bool int in config.h and try rebuild.

Problem installing ndless-sdk: error building genzehn

I am trying to install Ndless sdk on my Windows computer (with CygWin). I run
.../Ndless/ndless-sdk/toolchain/build_toolchain.sh
and I fixed all the problems with that. After that, according to the instructions, I went in the (top) Ndless directory and ran "make". It got stuck at this point and whatever I did, I could not get it to compile "genzehn"
.../Ndless/ndless-sdk/tools/genzehn/genzehn.cpp
What should I do?
The log(both stdout and stderr for make in "Ndless"):
https://pastebin.com/fpH6Mf2v
make all in genzehn...
make[3]: Entering directory '/Ndless/ndless-sdk/tools/genzehn'
g++ -Wall -Wextra -std=c++11 -I elfio-3.2 genzehn.cpp -lboost_program_options -lz -o ../../bin/genzehn || g++ -Wall -Wextra -std=c++11 -I elfio-3.2 genzehn.cpp -lboost_program_options-mt -lz -o ../../bin/genzehn
In file included from genzehn.cpp:12:
zehn.h:1:1: error: expected unqualified-id before ‘.’ token
1 | ../../include/zehn.h
| ^
genzehn.cpp: In function ‘int main(int, char**)’:
genzehn.cpp:96:9: error: ‘Zehn_header’ was not declared in this scope; did you mean ‘gz_header’?
96 | Zehn_header header;
| ^~~~~~~~~~~
| gz_header

gcc compile error ld cannot find -l Permission denied

When I execute:
gcc D:\project\c\test\collection -Wall -o test main.c -lfoo
it reports the error:
D:\project\c\test\collection>gcc D:\project\c\test\collection -Wall -o test main.c -lfoo
d:/gcc-9.2.0-no-debug/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find D:\project\c\test\collection: Permission denied
d:/gcc-9.2.0-no-debug/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -lfoo
collect2.exe: error: ld returned 1 exit status
I followed the steps found here: gcc example
My OS is Windows 10 and I use cmd with administrator role.
UPDATE 1
I execute:
gcc -L D:\project\c\test\collection -Wall -o test main.c -lfoo
and get the error:
gcc -L D:\project\c\test\collection -Wall -o test main.c -lfoo
d:/gcc-9.2.0-no-debug/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lfoo
collect2.exe: error: ld returned 1 exit status
My collection directory has libfoo.so file:
2019/12/28 11:19 <DIR> .
2019/12/28 11:19 <DIR> ..
2019/12/28 10:55 3,262 a.exe
2019/12/28 10:38 87 foo.c
2019/12/28 10:37 80 foo.h
2019/12/28 10:38 838 foo.o
2019/12/28 10:38 47,372 libfoo.so
2019/12/28 10:38 134 main.c
UPDATE 2
I change to execute:
gcc -L / -Wall -o test main.c
and get the error:
//libfoo.dll.a: Unrecognized file: File truncated,collect2.exe: error: ld returned 1 exit status
gcc D:\project\c\test\collection -Wall -o test main.c -lfoo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Files that aren't part of an option (like -o test or -lfoo) are generally considered to be input files for compiling or linking.
There's a good chance that's meant to be a library location for locating the foo library, simply because the tutorial you're following has almost the exact same line:
gcc -L/home/username/foo -Wall -o test main.c -lfoo
If that's the case, then you're missing the -L to tell it this should be added to the library search path, so something like this should fix it:
gcc -L D:\project\c\test\collection -Wall -o test main.c -lfoo
In any case, since you appear to have all your files in a single directory (source, libs, etc), you don't need to adjust the search path. Or, if you do, you can just used -L. to specify the current directory, something like:
gcc -Wall -o test main.c -L. -lfoo

Building zookeeper 3.4.12 c client on solaris machine fails with libtool error

I am trying to build zookeeper 3.4.12 c client on the Solaris machine. Below are the steps that I followed,
unzip/untar the source tarball and cd to the zookeeper-x.x.x/src/c
directory.
Do a "./configure [OPTIONS]" to generate the makefile.
./configure --without-cppunit
This step fails with below error,
/bin/sh ./libtool --tag=CC --mode=link gcc -Wall -Werror -g -O2
-D_GNU_SOURCE -no-undefined -version-info 2 -lnsl -lsocket -export-symbols-regex '(zoo_|zookeeper_|zhandle|Z|format_log_message|log_message|logLevel|deallocate_|allocate_|zerror|is_unrecoverable)'
-o libzookeeper_st.la -rpath /usr/local/lib libzkst.la libhashtable.la libtool: link: /bin/nm -p ./.libs/libzkst.a ./.libs/libhashtable.a | | /bin/gsed 's/.* //' | sort | uniq > .libs/libzookeeper_st.exp ./libtool[1732]: eval: syntax error at line 1: `|' unexpected
*** Error code 3 make: Fatal error: Command failed for target `libzookeeper_st.la'
Any idea on the error?
Regards,
Ashwini.
The error is because you're missing a command in this portion of the command line:
... ./.libs/libzkst.a ./.libs/libhashtable.a | | /bin/gsed 's/.* //' ...
If you can find that recipe in the Makefile, there's probably a $(something) there that's expanded to an empty string, thus attempting a null command in the pipeline.
Found the issue. There was something like this in make file :
"libzookeeper_st.la: $(libzookeeper_st_la_OBJECTS) $(libzookeeper_st_la_DEPENDENCIES) $(AM_V_CCLD)$(libzookeeper_st_la_LINK) -rpath $(libdir)".
Where in if I remove -rpath $(libdir) everything builds properly.
Dont know what -rpath $(libdir) does. -rpath $(libdir) expands to "-rpath /usr/local/lib". But this resolves the issue.

Resources