[XviD-devel] Linked errors cross-compiling for x64 Windows on x64 Linux

Michael Militzer michael at xvid.org
Thu Feb 17 09:24:41 CET 2011


Hi,

I don't know which app you are trying to link but it seems that the linker
expects the entry point WinMain() and that's not defined in your app.

Afaik, windows command line programs have main() and GUI programs WinMain()
as default entry points. So it seems you are trying to compile as a windowed
app.

To solve the problem either define a WinMain() for your program or if you
rather want a command line app, tell gcc not to create a windowed app (iirc,
that means not using the -mwindows option).

Regards,
Michael


Quoting Leo Izen <leo.izen at gmail.com>:

> On Wed, Feb 16, 2011 at 5:04 PM, Michael Militzer <michael at xvid.org> wrote:
>
>> Hi,
>>
>> you can prevent the leading underscores by adding "-DNO_PREFIX" to your
>> yasm/nasm command line.
>>
>>
> I did that, and it build except for errors with:
>
>   L: libxvidcore.dll
> Creating library file: libxvidcore.dll.a
> /usr/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):
> In function `main':
> /buildbot/mingw-w64/linux-x86_64-x86_64/build/build/mingw/obj/../../../build/mingw/mingw-w64-crt/crt/crt0_c.c:18:
> undefined reference to `WinMain'
> collect2: ld returned 1 exit status
> make: *** [libxvidcore.dll] Error 1
>
> Why is this?
>
> Regards,
>> Michael
>>
>>
>> Quoting Leo Izen <leo.izen at gmail.com>:
>>
>> > On Wed, Feb 16, 2011 at 8:03 AM, Michael Militzer <michael at xvid.org>
>> wrote:
>> >
>> >> Hi,
>> >>
>> >> all your undefined references are symbols defined in assembler .asm
>> files.
>> >> So I guess something did go wrong assembling these files (or the object
>> >> output is broken etc.).
>> >>
>> >
>> > Problem discovered: all the assembly symbols are prefixed by and
>> underscore:
>> > i.e.
>> >
>> > [Leo at chessman =build]$ x86_64-w64-mingw32-nm
>> > quant/x86_asm/quantize_h263_mmx.o
>> > 0000000000000000 r .rodata
>> > 0000000000000000 t .rotext
>> > 0000000000000000 t .text
>> > 0000000000000840 T _dequant_h263_inter_mmx
>> > 000000000000087e t _dequant_h263_inter_mmx.loop
>> > 00000000000009c0 T _dequant_h263_inter_sse2
>> > 0000000000000a1d t _dequant_h263_inter_sse2.loop
>> > 0000000000000900 T _dequant_h263_inter_xmm
>> > 0000000000000940 t _dequant_h263_inter_xmm.loop
>> > 0000000000000580 T _dequant_h263_intra_mmx
>> > 00000000000005be t _dequant_h263_intra_mmx.loop
>> > 0000000000000720 T _dequant_h263_intra_sse2
>> > 0000000000000777 t _dequant_h263_intra_sse2.loop
>> > 0000000000000660 T _dequant_h263_intra_xmm
>> > 000000000000069c t _dequant_h263_intra_xmm.loop
>> > 00000000000002c0 T _quant_h263_inter_mmx
>> > 0000000000000356 t _quant_h263_inter_mmx.done
>> > 0000000000000300 t _quant_h263_inter_mmx.loop
>> > 0000000000000380 t _quant_h263_inter_mmx.q1loop
>> > 000000000000036b t _quant_h263_inter_mmx.q1routine
>> > 00000000000003e0 T _quant_h263_inter_sse2
>> > 00000000000004ac t _quant_h263_inter_sse2.qes2_done
>> > 0000000000000440 t _quant_h263_inter_sse2.qes2_loop
>> > 000000000000040f t _quant_h263_inter_sse2.qes2_not1
>> > 00000000000004dd t _quant_h263_inter_sse2.qes2_q1_routine
>> > 0000000000000500 t _quant_h263_inter_sse2.qes2_q1loop
>> > 0000000000000000 T _quant_h263_intra_mmx
>> > 0000000000000120 t _quant_h263_intra_mmx.end
>> > 000000000000004e t _quant_h263_intra_mmx.loop
>> > 00000000000000c1 t _quant_h263_intra_mmx.loop_low
>> > 00000000000000af t _quant_h263_intra_mmx.low
>> > 0000000000000140 T _quant_h263_intra_sse2
>> > 00000000000002a5 t _quant_h263_intra_sse2.end
>> > 000000000000019f t _quant_h263_intra_sse2.loop
>> > 000000000000022e t _quant_h263_intra_sse2.loop_low
>> > 000000000000021b t _quant_h263_intra_sse2.low
>> > 0000000000000220 r mmx_div
>> > 0000000000000020 r mmx_quant
>> > 0000000000000120 r mmx_sub
>> > 0000000000000000 r plus_one
>> > [Leo at chessman =build]$
>> >
>> >
>> >>
>> >> Which assembler do you use? yasm or nasm? Make sure you have the latest
>> >> (stable) version installed. If you already have the latest version, try
>> >> yasm instead of nasm (or vice-versa).
>> >>
>> >>
>> >  I am using yasm, from my package manager and the latest cvs of xvidcore.
>> > However, seeing that I figured out that there's underscores above, I
>> think a
>> > better solution would be an addition to AFLAGS to not use an underscore.
>> My
>> > current AFLAGS do use -f win64 and the needed stuff to assemble for
>> > x86_64-w64-mingw32, and from the nm above, the object files are valid.
>> >
>> > So...  is there an AFLAG that will let me remove the _prefix?
>> >
>> >
>> >> I have successfully cross-compiled xvidcore to win64 with both yasm and
>> >> nasm, but with older gcc (not 4.6). But it doesn't look like gcc is the
>> >> problem here...
>> >>
>> >> Regards,
>> >> Michael
>> >>
>> >>
>>
>>
>>
>> _______________________________________________
>> Xvid-devel mailing list
>> Xvid-devel at xvid.org
>> http://list.xvid.org/mailman/listinfo/xvid-devel
>>
> _______________________________________________
> Xvid-devel mailing list
> Xvid-devel at xvid.org
> http://list.xvid.org/mailman/listinfo/xvid-devel
>
>




More information about the Xvid-devel mailing list