Discussion:
[Flac] Compiling - Win - GNU Compiler
TJF
2011-09-28 06:45:05 UTC
Permalink
Hi,

I went in big trouble compiling Flac (Windows). With configure (msys and
mingw32-make 4.5.2) I didn't have success to compile. Makefile.lite the
same. I used also the patches for SIZE_T_MAX UINT_MAX .

Then I could compile every (!) project in flac with MSVC 2008 and I got
all libraries, *.dll and *.exe. The libraries are passing all
test-programs. With my own tools I see the *.dlls inside are working. So
I tried to compile "examples\cpp\decode\file\main.cpp" and
"examples\c\decode\file\main.c" separate with the compiled libraries.

Again no problem with MSVC. But GNU 4.5.2 doesn't do that job (my own
programs are compiled with GNU - so I need this to work - also with
Linux). All libraries are linked.

examples\c\decode\file\main.c
------------------------------------------
I can compile if I don't use this variables (at the bottom of this site
/ extern FLAC_API...):
http://flac.sourceforge.net/api/stream__decoder_8h.html
<cstring> doesn't change anything.

i.e.:
//fprintf(stderr, " state: %s\n",
FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(decoder)]);

If I use this variables I get:
undefined reference to `FLAC__StreamDecoderInitStatusString'


examples\cpp\decode\file\main.cpp
-------------------------------------------------
I cannot compile at all. The same as in C (above) AND ... :

flac.o:flac.cpp:(.text+0xc): undefined reference to
`FLAC__StreamDecoderErrorStatusString'
flac.o:flac.cpp:(.text+0x565): undefined reference to
`FLAC::Decoder::File::File()'
flac.o:flac.cpp:(.text+0x592): undefined reference to
`FLAC::Decoder::Stream::set_md5_checking(bool)'
flac.o:flac.cpp:(.text+0x5a1): undefined reference to
`FLAC::Decoder::File::init(char const*)'

What is the missing link? Any idea?

Thanks a lot!
Regards
Thomas
TJF
2011-09-28 20:06:24 UTC
Permalink
Hi,

could solve the problems. First I installed the actual version of MinGW
(gcc 4.6.1). But I think this is not so important.

This is the way:

1.) This patch for 1.20 is very important also for 1.21 (ntohl - error):
http://sourceforge.net/tracker/?func=detail&atid=313478&aid=1761712&group_id=13478

2.) flac-1.2.1/include/share/alloc.h (added 2 lines):

#ifndef SIZE_MAX
# ifndef SIZE_T_MAX
# ifdef _MSC_VER
# define SIZE_T_MAX UINT_MAX
+ # elif defined(__MINGW_H)
+ # define SIZE_T_MAX UINT_MAX
# else
# error
# endif
# endif
# define SIZE_MAX SIZE_T_MAX
#endif

3.) /examples/cpp/encode/file/main.cpp (added 1 line):

+ #include <string.h>

4.) msys (may work with other options):
configure --enable-sse --disable-ogg --disable-oggtest

and

mingw32-make

and

mingw32-make check

and

mingw32-make install

in "C:\MinGW\msys\1.0\local\lib"

->

libFLAC.a
libFLAC++.a

->

ranlib libFLAC.a
ranlib libFLAC++.a

and renaming the "*.a" to "*.lib"

READY!!!

Regards
Thomas
Post by TJF
Hi,
I went in big trouble compiling Flac (Windows). With configure (msys and
mingw32-make 4.5.2) I didn't have success to compile. Makefile.lite the
same. I used also the patches for SIZE_T_MAX UINT_MAX .
Then I could compile every (!) project in flac with MSVC 2008 and I got
all libraries, *.dll and *.exe. The libraries are passing all
test-programs. With my own tools I see the *.dlls inside are working. So
I tried to compile "examples\cpp\decode\file\main.cpp" and
"examples\c\decode\file\main.c" separate with the compiled libraries.
Again no problem with MSVC. But GNU 4.5.2 doesn't do that job (my own
programs are compiled with GNU - so I need this to work - also with
Linux). All libraries are linked.
examples\c\decode\file\main.c
------------------------------------------
I can compile if I don't use this variables (at the bottom of this site
http://flac.sourceforge.net/api/stream__decoder_8h.html
<cstring> doesn't change anything.
//fprintf(stderr, " state: %s\n",
FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(decoder)]);
undefined reference to `FLAC__StreamDecoderInitStatusString'
examples\cpp\decode\file\main.cpp
-------------------------------------------------
flac.o:flac.cpp:(.text+0xc): undefined reference to
`FLAC__StreamDecoderErrorStatusString'
flac.o:flac.cpp:(.text+0x565): undefined reference to
`FLAC::Decoder::File::File()'
flac.o:flac.cpp:(.text+0x592): undefined reference to
`FLAC::Decoder::Stream::set_md5_checking(bool)'
flac.o:flac.cpp:(.text+0x5a1): undefined reference to
`FLAC::Decoder::File::init(char const*)'
What is the missing link? Any idea?
Thanks a lot!
Regards
Thomas
_______________________________________________
Flac mailing list
Flac at xiph.org
http://lists.xiph.org/mailman/listinfo/flac
Loading...