Menu

#451 lamime.c fails to compile under cygwin64 - lametime.c:139:25: error: ‘_O_BINARY’ undeclared

Compatibility
closed-fixed
None
5
2024-01-04
2015-08-23
No

Compiling under cygwin64, lame 3.99.5 fails to compile.

It fails with error

In file included from lametime.c:125:0:
lametime.c: In function ‘lame_set_stream_binary_mode’:
lametime.c:139:25: error: ‘_O_BINARY’ undeclared (first use in this function)
setmode(fileno(fp), _O_BINARY);

Here are the steps to reproduce the error

~~~~~~
$ wget "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1440303241&use_mirror=iweb"

$ gunzip lame-3.99.5.tar.gz

$ tar -xf lame-3.99.5.tar

$ cd lame-3.99.5/
# this next step is due to a failure in ./configure recognizing the platform, the latest version of config.guess must be retrieved, looks something like this
$ wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"

$ ./configure

$ make
...
gcc -DHAVE_CONFIG_H  -I. -I.. -I../libmp3lame -I../include -I..    -O3 -fomit-frame-pointer -ffast-math -Wall -pipe      -MT lametime.o -MD -MP -MF .deps/lametime.Tpo -c -o lametime.o lametime.c
In file included from lametime.c:125:0:
lametime.c: In function ‘lame_set_stream_binary_mode’:
lametime.c:139:25: error: ‘_O_BINARY’ undeclared (first use in this function)
setmode(fileno(fp), _O_BINARY);
                 ^
lametime.c:139:25: note: each undeclared identifier is reported only once for each function it appears in
Makefile:392: recipe for target 'lametime.o' failed
make[2]: *** [lametime.o] Error 1
make[2]: Leaving directory '/tmp/lame-3.99.5/frontend'
Makefile:349: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/lame-3.99.5'
Makefile:276: recipe for target 'all' failed
make: *** [all] Error 2

$ gcc --version
gcc (GCC) 4.9.3

$ uname -a
CYGWIN_NT-6.1 host 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64 Cygwin

~~~~~~

Discussion

  • Darik Horn

    Darik Horn - 2015-10-28

    Try this patch:

    Index: frontend/lametime.c
    ===================================================================
    RCS file: /cvsroot/lame/lame/frontend/lametime.c,v
    retrieving revision 1.21
    diff -u -r1.21 lametime.c
    --- frontend/lametime.c 7 May 2011 16:05:17 -0000       1.21
    +++ frontend/lametime.c 28 Oct 2015 16:57:40 -0000
    @@ -135,8 +135,10 @@
         _fsetmode(fp, "b");
     #elif defined __BORLANDC__
         setmode(_fileno(fp), O_BINARY);
    +/*
     #elif defined __CYGWIN__
         setmode(fileno(fp), _O_BINARY);
    +*/
     #elif defined _WIN32
         _setmode(_fileno(fp), _O_BINARY);
     #else
    

    This works with Cygwin 2.2 and the Lame 3.100 cvs head.

     
    • Qwerty Asd

      Qwerty Asd - 2024-01-03

      It works. Thanks!

       
  • Alexander Leidinger

    • status: open --> pending
    • assigned_to: Alexander Leidinger
     
  • Alexander Leidinger

    3.101 should fix this (cygwin documents O_BINARY instead of _O_BINARY).

     
  • Alexander Leidinger

    • status: pending --> closed-fixed
     
  • Alexander Leidinger

    Fixed in SVN.

     

Log in to post a comment.