Skip to contentSkip to conversation

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

PATCH Superseded Matthew McClintock 5 participants 14 messages Aug 21, 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.

---
 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..4558c7b 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_configure_prepend (){
+	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

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

#2 lore raw
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

-M

#3 lore raw
Quoted 14 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments
and furthermore it if it comes from fcntl.h which is not where you are looking for
there are few variables like that where its impacting more than affected systems.

Quoted 2 lines

-M

#4 lore raw
Quoted 16 lines · Khem Raj
Quoted 14 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 6 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

Quoted 2 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

-M

#5 lore raw
Quoted 24 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 16 lines · Khem Raj
Quoted 14 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 6 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 6 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

Quoted 7 lines
Quoted 3 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

-M

#6 lore raw
Quoted 35 lines · Khem Raj
Quoted 24 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 16 lines · Khem Raj
Quoted 14 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 6 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 6 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

Quoted 8 lines

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

Wasn't this proposed back a month ago:

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-July/026343.html

And there was discussion about that approach then? I think it was rejected due to lack of testing.

Sau!

Quoted 14 lines
Quoted 7 lines
Quoted 3 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

-M

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#7 lore raw
Quoted 56 lines · Saul Wold
Quoted 55 lines · Khem Raj
Quoted 35 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 24 lines · Khem Raj
Quoted 21 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 17 lines · Khem Raj

Review

Quoted 8 lines · Matthew McClintock
(quoted diff) +3 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h;

then

(quoted diff) +3 -0
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 7 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 7 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif
Quoted 8 lines
Quoted 2 lines

and be done with it

Wasn't this proposed back a month ago:

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-July/026343.html

And there was discussion about that approach then? I think it was rejected due to lack of testing.

Then we had a bit more analysis and discussion on the issue and others chimed in they had implemented similar work arounds... it's all in that thread.

-M

Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

Quoted 9 lines
Quoted 1 line

-M

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#8 lore raw
In reply to Saul Wold
Quoted 56 lines · Saul Wold
Quoted 55 lines · Khem Raj
Quoted 35 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 24 lines · Khem Raj
Quoted 21 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 17 lines · Khem Raj

Review

Quoted 8 lines · Matthew McClintock
(quoted diff) +3 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h;

then

(quoted diff) +3 -0
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 7 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 7 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif
Quoted 8 lines
Quoted 2 lines

and be done with it

Wasn't this proposed back a month ago:

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-July/026343.html

And there was discussion about that approach then? I think it was rejected due to lack of testing.

I think if it worked fine on a system like cents 5.8 then that would cover the case
as well try it on newer systems where O_CLOEXEC is available that should do it.

Quoted 20 lines

Sau!

Quoted 16 lines
Quoted 8 lines
Quoted 3 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

-M

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#9 lore raw
Quoted 51 lines · Khem Raj
Quoted 50 lines · Saul Wold
Quoted 49 lines · Khem Raj
Quoted 35 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 24 lines · Khem Raj
Quoted 21 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 17 lines · Khem Raj

Review

Quoted 8 lines · Matthew McClintock
(quoted diff) +3 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h;

then

(quoted diff) +3 -0
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 7 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 7 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

This does seem like a nicer approach.

Signature · 1 line
Christopher Larson
#10 lore raw
Quoted 54 lines · Chris Larson
Quoted 53 lines · Khem Raj
Quoted 52 lines · Saul Wold
Quoted 51 lines · Khem Raj
Quoted 35 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 24 lines · Khem Raj
Quoted 21 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 17 lines · Khem Raj

Review

Quoted 8 lines · Matthew McClintock
(quoted diff) +3 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h;

then

(quoted diff) +3 -0
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 7 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 7 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

and add

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

This does seem like a nicer approach.

OK - 2v1 ;) I'll respin as a patch.

-M

#11 lore raw
In reply to Khem Raj
Quoted 35 lines · Khem Raj
Quoted 24 lines · On Tue, Aug 21, 2012 at 11:10 AM, McClintock Matthew-B29882…
Quoted 16 lines · Khem Raj
Quoted 14 lines · On Tue, Aug 21, 2012 at 10:59 AM, McClintock Matthew-B29882…
Quoted 12 lines · Khem Raj

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

Quoted 6 lines · Matthew McClintock
meta/recipes-kernel/kmod/kmod-native_git.bb +6 -0
+
+do_configure_prepend (){
+       if ! grep O_CLOEXEC -r ${includedir_native}/bits/fcntl.h; then
+               export CFLAGS="$CFLAGS -D O_CLOEXEC=0"
+       fi
+}

IMO It would be safer to create a patch for kmod itself where you define O_CLOEXEC if it
was not defined before. The above seems a bit risky

Quoted 6 lines
Quoted 3 lines

Why is it risky? I only wanted to do this for affected systems. There is not an easy way to do this with a patch, unless of course I apply the patch manually.

manually gripping at the host installation and then if O_CLOEXEC might be in comments

Quoted 6 lines

How about grep define.*O_CLOEXEC -r ${includedir_native}/bits/fcntl.h

Quoted 2 lines

and furthermore it if it comes from fcntl.h which is not where you are looking for

I am grepping this file though?

I would go into the specific file where its asking for O_CLOEXEC

Quoted 7 lines

and add

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

Well this is seemingly the same way of doing it, just looks like you always want it applied? I don't think it should always be applied.

If this was it takes to get the build fix in, then I will do it... please confirm what will be accepted.

-M

Quoted 13 lines
Quoted 8 lines
Quoted 4 lines

there are few variables like that where its impacting more than affected systems.

I don't follow...

-M

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#12 lore raw
Quoted 11 lines · On Tue, Aug 21, 2012 at 11:47 AM, McClintock Matthew-B29882…
Quoted 5 lines

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

Well this is seemingly the same way of doing it, just looks like you always want it applied? I don't think it should always be applied.

If this was it takes to get the build fix in, then I will do it... please confirm what will be accepted.

No, on newer systems O_CLOEXEC will be defined, so that #ifndef block will never be entered, and there'll be no change.

Signature · 1 line
Christopher Larson
#13 lore raw
Quoted 8 lines · Chris Larson
Quoted 6 lines · On Tue, Aug 21, 2012 at 11:47 AM, McClintock Matthew-B29882…
Quoted 5 lines

#ifndef O_CLOEXEC

# define O_CLOEXEC 0
#endif

and be done with it

Quoted 8 lines
Quoted 5 lines

Well this is seemingly the same way of doing it, just looks like you always want it applied? I don't think it should always be applied.

If this was it takes to get the build fix in, then I will do it... please confirm what will be accepted.

No, on newer systems O_CLOEXEC will be defined, so that #ifndef block will never be entered, and there'll be no change.

Right, I was not thinking...

-M