---+ Compilation on !MacOS X Version 1.0 of the !OpenFst library cannot be compiled on !MacOS X (10.4 Tiger or 10.5 Leopard) using Apple Xcode version of gcc. The reason is that Apple uses gcc 4.0 and this version of gcc has a bug in the copy constructor of TR1's =unordered_map=. This bug was [[http://gcc.gnu.org/ml/libstdc++/2005-08/msg00017.html][fixed almost 4 years ago]]. We suggest here two different workarounds: 1) using a more recent version of gcc (such as the one provided by [[http://fink.sf.net][Fink]] or [[http://www.macports.org/][MacPorts]]) or 2) manually patching the relevant include file in Apple's gcc setup. ---+++ Using gcc 4.2 from [[http://fink.sf.net][Fink]] on Leopard If you have installed the [[http://fink.sf.net][Fink]] package manager on your mac, you can use it to install a working version of gcc 4.2. 1. Make sure you use the [[http://fink.sourceforge.net/news/#2008-06-26%20New%20Fink%20release.][lastest version of Fink (0.9.0)]] and that =/sw/bin= was added to your =PATH= environment variable. 1. Install the gcc42 package <verbatim> $ sudo apt-get install gcc42</verbatim> 1. Compile the !OpenFst library using this version of =g++= instead of Apple's. In the =openfst-1.0= directory, do: <pre> $ CXX=%SLASH%sw%SLASH%bin%SLASH%g++-4 ./configure $ make -j 4 $ make check</pre> [[http://fink.sf.net][Fink]] does not provide pre-compiled versions of gcc for !MacOS X 10.4 Tiger but you can install one from source (see [[http://fink.sf.net][Fink's website]] for more details). An other approach would be to install a working version of gcc using [[http://www.macports.org/][MacPorts]]. ---+++ Patching Apple's gcc 4.0 relevant include file You can also manually change the buggy include file in Apple's setup. 1. Download the patched version of =tr1/hashtable= [[%ATTACHURL%/hashtable][here %ICON{download}%]]. The following assumes that the file was saved to =~/Downloads/hashtable=, replace that by the actual file location (note that your browser might have rename =hashtable= to =hashtable.txt=). 1. (Optional) Check how minimal the change is: <verbatim> $ diff ~/Downloads/hashtable /usr/include/c++/4.0.0/tr1/hashtable</verbatim> 1. Overwrite Apple's version with the patched version and restore file permissions and ownership: <verbatim> $ sudo cp -f ~/Downloads/hashtable /usr/include/c++/4.0.0/tr1/hashtable $ sudo chmod 644 /usr/include/c++/4.0.0/tr1/hashtable $ sudo chown root:wheel /usr/include/c++/4.0.0/tr1/hashtable</verbatim> -- Main.CyrilAllauzen - 03 Mar 2009
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
ext
hashtable
r1
manage
49.0 K
2009-03-03 - 20:15
CyrilAllauzen
gcc 4.0 version of
tr1/hashtable
with fixed copy constructor
This topic: FST
>
WebHome
>
FstDownload
>
CompilingOnMacOSX
Topic revision: r4 - 2009-03-05 - CyrilAllauzen
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback