From: Mark Hatle <mark.hatle@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 1/4] sanity.bbclass: Update gcc sanity check
Date: Mon, 15 Jul 2013 15:10:26 -0500 [thread overview]
Message-ID: <1373919029-19108-2-git-send-email-mark.hatle@windriver.com> (raw)
In-Reply-To: <1373919029-19108-1-git-send-email-mark.hatle@windriver.com>
The gcc sanity check should be checking for the atomic function directly
instead of using the gcc macro. Older versions of gcc do not have the macro
defined, but do support the atomic operations. (glib-2.0 checks for both
the macro and the function, as long as one is available it will successfully
compile.)
Update the check to try both -mcpu=native and -mcpu=BUILD_ARCH. Tell the user
which version worked properly.
[YOCTO #4845]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
meta/classes/sanity.bbclass | 42 +++++++++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b190eb2..a505a5d 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -280,31 +280,42 @@ def check_sanity_validmachine(sanity_data):
# Checks if necessary to add option march to host gcc
def check_gcc_march(sanity_data):
- result = False
+ result = True
+ message = ""
# Check if -march not in BUILD_CFLAGS
if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0:
+ result = False
# Construct a test file
f = open("gcc_test.c", "w")
- f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
+ f.write("int main (){ volatile int atomic = 2; __sync_bool_compare_and_swap (&atomic, 2, 3); return 0; }\n")
f.close()
# Check if GCC could work without march
- status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
- if status != 0:
- # Check if GCC could work with march
- status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
- if status != 0:
- result = True
- else:
- result = False
+ if not result:
+ status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
+ if status == 0:
+ result = True;
+
+ if not result:
+ status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
+ if status == 0:
+ message = "BUILD_CFLAGS_append = \" -march=native\""
+ result = True;
+
+ if not result:
+ build_arch = sanity_data.getVar('BUILD_ARCH', True)
+ status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=%s gcc_test.c -o gcc_test" % build_arch)
+ if status == 0:
+ message = "BUILD_CFLAGS_append = \" -march=%s\"" % build_arch
+ result = True;
os.remove("gcc_test.c")
if os.path.exists("gcc_test"):
os.remove("gcc_test")
- return result
+ return (result, message)
# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612.
# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
@@ -506,9 +517,14 @@ def check_sanity_version_change(status, d):
if not check_app_exists("qemu-arm", d):
status.addresult("qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH")
- if check_gcc_march(d):
+ (result, message) = check_gcc_march(d)
+ if result and message:
status.addresult("Your gcc version is older than 4.5, please add the following param to local.conf\n \
- BUILD_CFLAGS_append = \" -march=native\"\n")
+ %s\n" % message)
+ if not result:
+ status.addresult("Your gcc version is older then 4.5 or is not working properly. Please verify you can build")
+ status.addresult(" and link something that uses atomic operations, such as: \n")
+ status.addresult(" __sync_bool_compare_and_swap (&atomic, 2, 3);\n")
# Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
tmpdir = d.getVar('TMPDIR', True)
--
1.8.3
next prev parent reply other threads:[~2013-07-15 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 20:10 [PATCH 0/4] A few misc patch Mark Hatle
2013-07-15 20:10 ` Mark Hatle [this message]
2013-07-15 20:10 ` [PATCH 2/4] terminal.bbclass: Fix BB_RUNFMT processing Mark Hatle
2013-07-15 20:10 ` [PATCH 3/4] busybox: fix ip reference in simple.script Mark Hatle
2013-07-15 20:10 ` [PATCH 4/4] dbus-ptest: Disable python module check Mark Hatle
2013-07-15 23:48 ` Saul Wold
2013-07-16 0:23 ` Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373919029-19108-2-git-send-email-mark.hatle@windriver.com \
--to=mark.hatle@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox