Closed Bug 672024 Opened 10 years ago Closed 10 years ago

Mingw build error: undefined reference to `WinMain@16' in nsinstall_win.c

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla9

People

(Reporter: nospam.kotarou.dono, Assigned: nospam.kotarou.dono)

Details

Attachments

(1 file, 4 obsolete files)

I get this build error on attempting to build config/nsinstall_win.c on MinGW:

c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libmingw32.a(main.o):main
.c:(.text+0x106): undefined reference to `WinMain@16'

From Bug #411826, I have worked out that it is because MinGW does not support wide mains and have created a patch, based on the other bug's patch, to create a "normal" main and have it wrap around the wide main
Attached patch Wrapper main (obsolete) — Splinter Review
Oh, I forgot to mention that I did a rgrep of he source tree, looking for more files using wide mains without a "normal" main counterpart and found that the file at js/src/config/nsinstal_win.c (Which has the exact same contents as the other nsinstall_win.c) also needed to be patched
I just noticed that I made LocalFree free the wrong variable. Fixed it up
Attachment #546295 - Attachment is obsolete: true
Bugzilla did something funny to my patch and made the diffs of two separate files merge in to one. Maybe it was because it didn't have any whitespace between the two. Let me try adding some in
Attachment #546296 - Attachment is obsolete: true
-Sigh-

Bugzilla messed it up again. I'll just attach it as a regular text file then...
Attached file text/plain version of the same patch (obsolete) —
Attachment #546298 - Attachment is obsolete: true
Welcome to contributing! :-)

(In reply to comment #4)
> Bugzilla did something funny to my patch and made the diffs of two separate
> files merge in to one. Maybe it was because it didn't have any whitespace
> between the two. Let me try adding some in

The reason Bugzilla is getting confused is that the patch isn't in the correct format, eg it's using:
--- js/src/config/nsinstall_win.c
+++ js/src/config/nsinstall_win.c.new

rather than:
--- a/js/src/config/nsinstall_win.c
+++ b/js/src/config/nsinstall_win.c

To get mercurial to export patches in the most appropriate format, this should help you out:
https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3f

When attaching the patch, make sure to pick a reviewer, so that the patch doesn't get missed. You'll need to set the review field to "?" and the email address to whomever you want to ask to review.

The best way to pick who to ask is to either look at the hg log and see what r=zzz entries are present (http://hg.mozilla.org/mozilla-central/filelog/tip/config/nsinstall_win.c) or else look at the modules page here: https://wiki.mozilla.org/Modules

Hope that helps! :-)
Assignee: nobody → nospam.kotarou.dono
Status: UNCONFIRMED → ASSIGNED
Component: General → Build Config
Ever confirmed: true
QA Contact: general → build-config
Comment on attachment 546297 [details] [diff] [review]
Attempted to fix up the patch format

Review of attachment 546297 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #546297 - Flags: review?(khuey)
Eh. Guess that didn't work. Could someone give me some more detailed instructions?
That set the reviewer fine - but it was on the old patch, that isn't in the right format. 

I can manually edit the patch and reupload if you like - but it won't resolve the problem long term. If you take a look at https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3f and post back if there is anything specific that isn't working :-)
Attached patch Another trySplinter Review
The thing is, I'm not using Mercurial. I don't have Mercurial and I don't really want to install it. What I'm doing right now is just downloading the "problem" files manually and diffing it against my edited version.

I've hand edited it a bit, trying to follow the format of another diff on bugzilla. Hopefully this time it works
Attachment #546297 - Attachment is obsolete: true
Attachment #546407 - Flags: review?(khuey)
Attachment #546297 - Flags: review?(khuey)
(In reply to comment #0)
> From Bug #411826, I have worked out that it is because MinGW does not
> support wide mains and have created a patch, based on the other bug's patch,
> to create a "normal" main and have it wrap around the wide main

Things have changed in mingw (BTW, mingw-w64, a fork of mingw, is the right choice for Mozilla compilation). All GCC version that we care about already support wmain. The thing is that it requires -municode switch in linker invocation. It would be great if you could patch Makefile.in to use that switch instead, since we will probably want to remove wrapper hacks anyways.
Comment on attachment 546407 [details] [diff] [review]
Another try

Assuming it works for you, r=me
Attachment #546407 - Flags: review?(khuey) → review+
Keywords: checkin-needed
Pushed to m-c:
http://hg.mozilla.org/mozilla-central/rev/92b574170b33
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite-
OS: Windows XP → All
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.