Skip to contentSkip to conversation

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

PATCH Superseded Matthew McClintock 4 participants 4 messages Aug 20, 2012 – Aug 21, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 meta/recipes-kernel/kmod/kmod-native_git.bb |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-kernel/kmod/kmod-native_git.bb +7 -1
index 96de8b8..3c5e3c3 100644
@@ -4,7 +4,7 @@
 require kmod.inc
 inherit native
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 do_install_append (){
 	for tool in depmod insmod lsmod modinfo modprobe rmmod
@@ -12,3 +12,9 @@ do_install_append (){
 		ln -s kmod ${D}${bindir}/$tool
 	done
 }
+
+do_compile_append (){
+	if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+		export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+	fi
+}
Signature · 1 line
1.7.9.7
#1 lore raw
Quoted 2 lines · Matthew McClintock

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

s/effect/affect/ ;)

Signature · 1 line
Christopher Larson
#2 lore raw
In reply to Matthew McClintock
Quoted 41 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.

---
 meta/recipes-kernel/kmod/kmod-native_git.bb |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-kernel/kmod/kmod-native_git.bb +1 -1
index 96de8b8..3c5e3c3 100644
@@ -4,7 +4,7 @@
 require kmod.inc
 inherit native
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 do_install_append (){
 	for tool in depmod insmod lsmod modinfo modprobe rmmod

meta/recipes-kernel/kmod/kmod-native_git.bb do_install_append (){ · line 20

Quoted 9 lines
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
@@ -12,3 +12,9 @@ do_install_append (){
 		ln -s kmod ${D}${bindir}/$tool
 	done
 }
+
+do_compile_append (){
+	if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+		export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+	fi
+}

A compile append would execute after the compile. Isn't this after the point you need the change?

Cheers,

Richard

#3 lore raw
Quoted 39 lines · Richard Purdie
Quoted 38 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.

---
 meta/recipes-kernel/kmod/kmod-native_git.bb |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-kernel/kmod/kmod-native_git.bb +1 -1
index 96de8b8..3c5e3c3 100644
@@ -4,7 +4,7 @@
 require kmod.inc
 inherit native
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
Quoted 16 lines

meta/recipes-kernel/kmod/kmod-native_git.bb do_install_append (){ · line 20

Quoted 12 lines
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
 do_install_append (){
      for tool in depmod insmod lsmod modinfo modprobe rmmod
@@ -12,3 +12,9 @@ do_install_append (){
              ln -s kmod ${D}${bindir}/$tool
      done
 }
+
+do_compile_append (){
+     if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+             export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+     fi
+}

A compile append would execute after the compile. Isn't this after the point you need the change?

Yes, and this makes me wonder what I tested...

Anyways, v2 fixed up and sent. I also needed to export the CFLAGS even earlier so they got picked up correctly.

-M