Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-10-19 Thread Julius Werner
> is there anyway to dynamic define std to gnu99 when detect build with cygwin?

cbfstool is already defining -std=c99. I don't see a strong reason why
we shouldn't just change that to gnu99 globally.

>>> 2. default build will error as below,
>>> HOSTCC cbfstool/cbfstool.o
>>> /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c: In function 'main':
>>> /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1075:5: error: array
>>> subscript has type 'char' [-Werror=char-subscripts]
>>>  if (tolower(suffix[0])=='k') {
>>>  ^

This sounds like an bug in cygwin and you should file it with them.
They're probably implementing tolower() in their standard header as a
macro which directly indexes an array with an argument. They should at
least be casting the argument inside that macro or they are not
POSIX-compliant.

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-10-19 Thread Stefan Reinauer
I think switching to c99 per default is a great idea. The problem below should 
be fixed by http://review.coreboot.org/#/c/11666/ and the following patch.

Stefan

On Oct 19, 2015, Julius Werner  wrote:
>> is there anyway to dynamic define std to gnu99 when detect build with
>cygwin?
>
>cbfstool is already defining -std=c99. I don't see a strong reason why
>we shouldn't just change that to gnu99 globally.
>
 2. default build will error as below,
 HOSTCC cbfstool/cbfstool.o
 /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c: In function
>'main':
 /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1075:5: error:
>array
 subscript has type 'char' [-Werror=char-subscripts]
  if (tolower(suffix[0])=='k') {
  ^
>
>This sounds like an bug in cygwin and you should file it with them.
>They're probably implementing tolower() in their standard header as a
>macro which directly indexes an array with an argument. They should at
>least be casting the argument inside that macro or they are not
>POSIX-compliant.

-- 
Sent with https://play.google.com/store/apps/details?id=com.onegravity.k10.pro2;>K-@
 Mail - the evolution of emailing.-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-10-16 Thread Kurt Qiao
do a quick update here, thanks for Stefan, the solution seems part of
work for me

1. i changed to cygwin(32bit) due to cygwin64 always got fail, but i
got same fail with cygwin, so below update i based on cygwin.

2. default build will error as below,
HOSTCC cbfstool/cbfstool.o
/cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c: In function 'main':
/cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1075:5: error: array
subscript has type 'char' [-Werror=char-subscripts]
 if (tolower(suffix[0])=='k') {
 ^
/cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1078:5: error: array
subscript has type 'char' [-Werror=char-subscripts]
 if (tolower(suffix[0])=='m') {
 ^

so i change my cbfstool.c code to :
--  if (tolower(suffix[0])=='k') {
++ if ((int)tolower(suffix[0])=='k') {

--  if (tolower(suffix[0])=='m') {
++ if ((int)tolower(suffix[0])=='m') {


3. patch 11636 works, so build pass util/cbfstool/common.c
but patch 11637 will fail with function '_fileno'
HOSTCC cbfstool/fmaptool.o
HOSTCC cbfstool/cbfs_sections.o
HOSTCC cbfstool/fmap_from_fmd.o
HOSTCC cbfstool/fmd.o
HOSTCC cbfstool/fmd_parser.o
HOSTCC cbfstool/fmd_scanner.o
: In function 'yy_init_buffer':
:1399:9: error: implicit declaration of function '_fileno'
[-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
util/cbfstool/Makefile.inc:59: recipe for target
'build/util/cbfstool/fmd_scanner.o' failed
make: *** [build/util/cbfstool/fmd_scanner.o] Error 1


2015-09-15 2:07 GMT+08:00 Stefan Reinauer :
> * Kurt Qiao  [150909 09:42]:
>> does anyone try cygwin64 to build coreboot in windows7 64bit?
>> i got fail when build cbfstool with cygwin64.
>
> Can you try the following two patches to see if they solve your problem
>
> http://review.coreboot.org/11636 Don't use fileno() to get file size
> http://review.coreboot.org/11637 fmd: Use _fileno() on MINGW
>
> Also, if that doesn't work try to replace the MINGW check with something
> like #if defined (_WIN64) || defined (__CYGWIN64__) instead.
>
> (Make sure to run make clean in the cbfstool directory before trying)
>
> Stefan

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-10-16 Thread Kurt Qiao
hi
i finally built pass with define
CFLAGS += -std=gnu99  in cbfstool/Makefile
TOOLCFLAGS ?= -std=gnu99  in cbfstool/Makefile.inc

change cbfstool.c code to :
--  if (tolower(suffix[0])=='k') {
++ if (tolower((int)suffix[0])=='k') {

--  if (tolower(suffix[0])=='m') {
++ if (tolower((int)suffix[0])=='m') {

is there anyway to dynamic define std to gnu99 when detect build with cygwin?


2015-09-15 21:05 GMT+08:00 Kurt Qiao :
> sorry for typo, fix step 1 code:
>
> so i change my cbfstool.c code to :
> --  if (tolower(suffix[0])=='k') {
> ++ if (tolower((int)suffix[0])=='k') {
>
> --  if (tolower(suffix[0])=='m') {
> ++ if (tolower((int)suffix[0])=='m') {
>
> 2015-09-15 21:01 GMT+08:00 Kurt Qiao :
>> do a quick update here, thanks for Stefan, the solution seems part of
>> work for me
>>
>> 1. i changed to cygwin(32bit) due to cygwin64 always got fail, but i
>> got same fail with cygwin, so below update i based on cygwin.
>>
>> 2. default build will error as below,
>> HOSTCC cbfstool/cbfstool.o
>> /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c: In function 'main':
>> /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1075:5: error: array
>> subscript has type 'char' [-Werror=char-subscripts]
>>  if (tolower(suffix[0])=='k') {
>>  ^
>> /cygdrive/d/FW/coreboot/util/cbfstool/cbfstool.c:1078:5: error: array
>> subscript has type 'char' [-Werror=char-subscripts]
>>  if (tolower(suffix[0])=='m') {
>>  ^
>>
>> so i change my cbfstool.c code to :
>> --  if (tolower(suffix[0])=='k') {
>> ++ if ((int)tolower(suffix[0])=='k') {
>>
>> --  if (tolower(suffix[0])=='m') {
>> ++ if ((int)tolower(suffix[0])=='m') {
>>
>>
>> 3. patch 11636 works, so build pass util/cbfstool/common.c
>> but patch 11637 will fail with function '_fileno'
>> HOSTCC cbfstool/fmaptool.o
>> HOSTCC cbfstool/cbfs_sections.o
>> HOSTCC cbfstool/fmap_from_fmd.o
>> HOSTCC cbfstool/fmd.o
>> HOSTCC cbfstool/fmd_parser.o
>> HOSTCC cbfstool/fmd_scanner.o
>> : In function 'yy_init_buffer':
>> :1399:9: error: implicit declaration of function '_fileno'
>> [-Werror=implicit-function-declaration]
>> cc1: all warnings being treated as errors
>> util/cbfstool/Makefile.inc:59: recipe for target
>> 'build/util/cbfstool/fmd_scanner.o' failed
>> make: *** [build/util/cbfstool/fmd_scanner.o] Error 1
>>
>>
>> 2015-09-15 2:07 GMT+08:00 Stefan Reinauer :
>>> * Kurt Qiao  [150909 09:42]:
 does anyone try cygwin64 to build coreboot in windows7 64bit?
 i got fail when build cbfstool with cygwin64.
>>>
>>> Can you try the following two patches to see if they solve your problem
>>>
>>> http://review.coreboot.org/11636 Don't use fileno() to get file size
>>> http://review.coreboot.org/11637 fmd: Use _fileno() on MINGW
>>>
>>> Also, if that doesn't work try to replace the MINGW check with something
>>> like #if defined (_WIN64) || defined (__CYGWIN64__) instead.
>>>
>>> (Make sure to run make clean in the cbfstool directory before trying)
>>>
>>> Stefan

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-09-23 Thread kurt qiao
don't know why my email didn't receive in the list, so i reply again:
i finally built pass with define:

CFLAGS += -std=gnu99  in cbfstool/Makefile
TOOLCFLAGS ?= -std=gnu99  in cbfstool/Makefile.inc

and change cbfstool.c code to :
--  if (tolower(suffix[0])=='k') {
++ if (tolower((int)suffix[0])=='k') {

--  if (tolower(suffix[0])=='m') {
++ if (tolower((int)suffix[0])=='m') {

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-09-11 Thread Bao, Zheng
You can remove the -Werror
In util/cbfstool/Makefile.inc
Try again.

Zheng.

> -Original Message-
> From: coreboot [mailto:coreboot-boun...@coreboot.org] On Behalf Of Kurt Qiao
> Sent: Wednesday, September 09, 2015 5:43 PM
> To: coreboot@coreboot.org
> Subject: [coreboot] [help]build cbfstool fail with cygwin64
> 
> does anyone try cygwin64 to build coreboot in windows7 64bit?
> i got fail when build cbfstool with cygwin64.
> my steps as below:
> 
> 1. cygwin64 install utility "patch", "flex", 'wget' etc.
> 
> 2. git pull latest coreboot from github
> build crossgcc
> ./buildgcc -j 4
> 
> 3. build iasl
> download src from link [1]
> make
> cp acpica-unix-20150818/generate/unix/bin/iasl /usr/local/bin
> 
> 4. make menuconfig
> choose "emulation/qemu-q35" in my case
> 
> 5.make
> then fail as below
> 
> : In function 'yy_init_buffer':
> :1395:9: error: implicit declaration of function 'fileno'
> [-Werror=implicit-function-declaration]
> cc1: all warnings being treated as errors
> util/cbfstool/Makefile.inc:59: recipe for target
> 'build/util/cbfstool/fmd_scanner.o' failed
> make: *** [build/util/cbfstool/fmd_scanner.o] Error 1
> ---
> 
> i follow link [2] to modify cbfstool makefile, add _D_GNU_SOURCE for
> TOOLCPPFLAGS, CPPFLAGS and fail as below log.
> ---
> Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 432 Optimizations
> HOSTCC cbfstool/fmaptool.o
> HOSTCC cbfstool/cbfs_sections.o
> HOSTCC cbfstool/fmap_from_fmd.o
> HOSTCC cbfstool/fmd.o
> HOSTCC cbfstool/fmd_parser.o
> HOSTCC cbfstool/fmd_scanner.o
> HOSTCC cbfstool/fmap.o
> HOSTCC cbfstool/kv_pair.o
> HOSTCC cbfstool/valstr.o
> HOSTCC cbfstool/fmaptool (link)
> build/util/cbfstool/fmd.o:fmd.c:(.text+0xa23): undefined reference to
> `yylex_destroy'
> build/util/cbfstool/fmd.o:fmd.c:(.text+0xa23): relocation truncated to
> fit: R_X86_64_PC32 against undefined symbol `yylex_destroy'
> build/util/cbfstool/fmd.o:fmd.c:(.rdata$.refptr.yyin[.refptr.yyin]+0x0):
> undefined reference to `yyin'
> build/util/cbfstool/fmd_parser.o:fmd_parser.c:(.text+0x386): undefined
> reference to `yylex'
> build/util/cbfstool/fmd_parser.o:fmd_parser.c:(.text+0x386):
> relocation truncated to fit: R_X86_64_PC32 against undefined symbol `yylex'
> collect2: error: ld returned 1 exit status
> util/cbfstool/Makefile.inc:83: recipe for target
> 'build/util/cbfstool/fmaptool' failed
> make: *** [build/util/cbfstool/fmaptool] Error 1
> ---
> 
> [1]:https://acpica.org/sites/acpica/files/acpica-unix-20150818.tar.gz
> [2]:http://review.coreboot.org/#/c/10027/1
> 
> --
> coreboot mailing list: coreboot@coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot


Re: [coreboot] [help]build cbfstool fail with cygwin64

2015-09-11 Thread Patrick Georgi
2015-09-09 11:42 GMT+02:00 Kurt Qiao :
> 5.make
> then fail as below
> 
> : In function 'yy_init_buffer':
> :1395:9: error: implicit declaration of function 'fileno'
> [-Werror=implicit-function-declaration]
> ---
>
> i follow link [2] to modify cbfstool makefile, add _D_GNU_SOURCE for
> TOOLCPPFLAGS, CPPFLAGS
That doesn't fix the missing fileno declaration, which is the root cause.
C standard library providers for Windows seem to be undecided what to
do on this function (according to a quick internet search for cygwin
and fileno). Sadly I haven't found a simple solution and don't have a
system around for testing.


Patrick
-- 
Google Germany GmbH, ABC-Str. 19, 20354 Hamburg
Registergericht und -nummer: Hamburg, HRB 86891, Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

[coreboot] [help]build cbfstool fail with cygwin64

2015-09-10 Thread Kurt Qiao
does anyone try cygwin64 to build coreboot in windows7 64bit?
i got fail when build cbfstool with cygwin64.
my steps as below:

1. cygwin64 install utility "patch", "flex", 'wget' etc.

2. git pull latest coreboot from github
build crossgcc
./buildgcc -j 4

3. build iasl
download src from link [1]
make
cp acpica-unix-20150818/generate/unix/bin/iasl /usr/local/bin

4. make menuconfig
choose "emulation/qemu-q35" in my case

5.make
then fail as below

: In function 'yy_init_buffer':
:1395:9: error: implicit declaration of function 'fileno'
[-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
util/cbfstool/Makefile.inc:59: recipe for target
'build/util/cbfstool/fmd_scanner.o' failed
make: *** [build/util/cbfstool/fmd_scanner.o] Error 1
---

i follow link [2] to modify cbfstool makefile, add _D_GNU_SOURCE for
TOOLCPPFLAGS, CPPFLAGS
and fail as below log.
---
Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 432 Optimizations
HOSTCC cbfstool/fmaptool.o
HOSTCC cbfstool/cbfs_sections.o
HOSTCC cbfstool/fmap_from_fmd.o
HOSTCC cbfstool/fmd.o
HOSTCC cbfstool/fmd_parser.o
HOSTCC cbfstool/fmd_scanner.o
HOSTCC cbfstool/fmap.o
HOSTCC cbfstool/kv_pair.o
HOSTCC cbfstool/valstr.o
HOSTCC cbfstool/fmaptool (link)
build/util/cbfstool/fmd.o:fmd.c:(.text+0xa23): undefined reference to
`yylex_destroy'
build/util/cbfstool/fmd.o:fmd.c:(.text+0xa23): relocation truncated to
fit: R_X86_64_PC32 against undefined symbol `yylex_destroy'
build/util/cbfstool/fmd.o:fmd.c:(.rdata$.refptr.yyin[.refptr.yyin]+0x0):
undefined reference to `yyin'
build/util/cbfstool/fmd_parser.o:fmd_parser.c:(.text+0x386): undefined
reference to `yylex'
build/util/cbfstool/fmd_parser.o:fmd_parser.c:(.text+0x386):
relocation truncated to fit: R_X86_64_PC32 against undefined symbol
`yylex'
collect2: error: ld returned 1 exit status
util/cbfstool/Makefile.inc:83: recipe for target
'build/util/cbfstool/fmaptool' failed
make: *** [build/util/cbfstool/fmaptool] Error 1
---

[1]:https://acpica.org/sites/acpica/files/acpica-unix-20150818.tar.gz
[2]:http://review.coreboot.org/#/c/10027/1

-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot