Discussion:
Error Compiling espeak
Rob
2016-10-01 22:59:14 UTC
Permalink
When I went to compile espeak from:
http://sourceforge.net/projects/espeak/files/espeak/espeak-1.48/espeak-1.48.04-source.zip
I got the following error
cd espeak-1.48.04-source/src
cp portaudio19.h portaudio.h
make
g++ -O2 -DUSE_PORTAUDIO -D PATH_ESPEAK_DATA=\"/usr/share/espeak-data\" -Wall -pedantic -I. -c -fno-exceptions tr_languages.cpp
tr_languages.cpp:201:43: error: narrowing conversion of ‘194’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
const char string_ordinal[] = {0xc2,0xba,0}; // masculine ordinal character, UTF-8
^
tr_languages.cpp:201:43: error: narrowing conversion of ‘186’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
make: *** [Makefile:102: tr_languages.o] Error 1

Any clue what's happening there? I saw a similar error on google, but no resolution. It seems to be compiler related.
Chris Brannon
2016-10-02 00:15:38 UTC
Permalink
Post by Rob
I got the following error
*text snipped, mentions narrowing conversions
Post by Rob
make: *** [Makefile:102: tr_languages.o] Error 1
Quoting from https://gcc.gnu.org/gcc-6/porting_to.html:

---begin quote---
Narrowing conversions

The C++11 standard does not allow "narrowing conversions"
inside braced initialization lists, meaning conversions to a type with less
precision or a smaller range, for example:


int i = 127;
char s[] = { i, 256 };

In the above example the value 127 would fit in char but because it's not a
constant it is still a narrowing conversion.
If the value 256 is larger than CHAR_MAX then that is also a narrowing conversion.
Narrowing conversions can be avoided by using an explicit cast, e.g. (char)i.
---end quote---

So you could probably fix it by patching the source code and adding a
cast. Another option is to add -Wno-error=narrowing to $CXXFLAGS at build-time.

Hope this helps,
-- Chris
Rob
2016-10-02 00:57:18 UTC
Permalink
Chris Brannon <***@the-brannons.com> wrote:>
So you could probably fix it by patching the source code and adding a
cast. Another option is to add -Wno-error=narrowing to $CXXFLAGS at build-time.

Well the CXXFLAGS approach didn't work.
I've never made a distributable patch for source code before. I'll look that up and see if that works.
I'm fumbling in the dark here (ha ha) because while I get the basic gist of what source code is trying to do (sometimes anyway) I don't know all the syntax and stuff.
Thanks for the hints.

Loading...