[coreboot] mingw build problem with seabios/tools/kconfig

Scott Duplichan scott at notabs.org
Mon Mar 14 03:55:55 CET 2011


Kevin O'Connor wrote:

]On Sat, Mar 12, 2011 at 09:47:56PM -0600, Scott Duplichan wrote:
]> Hello,
]> 
]> I am trying to overcome problems building seabios/tools/kconfig from
]> the windows/mingw environment. Here are the failures:
]> 
]> 1) Link step for tools/kconfig/conf fails to find regcomp/regexec/regfree.
]>    In the mingw environment these functions are available in libregex, 
]>    but libregex is not included in the standard library search. I have
]>    not found a way to add '-lregex' to the link command line:
]>    $(Q)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) ]$(HOSTLOADLIBES_$(@F))
]>    HOSTLDFLAGS occurs too early in the file list for this use.
]
]Can you add it to HOST_LOADLIBES?

When added to HOST_LOADLIBES before starting the build, the value
is cleared by coreboot/util/kconfig/makefile line 103,

100: # Use recursively expanded variables so we do not call gcc unless
101: # we really need to do so. (Do not call gcc as part of make mrproper)
102: HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
103: HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))


]> 2) Link step for tools/kconfig/conf fails to find function uname().
]>    I can come up with a library to provide this function but need
]>    help passing it to the linker, same as with item 1.
]> 
]> 3) Function mkdir() takes only one argument in the mingw environment,
]>    yet takes 2 arguments otherwise. I have not found a good way to 
]>    overcome this difference.
]
]What about making a file "mingw_fixups.h" and changing the HOSTCFLAGS
]to add "-include mingw_fixups.h".  The header can then do something
]like:
]
]#define uname(arg1) memset(arg1, 0, sizeof(*arg1))
]#define mkdir(arg1,arg2) mkdir(arg1)

This idea is workable. I Used:
#define _SYS_UTSNAME_H
struct utsname{char release[20];};
#define uname(arg1) memset(arg1, 0, sizeof(*arg1))
#define mkdir(arg1,...) mkdir(arg1)

The '#define _SYS_UTSNAME_H' blocks utsname.h inclusion. This is needed
to prevent a conflict between the macro definition and the function
prototype. A minimal utsname struct definition must be added back. The
mkdir macro is changed to variadic type to prevent a compile fail.

I bypassed the libregex problem for the moment and ran with the above
change to see what other problems remain. A seabios/tools/kconfig/confdata.c
call to rename(newname, dirname) fails. It appears the destination file must
not exist for the win32 version of this function to succeed. Here is how the
how the problem was overcome for coreboot:
http://tracker.coreboot.org/trac/coreboot/changeset/4952
When I add the UNLINK_IF_NECESSARY part of this change, the rename succeeds.
Could seabios adopt this change? For simplicity, the neighboring definition
#define mkdir(x,y) mkdir(x) could be considered too.

Thanks,
Scott

]
]-Kevin





More information about the coreboot mailing list