"Static declaration of ‘memfd_create’ follows non-static declaration" Error while building Linux image using Yocto - static

I am building Linux Image using Yoctobuild system on Ubuntu 18.04 host machine. I am following steps provided over here. I am building for Colibri iMX6ULL computer-on-module. However, my build has failed and it is showing errors given below
declaration of ‘memfd_create’ follows non-static declaration
| static int memfd_create(const char *name, unsigned int flags)
| ^~~~~~~~~~~~
| In file included from /usr/include/x86_64-linux-gnu/bits/mman-linux.h:115:0,
| from /usr/include/x86_64-linux-gnu/bits/mman.h:45,
| from /usr/include/x86_64-linux-gnu/sys/mman.h:41,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/sysemu/os-posix.h:29,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/qemu/osdep.h:104,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/util/memfd.c:28:
| /usr/include/x86_64-linux-gnu/bits/mman-shared.h:46:5: note: previous declaration of ‘memfd_create’ was here
| int memfd_create (const char *__name, unsigned int __flags) __THROW;
| ^~~~~~~~~~~~
| /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/rules.mak:66: recipe for target 'util/memfd.o' failed
And this error:
| gcc -c -I. -I../lib -I../../git/lib -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -O2 -pipe -DHAVE_CONFIG_H -I../../git/debugfs/../e2fsck -DDEBUGFS ../../git/debugfs/quota.c -o quota.o
| ../../git/debugfs/../misc/create_inode.c:406:18: error: conflicting types for ‘copy_file_range’
| static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
| ^~~~~~~~~~~~~~~
| In file included from ../../git/debugfs/../misc/create_inode.c:19:0:
| /usr/include/unistd.h:1110:9: note: previous declaration of ‘copy_file_range’ was here
| ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
| ^~~~~~~~~~~~~~~
| gcc -c -I. -I../lib -I../../git/lib -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -O2 -pipe -DHAVE_CONFIG_H -I../../git/debugfs/../e2fsck -DDEBUGFS ../../git/debugfs/xattrs.c -o xattrs.o
| Makefile:422: recipe for target 'create_inode.o' failed
| make[2]: *** [create_inode.o] Error 1
| make[2]: *** Waiting for unfinished jobs....
The packages/tasks that were failed:
e2fsprogs_1.43.5
qemu_2.10.0
Can someone help me? I can't switch to ubuntu 16.04 but I think it should be working with my system as well.

This is a known issue at Toradex and is on the Roadmap, see issue #36657.
Fixes are already in the upstream layers, and we have updated our BSP repo. You can try this branch by using the LinuxImageV2.7-integration branch.

Related

_ASM_EXTABLE_HANDLE virtualization compilation failure

I'm trying to compile this project from github but I am running into the following error:
make -C /lib/modules/5.15.0-53-generic/build M=/home/jr/Documents/ProtoVirt modules EXTRA_CFLAGS="-g -DDEBUG"
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-53-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
CC [M] /home/jr/Documents/ProtoVirt/protovirt.o
In file included from /home/jr/Documents/ProtoVirt/protovirt.c:23:
/home/jr/Documents/ProtoVirt/protovirt.h: In function ‘__rdmsr1’:
/home/jr/Documents/ProtoVirt/protovirt.h:25:22: error: expected ‘:’ or ‘)’ before ‘_ASM_EXTABLE_HANDLE’
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~~~~~~~~~~~~~~~~~~
/home/jr/Documents/ProtoVirt/protovirt.h:25:42: error: invalid suffix "b" on integer constant
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~
/home/jr/Documents/ProtoVirt/protovirt.h:25:46: error: invalid suffix "b" on integer constant
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~
/home/jr/Documents/ProtoVirt/protovirt.c: In function ‘initVmcsControlField’:
/home/jr/Documents/ProtoVirt/protovirt.c:282:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
282 | void *costum_rip;
| ^~~~
make[2]: *** [scripts/Makefile.build:297: /home/jr/Documents/ProtoVirt/protovirt.o] Error 1
make[1]: *** [Makefile:1903: /home/jr/Documents/ProtoVirt] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-53-generic'
make: *** [Makefile:12: modules] Error 2
The command I'm running is make. Can anyone explain to me what I'm doing wrong?
The _ASM_EXTABLE_HANDLE macro is replaced by _ASM_EXTABLE_TYPE in the newest kernel versions.

Should `linux-headers-$(uname -r)/include` be sufficient to compile against the Linux headers?

Say I have main.c:
#include <linux/list.h>
int main() {}
uname -r resolves to the 5.13.0-28-generic and I run Ubuntu 20.04 x86_64.
See what happens:
username#username-laptop:~$ gcc -o main -I/usr/src/linux-headers-$(uname -r)/include main.c
In file included from /usr/src/linux-headers-5.13.0-28-generic/include/linux/kernel.h:8,
from /usr/src/linux-headers-5.13.0-28-generic/include/linux/list.h:9,
from main.c:1:
/usr/src/linux-headers-5.13.0-28-generic/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory
8 | #include <asm/linkage.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
OK. Seems asm/linkage.h is platform-specific so I can't get if from the -generic headers. sudo find / -name linkage.h | grep x86 suggests the /usr/src/linux-hwe-5.13-headers-5.13.0-28/arch/x86/include include. So let's add that one too:
username#username-laptop:~$ gcc -o main -I/usr/src/linux-headers-$(uname -r)/include -I/usr/src/linux-hwe-5.13-headers-5.13.0-28/arch/x86/include main.c
In file included from /usr/src/linux-headers-5.13.0-28-generic/include/linux/kernel.h:11,
from /usr/src/linux-headers-5.13.0-28-generic/include/linux/list.h:9,
from main.c:1:
/usr/src/linux-headers-5.13.0-28-generic/include/linux/compiler.h:250:10: fatal error: asm/rwonce.h: No such file or directory
250 | #include <asm/rwonce.h>
| ^~~~~~~~~~~~~~
compilation terminated.
Have no idea what is wrong with my configuration. Any ideas?

make CC=other_cc in windows

maybe this question is stupid but i really am not able to get a way to fix this i am trying to make a file in Cygwin64 i have all the dependency files installed, but when i make the file it throws me this
$ make
x86_64-w64-mingw32-gcc -D OS_WINDOWS_NT -ansi -Wall -O2 -Wno-long-long -I /usr/include -c -o main.o main.c
In file included from /usr/include/sys/_pthreadtypes.h:12,
from /usr/include/sys/types.h:223,
from /usr/include/stdio.h:61,
from main.c:5:
/usr/include/sys/cpuset.h:17:30: error: expected expression before ‘/’ token
17 | #define __CPU_SETSIZE 1024 // maximum number of logical processors tracked
| ^
/usr/include/sys/cpuset.h:19:25: note: in expansion of macro ‘__CPU_SETSIZE’
19 | #define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number
| ^~~~~~~~~~~~~
/usr/include/sys/cpuset.h:26:21: note: in expansion of macro ‘__CPU_GROUPMAX’
26 | __cpu_mask __bits[__CPU_GROUPMAX];
| ^~~~~~~~~~~~~~
/usr/include/sys/cpuset.h:19:55: error: expected expression before ‘/’ token
19 | #define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number
| ^
/usr/include/sys/cpuset.h:26:21: note: in expansion of macro ‘__CPU_GROUPMAX’
26 | __cpu_mask __bits[__CPU_GROUPMAX];
| ^~~~~~~~~~~~~~
/usr/include/sys/cpuset.h:27:1: warning: no semicolon at end of struct or union
27 | } cpu_set_t;
| ^
In file included from /usr/include/errno.h:9,
from main.c:8:
/usr/include/sys/errno.h:14: warning: "errno" redefined
14 | #define errno (*__errno())
|
In file included from /usr/lib/gcc/x86_64-w64-mingw32/10/include/stddef.h:1,
from /usr/include/sys/cdefs.h:47,
from /usr/include/stdio.h:35,
from main.c:5:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stddef.h:19: note: this is the location of the previous definition
19 | #define errno (*_errno())
|
make: *** [<builtin>: main.o] Error 1
Your problem is that you've added the -ansi option to your compile line:
x86_64-w64-mingw32-gcc -D OS_WINDOWS_NT -ansi ...
The -ansi option tells the compiler to compile your code as if it were ANSI C 89 standard code. That version of the standard did not support the // single-line comment delimiter: it only supports the traditional /* ... */ comments.
However the header file you're including clearly expects to be able to use // comments. So you cannot use the -ansi flag when you compile with these header files.

Error no member named 'reqevents'; did you mean 'events' when building Redis on AIX

I'm upgrading from Redis 6.0.13 to 6.2.5 on AIX.
On 6.2.5, the build fails with this error:
MAKE hdr_histogram
cd hdr_histogram && make
make[3]: Entering directory '/home/jenkins/redis/deps/hdr_histogram'
/opt/atc-2.0/opt/gcc/bin/gcc -Wall -Os -g -DLUA_USE_POSIX -DLUA_USE_DLOPEN -include stdint-gcc.h -c hdr_histogram.c
make[3]: Leaving directory '/home/jenkins/redis/deps/hdr_histogram'
make[2]: Leaving directory '/home/jenkins/redis/deps'
CC adlist.o
CC quicklist.o
CC ae.o
In file included from ae.c:60:
ae_select.c: In function 'aeApiResize':
ae_select.c:52:37: warning: unused parameter 'eventLoop' [-Wunused-parameter]
52 | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
| ~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/poll.h:30,
from ae.c:41:
ae_select.c: In function 'aeApiPoll':
ae_select.c:89:43: error: 'aeEventLoop' has no member named 'reqevents'; did you mean 'events'?
89 | aeFileEvent *fe = &eventLoop->events[j];
| ^~~~~~
ae.c: In function 'aeCreateEventLoop':
ae.c:73:16: error: 'aeEventLoop' has no member named 'reqevents'; did you mean 'events'?
73 | eventLoop->events = zmalloc(sizeof(aeFileEvent)*setsize);
| ^~~~~~
...
I checked the eventLoop struct, and it does indeed contain events, but I see the build failing because it's trying to access reqevents. I can't find reqevents anywhere in the project (with grep -R 'reqevents' .)
This error only happens on AIX 7.1 - Linux and macOS both work fine.
Do you know why req would be prepended to the struct members on AIX, and how I might solve the error?

How to compile the demo example of SoLoud library in C?

I planned to use the SoLoud library (https://sol.gfxile.net/soloud/index.html) for my C project. I can't understand how to compile the C demo file contained in
/demos/c_test/
to make it executable.
Can someone help me to understand how to compile it using gcc?
in the demos/c_test/main.c,
I changed:
#include "soloud_c.h"
to
#include "../../include/soloud_c.h"
and it compiled. However, the compiler output the following warnings:
gcc -ggdb3 -Wall -Wextra -Wconversion -pedantic -std=gnu11 -c "main.c" -o "main.o" main.c:
In function ‘generate_sample’:
main.c:72:38: warning: conversion from ‘int’ to ‘float’ may change value [-Wconversion]
72 | buf[i] += (((rand() % 1024) - 512) / 512.0f) *
| ^
main.c:75:36: warning: conversion from ‘int’ to ‘float’ may change value [-Wconversion]
75 | float fade = (44100 * 10 - base) / (44100 * 10.0f);
| ^
main.c: In function ‘main’:
main.c:129:14: warning: unused parameter ‘parc’ [-Wunused-parameter]
129 | int main(int parc, char ** pars)
| ~~~~^~~~
main.c:129:28: warning: unused parameter ‘pars’ [-Wunused-parameter]
129 | int main(int parc, char ** pars)
| ~~~~~~~~^~~~
Compilation finished successfully.
Note: I did not bother to link the executable, however, I did note a few items of interest.
the available libraries are *.dll files, so this is expecting to be compiled/linked under the windows OS.
under the 'bin' directory are the libraries: soloud_x64.dll, soloud_x86.dll and SDL2.dll. I don't know which of these libraries your specific computer will need to include

Resources