Skip to contentSkip to conversation

kmod-native_git.bb: fix builds for hosts with older libc

PATCH Applied Matthew McClintock 2 participants 2 messages Aug 24, 2012 – Aug 27, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kmod-native_git.bb: fix builds for hosts with older libc

kmod will fail to build with the following error because O_CLOEXEC is not defined:

| libkmod/libkmod-module.c: In function 'kmod_module_get_initstate':
| libkmod/libkmod-module.c:1640: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-module.c:1640: error: (Each undeclared identifier is reported only once
| libkmod/libkmod-module.c:1640: error: for each function it appears in.)
| libkmod/libkmod-module.c: In function 'kmod_module_get_refcnt':
| libkmod/libkmod-module.c:1754: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-module.c: In function 'kmod_module_get_sections':
| libkmod/libkmod-module.c:1913: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-file.c: In function 'kmod_file_open':
| libkmod/libkmod-file.c:282: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-file.c:282: error: (Each undeclared identifier is reported only once
| libkmod/libkmod-file.c:282: error: for each function it appears in.)

Since we are only using kmod-native for depmod, and it's a non-threaded user of this libary being built this should be safe to override O_CLOEXEC.

Keep in mind this is ONLY effecting the native builds and not what is being shipped in the root file system.

---
v2: use patch instead of munging CFLAGS

 meta/recipes-kernel/kmod/kmod-native_git.bb        |    3 ++-
 .../kmod/kmod/fix-undefined-O_CLOEXEC.patch        |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch
meta/recipes-kernel/kmod/kmod-native_git.bb +2 -1
index 96de8b8..8cbcdf8 100644
@@ -4,7 +4,8 @@
 require kmod.inc
 inherit native
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
+SRC_URI += "file://fix-undefined-O_CLOEXEC.patch"
 
 do_install_append (){
 	for tool in depmod insmod lsmod modinfo modprobe rmmod
meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch new file +17 -0
new file mode 100644
index 0000000..3177e9a
@@ -0,0 +1,17 @@
+Upstream-Status: Not applicable
+
+Index: git/libkmod/libkmod-private.h
+===================================================================
+--- git.orig/libkmod/libkmod-private.h
++++ git/libkmod/libkmod-private.h
+@@ -1,6 +1,10 @@
+ #ifndef _LIBKMOD_PRIVATE_H_
+ #define _LIBKMOD_PRIVATE_H_
+ 
++#ifndef O_CLOEXEC
++# define O_CLOEXEC 0
++#endif
++
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <syslog.h>
Signature · 1 line
1.7.9.7
Applied
#1 lore raw
Quoted 59 lines · Matthew McClintock

kmod will fail to build with the following error because O_CLOEXEC is not defined:

| libkmod/libkmod-module.c: In function 'kmod_module_get_initstate':
| libkmod/libkmod-module.c:1640: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-module.c:1640: error: (Each undeclared identifier is reported only once
| libkmod/libkmod-module.c:1640: error: for each function it appears in.)
| libkmod/libkmod-module.c: In function 'kmod_module_get_refcnt':
| libkmod/libkmod-module.c:1754: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-module.c: In function 'kmod_module_get_sections':
| libkmod/libkmod-module.c:1913: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-file.c: In function 'kmod_file_open':
| libkmod/libkmod-file.c:282: error: 'O_CLOEXEC' undeclared (first use in this function)
| libkmod/libkmod-file.c:282: error: (Each undeclared identifier is reported only once
| libkmod/libkmod-file.c:282: error: for each function it appears in.)

Since we are only using kmod-native for depmod, and it's a non-threaded user of this libary being built this should be safe to override O_CLOEXEC.

Keep in mind this is ONLY effecting the native builds and not what is being shipped in the root file system.

---
v2: use patch instead of munging CFLAGS

  meta/recipes-kernel/kmod/kmod-native_git.bb        |    3 ++-
  .../kmod/kmod/fix-undefined-O_CLOEXEC.patch        |   17 +++++++++++++++++
  2 files changed, 19 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch

meta/recipes-kernel/kmod/kmod-native_git.bb +2 -1
index 96de8b8..8cbcdf8 100644
@@ -4,7 +4,8 @@
  require kmod.inc
  inherit native
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
+SRC_URI += "file://fix-undefined-O_CLOEXEC.patch"
 
  do_install_append (){
  	for tool in depmod insmod lsmod modinfo modprobe rmmod
meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch new file +7 -0
new file mode 100644
index 0000000..3177e9a
@@ -0,0 +1,17 @@
+Upstream-Status: Not applicable
+
+Index: git/libkmod/libkmod-private.h
+===================================================================
+--- git.orig/libkmod/libkmod-private.h
++++ git/libkmod/libkmod-private.h
+@@ -1,6 +1,10 @@

meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch line 17

Quoted 10 lines
meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch new file +10 -0
+ #ifndef _LIBKMOD_PRIVATE_H_
+ #define _LIBKMOD_PRIVATE_H_
+
++#ifndef O_CLOEXEC
++# define O_CLOEXEC 0
++#endif
++
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <syslog.h>

Merged into OE-Core

Thanks
Sau!