Search code examples
macosinstallationmakefilestatic-librariesflite

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?


Solution

  • 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.