eddelbuettel / bh

R package providing Boost Header files
85 stars 33 forks source link

boost locale support #41

Closed mlampros closed 7 years ago

mlampros commented 7 years ago

First of all thank you for all your contributions especially for the Rcpp, RcppArmadillo and BH packages.

A few months back, I created a text processing package textTinyR using the boost library. Although I faced some problems due to the boost-locale, I partly overcame those by not using locale on Windows (I also came across a similar issue) and by adding a configure file for linux and macintosh (on macintosh it worked only for the latest release, Sierra). Last week I submitted an updated version to CRAN and I realized that it doesn't work for macintosh any more.

I wonder if it's possible to add full support for boost-locale in the BH package? In such a case I would restructure my package accordingly, so that it works on all OS's.

eddelbuettel commented 7 years ago

Quick question: Is that header-only? Can it be made header-only?

A few Boost library require linking, a few of those can be #ifdef'ed to remove some features to not require linking. But most examples still requiring linking are text / string related so I am not too hopeful here.

Can you try to find out some more details?

mlampros commented 7 years ago

Besides the BH package I do include (for a unix OS) also the following,

#ifndef _WIN32
  #include <boost/locale.hpp>
#endif

As of boost 1.62 the boost/locale.hpp file includes the following:


#ifndef BOOST_LOCALE_HPP_INCLUDED
#define BOOST_LOCALE_HPP_INCLUDED

#include <boost/locale/boundary.hpp>
#include <boost/locale/collator.hpp>
#include <boost/locale/conversion.hpp>
#include <boost/locale/date_time.hpp>
#include <boost/locale/date_time_facet.hpp>
#include <boost/locale/encoding.hpp>
#include <boost/locale/format.hpp>
#include <boost/locale/formatting.hpp>
#include <boost/locale/generator.hpp>
#include <boost/locale/gnu_gettext.hpp>
#include <boost/locale/info.hpp>
#include <boost/locale/localization_backend.hpp>
#include <boost/locale/message.hpp>
#include <boost/locale/util.hpp>

#endif

The locale issue is apparent, for instance, when I try to convert non english text to lower/upper case.

eddelbuettel commented 7 years ago

That does not answer my question about the need for linking. Looking at your package I see

@LOCALE_LIBS@ -lboost_system

and that is a no-no for the BH package. No linking. Headers only.

eddelbuettel commented 7 years ago

And it is right in your own configure.ac as LOCALE_LIBS="-lboost_locale".

Sorry, can't do in BH. You can try to build on top of BH and shadow with local copies your package. Some stan related packages did that for a while, and we moved things which are in fact header-only over.

BH cannot give you all of Boost without linking. No Free Lunch. Sorry.