bootphon / wordseg

A Python toolbox for text based word segmentation
https://docs.cognitive-ml.fr/wordseg
GNU General Public License v3.0
16 stars 7 forks source link

wordseg-ag: compilation fatal error: 'ext/stdio_filebuf.h' file not found #15

Open mmmaat opened 6 years ago

mmmaat commented 6 years ago

This issue is related to Adaptor Grammar compilation error on MacOS using the Apple Clang compiler.

A dirty solution for now is to use the GCC compiler instead. Indeed the ext/stdio_filebuf.h is a non-standard C header bundled with GCC, but not with Clang. On Mac it can be installed (gcc-7.1) from http://hpc.sourceforge.net.

Once done, in the cmake output you should have

-- The C compiler identification is GNU someversion
-- The CXX compiler identification is GNU someversion

instead of

-- The C compiler identification is AppleClang someversion
-- The CXX compiler identification is AppleClang someversion

I'm working on a portable solution based on boost::iostreams instead.

mmmaat commented 6 years ago

Finally I decided to remove pstream.h from AG. It was called from main.cc only to support the options -U -V -X -Y. They handle stream output to custom shell commands and are useless in the wordseg framework. This change do not impact the AG processing in any case. See commit https://github.com/bootphon/wordseg/commit/0f01c6962ff1f4fcd49b864aa58302fb1fa5430c.

MQ-MJ commented 5 years ago

Hi everyone,

I just came across this because someone asked me if they could run adaptor grammars on OS-X. I tried to compile the py-cfg code on a Mac, and discovered exactly this problem.

@mmmaat is right that the adaptor grammar sampler itself will work just fine without the options that let you pipe the output into other commands.

But being able to pipe intermediate results into an evaluation command lets you monitor things like convergence during the run of a sampler.

For my own purposes, I've solved my problem by installing gcc on the Mac. But I can look at making this work on the Mac clang compiler if anyone cares.

It seems that pstreams would be an easy way to get this working across many platforms.

Best,

Mark Johnson

mmmaat commented 5 years ago

Hi Mark, as wordseg uses it's own logging system, I removed dependencies to pstream.h and simply used std::cout / std::cerr. The stream is then forwarded to the Python wrapper of AG (see here).

But the actual version of AG in wordseg still doesn't compile on MacOS (I can't remember why) and the documentation suggests users to run it within docker on Mac and Windows.

But if you want to make the code portable across platforms, you are very welcome to do it, either by implementing a pstreams solution or documenting the instalaltion of a compatible version of GCC under MacOS.

Thanks anyway, Mathieu

MQ-MJ commented 5 years ago

Yes, you're right -- CLANG differs from g++ in many ways. I'm stuck on a problem where g++ and CLANG IO consume different numbers of characters from the input on a failed read (ugh). I think I'll give up for now unless I can think of an easy fix.

It seems to compile fine under g++ on my linux box, and I used to compile it on my mac with g++ installed with homebrew ... that still should work.

Mark

On 10/3/19 01:45, Mathieu Bernard wrote:

Hi Mark, as wordseg uses it's own logging system, I removed dependencies to pstream.h and simply used std::cout / std::cerr. The stream is then forwarded to the Python wrapper of AG (see herehttps://protect-au.mimecast.com/s/yFUuCP7L1Nf5J9OXcj_G-M?domain=github.com).

But the actual version of AG in wordseg still doesn't compile on MacOS (I can't remember why) and the documentation suggests users to run it within dockerhttps://protect-au.mimecast.com/s/WSqxCNLJxkiMwJA3I4HVA2?domain=wordseg.readthedocs.io on Mac and Windows.

But if you want to make the code portable across platforms, you are very welcome to do it, either by implementing a pstreams solution or documenting the instalaltion of a compatible version of GCC under MacOS.

Thanks anyway, Mathieu

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://protect-au.mimecast.com/s/LtNZCOMK7Yc2ElJxhk6M6t?domain=github.com, or mute the threadhttps://protect-au.mimecast.com/s/TLCDCQnM1WfNJg8PUrmOXW?domain=github.com.