syb0rg
syb0rg

Reputation: 8247

Error installing flite on Mac OSX

I have downloaded the latest source distribution of flite, and went about the usual process of installing it.

$ ./configure
$ make
$ sudo make install

However, I run into a strange error when I try to install the library to my system.

$ sudo make install
Installing
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/include/flite
/usr/bin/install -c -m 644 include/*.h /usr/local/include/flite
/usr/bin/install -c -m 755 ../bin/flite_time /usr/local/bin
cp -pd ../build/i386-darwin13.1.0/lib/libflite_cmu_us_kal.a ../build/i386-darwin13.1.0/lib/libflite_cmu_time_awb.a ../build/i386-darwin13.1.0/lib/libflite_cmu_us_kal16.a ../build/i386-darwin13.1.0/lib/libflite_cmu_us_awb.a ../build/i386-darwin13.1.0/lib/libflite_cmu_us_rms.a ../build/i386-darwin13.1.0/lib/libflite_cmu_us_slt.a ../build/i386-darwin13.1.0/lib/libflite_usenglish.a ../build/i386-darwin13.1.0/lib/libflite_cmulex.a ../build/i386-darwin13.1.0/lib/libflite.a /usr/local/lib
cp: illegal option -- d
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
make[1]: *** [install] Error 64
make: *** [install] Error 2

How can I fix this?

Upvotes: 4

Views: 2041

Answers (3)

John Riselvato
John Riselvato

Reputation: 12924

I ran into this same issue recently, TJ Rana put me in the right direction but here's the whole process of installing flite on MacOS (original article here):


Flitevox or Flitelib is an open source small run time speech engine. Pass it text and create an audio file with a robot saying it. Really cool and useful for some projects.

Flitelib is not a native filter available in FFmpeg build nor inside the source. Although the documentation states that –enable-libflite is required for config, installing flitelib is required before installing FFmpeg. If you do try to enable the filter you’ll get this error:

$ ./configure --disable-indevs --enable-libflite --enable-cross-compile
ERROR: libflite not found

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

In this post, I’ll show you how to install flite and get it working with FFmpeg

First download flitevox from source and install:

$ git clone https://github.com/festvox/flite.git
$ cd flite/
$ ./configure
$ make
$ sudo make install

If you’re running linux this installation works perfectly. If you’re running MacOS, you’ll get this error:

$ sudo make install
Password:
Installing
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/include/flite
/usr/bin/install -c -m 644 include/*.h /usr/local/include/flite
/usr/bin/install -c -m 755 ../bin/flite_time /usr/local/bin
cp -pd ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_kal.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_time_awb.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_kal16.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_awb.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_rms.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_slt.a ../build/x86_64-darwin19.0.0/lib/libflite_usenglish.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_indic_lang.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_grapheme_lang.a ../build/x86_64-darwin19.0.0/lib/libflite_cmulex.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_indic_lex.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_grapheme_lex.a ../build/x86_64-darwin19.0.0/lib/libflite.a /usr/local/lib
cp: illegal option -- d
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
make: *** [install] Error 2

That’s because MacOS uses different “cp” variables then linux. I found this Stack Overflow answer with the solution: https://stackoverflow.com/a/29075638/525576 but here’s the steps to fix it.

In the folder “flite/main” you’ll need to edit the Makefile with the MacOS version of the command:

$ cd main/
$ vim Makefile

Replace the following (from TJ Rana):

#       The libraries: static and shared (if built)
        cp -pd $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
        cp -pd $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif

to (-pd to -pR):

#       The libraries: static and shared (if built)
        cp -pR $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
        cp -pR $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif

How we can try installing flite again:

$ sudo make install

flite should not show any errors and the installation should be complete.

Now back in ffmpeg source filter:

$ ./configure --enable-libflite --enable-cross-compile
$ make install

Installation will complete. To test if flite is working open a new terminal and type:

$ ffplay -f lavfi -i flite=text='Hello World!'

Hello world will speak!

Upvotes: 1

TJ Rana
TJ Rana

Reputation: 11

I was able to solve this problem using Corbin's suggestion. After searching the Makefile, I was able to spot where the error originated.

I am using flite-2.0.0-release and the Makefile was located in the following directory: /flite-2.0.0-release/main/.

The last couple lines has the following:

#       The libraries: static and shared (if built)
        cp -pd $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
        cp -pd $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif

I've changed the to the following:

#       The libraries: static and shared (if built)
        cp -pR $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
        cp -pR $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif

By replacing the cp -pd to cp -pR, I was able to successfully install flite. I hope this advice helps.

Upvotes: 1

Corbin
Corbin

Reputation: 33457

There a few subtle differences between the BSD cp that Mac uses and the GNU cp of most linux distributions.

Consider the following snippet of man cp from a linux box:

   -d     same as --no-dereference --preserve=links

   -P, --no-dereference
          never follow symbolic links in SOURCE

   --preserve[=ATTR_LIST]
          preserve  the  specified  attributes (default: mode,ownership,timestamps), if possible additional attributes: context,
          links, xattr, all

So basically what it's trying to do is "copy the following paths, and if they're links, just copy the link, not the underlying file."

The p option exists under Mac and is equivalent to the linux behavior. The d option, however, is absent.

I've tried to figure out a way to mimic the behavior of "copy links, not targets" with the Mac cp, and as far as I can tell, there's no pleasant way to do it.

There is, fortunately, a gross work around. From man cp under Mac:

Symbolic links are always followed unless the -R flag is set, in which case symbolic links are not followed, by default.

In other words, since we know we're only copying files, you can simply replace the d flag with the R flag. The behavior is technically different (very different), but it won't matter in this specific case. You'll need to find the cp flags used in the Makefile (hopefully in a CP variable at the top of the file) and simply change them.

If you're sure the cp is the last thing to be executed in the Makefile, you could also just copy and paste it instead of changing the Makefile.

Upvotes: 5

Related Questions