voikko / corevoikko

Libvoikko and essential linguistic resources
Other
89 stars 25 forks source link

libvoikko won't compile on OSX 10.11, gives -pthread error #24

Closed snomos closed 8 years ago

snomos commented 8 years ago

Since upgrading to OSX 10.11 I have been unable to build libvoikko. I have compiled hfst-ospell with the following configuration:

./configure --enable-zhfst --with-tinyxml2 --without-libxmlpp PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ CC=clang CXX=clang++ CXXFLAGS="-std=gnu++11 -stdlib=libc++"

Adding the CC, CXX and CXXFLAGS options was required to avoid libvoikko erring out on missing x86_64 symbols during linking. Then I configured libvoikko as follows:

./configure --with-dictionary-path=/Library/Spelling/voikko:/usr/local/lib/voikko:/usr/local/share/voikko --disable-werror PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ CXXFLAGS="$CXXFLAGS -Wall -Werror -fvisibility=hidden -std=gnu++11 -stdlib=libc++" CXX=clang++ CC=clang

I tried different variants for the CXXFLAGS, but irrespective of what I try, I always get the following error when linking voikko-spell:

clang: error: argument unused during compilation: '-pthread'

According to what I have understood from a couple of people I have discussed this issue with, the actual error is just one of configuration: it should not be an error, only a warning. Would it be possible to change the configure.ac file such that clang on OSX will link the object files? Or is there something simple I can do on my end to avoid this error?

hatapitk commented 8 years ago

This sounds something that was already fixed in fa86ef7c5f33505eea8056f826c44d179dbc8490. Please try running ./autogen.sh if you have not done that lately and see if that helps.

snomos commented 8 years ago

I am unable to find a combination of configure options that not either gives me that error:

clang: error: argument unused during compilation: '-pthread'

or the error:

  CXXLD    libvoikko.la
Undefined symbols for architecture x86_64:
  "hfst_ol::Transducer::lookup[abi:cxx11](char*)", referenced from:

What configure options did you use when building first hfst-ospell and then libvoikko for OSX?

hatapitk commented 8 years ago

The configure options were

PKG_CONFIG_PATH=/Users/harri/inst64/lib/pkgconfig/ ./configure --prefix=/Users/harri/inst64 --enable-zhfst --with-tinyxml2 --without-libxmlpp --disable-hfst-ospell-office
PKG_CONFIG_PATH=/Users/harri/inst64/lib/pkgconfig/ ./configure --prefix=/Users/harri/inst64 --with-dictionary-path=/Library/Spelling/voikko:/usr/local/share/voikko:/usr/share/voikko:/usr/local/lib/voikko

But I don't think that either of those errors are related to configuration. The first one is just a bug in configure script (that I thought was fixed already, can't reporoduce it myself on Linux so I have to see if it happens just on OS X). The second looks like that hfst-ospell has not been compiled with C++11 ABI. Not sure if it is a bug in hfst-ospell or just due to use of different compilers. I have seen that on Linux too when hfst-ospell was compiled with GCC and libvoikko with Clang.

snomos commented 8 years ago

Both hfst-ospell and libvoikko were compiled with the

CXXFLAGS="-std=gnu++11 -stdlib=libc++"

configuration, which should ensure compilation with the C++11 ABI, AFAIU. And the Undefined symbol error disappears with this configuration, so that should not be the issue. What is left is the clang error related to -pthread.

hatapitk commented 8 years ago

There were a couple of additional fixes made to ax_pthread.m4 within the last two months. I updated the macro to the latest version and tested (on OS X) that it fixed the error.

snomos commented 8 years ago

Thanks. I can confirm that now, with your latest ax_pthread.m4 update + me removing all CXX flags etc for both hfst-ospell and libvoikko, libvoikko compiles as it should again. :-)