#264 Patch for compiling with MinGW

closed-fixed
5
2014-08-18
2007-03-21
No

Hi,

I have problems compiling with MinGW, including:

* ntohl() is defined in winsock.h and requires -lwsock32 to link. The FLAC sourcecode needs to be adjusted here.

* Some #includes have capitals in the filenames where there shouldn't be - prevents compiling (like Windows.h instead of windows.h)

* flac/main.c should #include <unistd.h> for unlink()

* I had trouble compiling without OGG, so I hacked the configure script to force no_ogg. Not appropriate for the flac CVS/SVN but I thought I should mention that I had trouble.

thanks
Paul

Discussion

  • Josh Coalson

    Josh Coalson - 2007-07-31

    Logged In: YES
    user_id=78173
    Originator: NO

    I checked in most of it, but not the -lwsock32 part, can you make the patch so that it only tries to link that library when compiling for MinGW? that needs some configure.in hacking for detecting mingw...

     
  • Josh Coalson

    Josh Coalson - 2007-07-31
    • status: open --> open-accepted
     
  • Elegant Dice

    Elegant Dice - 2007-07-31

    Logged In: YES
    user_id=1168070
    Originator: YES

    Hi Josh,

    Attached is a patch with all my previous changes, plus changes to configure.in, a couple of Makefile.in AND changes to configure (so you don't have to autoconf to generate a new 'configure' file).

    To compile, I use the (possibly) standard mingw cross-setup, cross-configure and cross-make scripts (which just set up the environment and call configure and make), but I have to use

    ./cross-configure --disable-ogg

    when compiling, as like I said before, the configure script assumes that OGG works when cross-compiling, and it won't on my system.

    cheers,
    Paul

    File Added: flac-1.1.4.patch.20070731

     
  • Josh Coalson

    Josh Coalson - 2007-08-01
    • assigned_to: nobody --> jcoalson
    • status: open-accepted --> closed-fixed
     
  • Josh Coalson

    Josh Coalson - 2007-08-01

    Logged In: YES
    user_id=78173
    Originator: NO

    ok, I checked in the equivalent changes to Makefile.am's and configure.in

     
  • kirben

    kirben - 2007-08-01

    Logged In: YES
    user_id=34715
    Originator: NO

    This patch should not have been added, as it requires a network library (winsock) to be linked in, anytime an mingw built FLAC library is used.

    Please use my alternative patch for FLAC 1.2.0 at https://sourceforge.net/tracker/?func=detail&atid=313478&aid=1761712&group_id=13478 to avoid this additional requirement.

     
  • Josh Coalson

    Josh Coalson - 2007-08-01

    Logged In: YES
    user_id=78173
    Originator: NO

    I will probably be replacing the call to ntohl() with something more portable before the next release so none of this will be needed...

     
  • Max Horn

    Max Horn - 2009-03-09

    I wonder why you would use ntohl at all. It is not suited well for optimizations by the compiler (unless it happens to be implemented as a compiler intrinsic), and looking at your code, you already have code for MSVC that performs the required byte swapping, *and* you have a check for big endian systems...

    So you could at the same time simplify and shorten the code, while increasing its portability (not relaying on POSIX API), and reducing the pain for Mingw users who want to use an unpatched FLAC...

    Of course, also a new release would be required... ;).

     

Log in to post a comment.