Issue 113227 - odk: unowinreg.dll build fails with --with-mingwin=...-c++
Summary: odk: unowinreg.dll build fails with --with-mingwin=...-c++
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: jsc
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-18 17:31 UTC by rene
Modified: 2017-05-20 09:32 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description rene 2010-07-18 17:31:53 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...
Comment 1 mst.ooo 2010-07-19 12:34:42 UTC
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.
Comment 2 tono 2010-07-19 13:44:57 UTC
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.
Comment 3 rene 2010-07-19 14:53:09 UTC
Ah, wait. I am blind.

WTF is this calling -c++ in the second step? Should be -strip...
Comment 4 rene 2010-07-19 14:58:10 UTC
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).

Comment 5 rene 2010-07-19 15:00:52 UTC
mst: I bet in your attempts you used --with-mingwin=..-c++, right?
Comment 6 rene 2010-07-19 15:05:23 UTC
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
Comment 7 mst.ooo 2010-07-19 15:05:30 UTC
@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...
Comment 8 rene 2010-07-19 15:08:47 UTC
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.)
Comment 9 mst.ooo 2010-07-19 15:11:21 UTC
> 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  :)
Comment 10 rene 2010-07-28 15:21:41 UTC
> 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.
Comment 11 mst.ooo 2010-07-29 09:32:50 UTC
> 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=...  :)
Comment 12 jsc 2010-09-29 08:52:12 UTC
set target
Comment 13 jsc 2010-09-29 09:40:03 UTC
i have applied the patch on cws jsc340 but are not really able to test it.
Applied after reviewing the changes. 
Comment 14 ab 2011-03-04 09:52:26 UTC
VERIFIED that patch has been applied by checking changeset