I'm creating an import library for a proprietary DLL using a hand made .def file. The following command fail: arm-mingw32ce-dlltool -d libGLES_CM.def -D libGLES_CM.dll -l libGLES_CM.lib -m $MACHINE with MACHINE either arm or thumb, it failed with a strange message: "Can't open .lib file: libGLES_CM.lib." Using strace, one can see dlltool removing libGLES_CM.lib before failing. Hopefully, removing -m thumb/arm, dlltool works and produces a .lib that can be used on my target. So either -m is not needed here and needed a proper error message/handling, or this is a bug and i have luck to have a working .lib.
Using gdb help find the problem: when another machine architecture is selected, the bfd target is not the one per default. And the selected bfd is not part of the build. So there's no bug, but the error message is unclear.
Created attachment 4278 [details] dlltool: Improve error reporting regarding BFD open operations Here's a patch which help to diagnose problem regarding BFD open calls. Patch against CVS HEAD.
Subject: Bug 10768 CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2009-10-16 14:02:55 Modified files: binutils : ChangeLog dlltool.c Log message: PR 10768 * dlltool.c (bfd_get_errmsg): New macro. (scan_obj_file): Use it. (make_one_lib_file): Use it. (make_head): Use it. (make_delay_head): Use it. (make_tail): Use it. (gen_lib_file): Use it. (identify_dll_for_implib): Use it. (identify_search_archive): Use it. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1546&r2=1.1547 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/dlltool.c.diff?cvsroot=src&r1=1.93&r2=1.94
Hi Yann, Thanks for the patch. I have now applied it to the sources along with this changelog entry. Cheers Nick binutils/ChangeLog 2009-10-16 Yann Droneaud <yann@droneaud.fr> PR 10768 * dlltool.c (bfd_get_errmsg): New macro. (scan_obj_file): Use it. (make_one_lib_file): Use it. (make_head): Use it. (make_delay_head): Use it. (make_tail): Use it. (gen_lib_file): Use it. (identify_dll_for_implib): Use it. (identify_search_archive): Use it.