From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbcEPOCt (ORCPT ); Mon, 16 May 2016 10:02:49 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36325 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753654AbcEPOCs (ORCPT ); Mon, 16 May 2016 10:02:48 -0400 Date: Mon, 16 May 2016 19:32:37 +0530 From: Muhammad Falak R Wani To: Shuah Khan Cc: Prarit Bhargava , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tools: testing: define the _GNU_SOURCE macro Message-ID: <20160516140237.GA20217@kp> References: <1463141167-21889-1-git-send-email-falakreyaz@gmail.com> <5739CABD.4070307@osg.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5739CABD.4070307@osg.samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 16, 2016 at 07:27:25AM -0600, Shuah Khan wrote: > On 05/13/2016 06:05 AM, Muhammad Falak R Wani wrote: > > Add the macro _GNU_SOURCE, so that compilation does not terminate. > > What error are you seeing? Could you please send the compilation > error log. > > thanks, > -- Shuah > > > > Signed-off-by: Muhammad Falak R Wani > > --- > > tools/testing/selftests/intel_pstate/run.sh | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh > > index bdaf37e..7868c10 100755 > > --- a/tools/testing/selftests/intel_pstate/run.sh > > +++ b/tools/testing/selftests/intel_pstate/run.sh > > @@ -32,7 +32,7 @@ EVALUATE_ONLY=0 > > max_cpus=$(($(nproc)-1)) > > > > # compile programs > > -gcc -o aperf aperf.c -lm > > +gcc aperf.c -Wall -D_GNU_SOURCE -o aperf -lm > > [ $? -ne 0 ] && echo "Problem compiling aperf.c." && exit 1 > > gcc -o msr msr.c -lm > > [ $? -ne 0 ] && echo "Problem compiling msr.c." && exit 1 > > > When I try to run "run.sh", I get the following linker error ------ mfrw@kp:~/kp/tools/testing/selftests/intel_pstate$ ./run.sh /tmp/ccVLsFVk.o: In function `main': aperf.c:(.text+0x12e): undefined reference to `CPU_ZERO' aperf.c:(.text+0x14a): undefined reference to `CPU_SET' collect2: error: ld returned 1 exit status Problem compiling aperf.c. ------ The root cause of the problem is, we haven't defined a macro _GNU_SOURCE, which is necessary for CPU_ZERO, CPU_SET. After adding the appropriate macro, it compiles without any error.