Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 942
syb0rg Avatar asked Mar 20 '23 22:03

syb0rg


2 Answers

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.

like image 118
Corbin Avatar answered Mar 29 '23 02:03

Corbin


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.

like image 34
TJ Rana Avatar answered Mar 29 '23 01:03

TJ Rana