http://bugs.winehq.org/show_bug.cgi?id=24402
Summary: winegcc does not properly pass cmdline args, e.g. -Wb,--as-cmd="as --32" Product: Wine Version: 1.3.2 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: critical Priority: P2 Component: build-env AssignedTo: wine-bugs@winehq.org ReportedBy: armin.kazmi@tu-dortmund.de
When trying to build a simple test.c file with winegcc, winegcc fails to properly pass over commandline arguments to winebuild.
test.c only contains an emtpy main function. In practise this error was verified with the vst plugin of lmms.
Test cmdline: winegcc test.c -o test -m32 -Wb,--as-cmd="as --32",--ld-cmd="ld -melf_i386"
Resulting output: winebuild: as --32 failed with status 1 winegcc: winebuild failed
Another testcase
Cmdline: winegcc test.c -o test -m32 -Wb,--as-cmd="as ",--ld-cmd="ld "
Output: winebuild: as failed with status 1 winegcc: winebuild failed
Running the same first cmdline with the -v option reveals the error:
winegcc test.c -o test -m32 -Wb,--as-cmd="as --32",--ld-cmd="ld -melf_i386" -v
----- gcc -m32 -fshort-wchar -DWINE_UNICODE_NATIVE -D_REENTRANT -fPIC -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -D__WINNT -D__WINNT__ -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D_stdcall=__attribute__((__stdcall__)) -D_cdecl=__attribute__((__cdecl__)) -D__fastcall=__attribute__((__fastcall__)) -D_fastcall=__attribute__((__fastcall__)) -D__declspec(x)=__declspec_##x -D__declspec_align(x)=__attribute__((aligned(x))) -D__declspec_allocate(x)=__attribute__((section(x))) -D__declspec_deprecated=__attribute__((deprecated)) -D__declspec_dllimport=__attribute__((dllimport)) -D__declspec_dllexport=__attribute__((dllexport)) -D__declspec_naked=__attribute__((naked)) -D__declspec_noinline=__attribute__((noinline)) -D__declspec_noreturn=__attribute__((noreturn)) -D__declspec_nothrow=__attribute__((nothrow)) -D__declspec_novtable=__attribute__(()) -D__declspec_selectany=__attribute__((weak)) -D__declspec_thread=__thread -D__int8=char -D__int16=short -D__int32=int -D__int64=long long -D__WINE__ -c -o test-5hFdhw.o -m32 -v test.c -isystem/usr/include/wine/windows
STRIPPED
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/cc1 -fpreprocessed /home/armin/.ccache/tmp/test.tmp.Armin-Lappy.24225.i -quiet -dumpbase test.tmp.Armin-Lappy.24225.i -m32 -mtune=generic -march=x86-64 -auxbase-strip /home/armin/.ccache/8/f/e763402f4ba107ebe0a46887176150-5354.o.tmp.Armin-Lappy.24225 -version -fshort-wchar -fPIC -o /tmp/cc1MonbO.s
STRIPPED
winebuild -v -fno-asynchronous-unwind-tables -m32 -D_REENTRANT -fPIC --exe -o test.exe-mBoapU.spec.o -F test.exe --subsystem console -L/usr/lib/wine -L/usr/lib -L/usr/lib -L/usr/local/lib -L/lib --as-cmd=as --32 --ld-cmd=ld -melf_i386 -- test-5hFdhw.o as --32 --32 -o test.GRCnmk.o test.QLV4hW.s winebuild: as --32 failed with status 1 winegcc: winebuild failed ------
The error lies in $WINESRC/tools/winegcc/winegcc.c lines 1360 and following. Winegcc assumes that the command line arguments remain quoted as shown in the cmdline above, but instead winegcc receives the following as 4th arg "--as-cmd=as --32" (as verified with a simple program just outputting the args), so actually the quotes get lost and need to be manually filled in if winegcc starts a script running winebuild. Franky, I don't know too much of the process used here.
Attached is a chatlog between me and A. Hentschel.