Apache OpenOffice (AOO) Bugzilla – Issue 113227
odk: unowinreg.dll build fails with --with-mingwin=...-c++
Last modified: 2017-05-20 09:32:17 UTC
Entering /home/rene/OpenOffice.org/OOO330_m1/odk/source/unowinreg/win i586-mingw32msvc-c++ -Wall -D_JNI_IMPLEMENTATION_ -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux \ -I../../../inc/pch -shared -o ../../../unxlngx6.pro/bin/unowinreg.dll unowinreg.cxx \ -Wl,--kill-at -lkernel32 -ladvapi32 i586-mingw32msvc-c++ ../../../unxlngx6.pro/bin/unowinreg.dll /usr/lib/gcc/i586-mingw32msvc/4.4.4/../../../../i586-mingw32msvc/lib/libmingw32.a(main.o):(.text+0x85): undefined reference to `_WinMain@16' collect2: ld returned 1 exit status dmake: Error code 1, while making '../../../unxlngx6.pro/bin/unowinreg.dll' dmake: '../../../unxlngx6.pro/bin/unowinreg.dll' removed. I first thought of a change between m83 and m1 but a hg diff didn't show anything for compile stuff, just docs. Then I thought about a compiler change - but it can't be a compiler change either because both m83 and 3.2.1 build fine with exact the same compiler...
i remember having the same problem, but on far older milestones... i think when i had Fedora 10 on my laptop at home, i've never seen this, but with Fedora 11 and 12 i've always had this problem, trying to build something ~DEV300m60, with the same error message (some WinMain@16 not found). but haven't build anything on my laptop for some months... back then i suspected the new MinGW version broke it, but that is inconsistent with rene's observation.
libmingw32.a(main.o) is the housekeeping module for Windows application(.exe). It is not needed for shared dll and seems to be erroneously included. If -shared nor -mdll is not specified, the startup module refers the symbol "main" and the module will be included if "main" is not defined in user code, that is not console application. As -shared is specified, the error may be caused "main"is refered somewhere else. It may be informative to generate linker map using -Wl,Map=xxxx.
Ah, wait. I am blind. WTF is this calling -c++ in the second step? Should be -strip...
OK, I see the problem. I accidentially specified ---with-mingwin=i586-mingw32msvc+c++ instead of -g++. Which makes the MINGWSTRIP defined wrongly (and in my other testbuilds I did it right) --- a/configure.in +++ b/configure.in @@ -3496,7 +3496,7 @@ AC_MSG_RESULT(yes) fi if echo "$WITH_MINGWIN" | $EGREP -q "/"; then - if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/)); fi + if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/)); fi else AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/`, false) fi shold fix it (i.e. also change c++ into strip).
mst: I bet in your attempts you used --with-mingwin=..-c++, right?
missed one place. Updated patch: diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -3496,7 +3496,7 @@ AC_MSG_RESULT(yes) fi if echo "$WITH_MINGWIN" | $EGREP -q "/"; then - if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/)); fi + if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/)); fi else AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/`, false) fi
@rene: ouch, that's a nasty pitfall... i wonder why doesn't configure check for i586-mingw32msvc-c++ itself (on non-MinGW/MSYS platforms)? is it called differently on every linux distro or what? maybe that could eliminate the pitfall... oh, and your patch seems to be incomplete: there is another sed s/g++/strip/ in the context...
gna. now really and tested: diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -3496,9 +3496,9 @@ AC_MSG_RESULT(yes) fi if echo "$WITH_MINGWIN" | $EGREP -q "/"; then - if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/)); fi + if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`"; then MINGSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/)); fi else - AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/`, false) + AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false) fi if test "$MINGWSTRIP" = "false"; then AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
> mst: I bet in your attempts you used --with-mingwin=..-c++, right? can't tell right now, but possible. ah, i see you've spotted the AC_CHECK_TOOL line now :)
> i wonder why doesn't configure check for i586-mingw32msvc-c++ itself (on > non-MinGW/MSYS platforms)? > is it called differently on every linux distro or what? Actually, I think when I wrote this I wasn't sure and afaicr I saw a i486-whatever. But googling (for mingw32msvc) now, I only see i586-mingw32msvc-* so checking for that and only falling back after this to the --with-mingwin=xx value might work, too.
> mst: I bet in your attempts you used --with-mingwin=..-c++, right? that's what the history says. > Actually, I think when I wrote this I wasn't sure and afaicr I saw a > i486-whatever. But googling (for mingw32msvc) now, I only see i586-mingw32msvc-* > so checking for that and only falling back after this to the --with-mingwin=xx > value might work, too. actually, on my Fedora 12 system it's called "i686-pc-mingw32-c++" (and it says "Fedora MinGW 4.4.1-3.fc12") so there is indeed substantial creativity here... i guess checking for 2 variants is reasonable, and if it's called something else on Gentoo they can use --with-mingw=... :)
set target
i have applied the patch on cws jsc340 but are not really able to test it. Applied after reviewing the changes.
VERIFIED that patch has been applied by checking changeset