brianmario / charlock_holmes

Character encoding detection, brought to you by ICU
MIT License
1.04k stars 141 forks source link

Failed to install on freebsd9 #9

Open g3d opened 12 years ago

g3d commented 12 years ago

Tried to install gem with defined icu path on freebsd 9

[root@freebsd ~]# gem install charlock_holmes -- --with-icu-dir=/usr/local/share/icu/4.8.1.1/
Building native extensions.  This could take a while...
ERROR:  Error installing charlock_holmes:
    ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-icu-dir=/usr/local/share/icu/4.8.1.1/
checking for main() in -licui18n... no
checking for main() in -licui18n... no

***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby
    --with-icu-dir
    --with-icu-include
    --without-icu-include=${icu-dir}/include
    --with-icu-lib
    --without-icu-lib=${icu-dir}/lib
    --with-icui18nlib
    --without-icui18nlib
    --with-icui18nlib
    --without-icui18nlib

Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.2-p290/gems/charlock_holmes-0.6.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.2-p290/gems/charlock_holmes-0.6.8/ext/charlock_holmes/gem_make.out

System information:

[root@freebsd ~]# uname -a
FreeBSD freebsd 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

[root@freebsd ~]# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-freebsd9.0]
brianmario commented 12 years ago

What are the contents of that /usr/local/share/icu/4.8.1.1/ directory?

Are you sure that's the location where the headers and libraries are?

g3d commented 12 years ago

It`s the target directory for the icu port.

[root@freebsd /usr/local/share/icu/4.8.1.1]# ls -Rla
total 20
drwxr-xr-x  3 root  wheel   512 Feb 23 03:08 .
drwxr-xr-x  3 root  wheel   512 Feb 23 03:08 ..
drwxr-xr-x  2 root  wheel   512 Feb 23 03:08 config
-r--r--r--  1 root  wheel  1981 Feb 23 03:08 license.html
-r-xr-xr-x  1 root  wheel   935 Feb 23 03:08 mkinstalldirs

./config:
total 12
drwxr-xr-x  2 root  wheel   512 Feb 23 03:08 .
drwxr-xr-x  3 root  wheel   512 Feb 23 03:08 ..
-r--r--r--  1 root  wheel  1824 Feb 23 03:08 mh-bsd-gcc
brianmario commented 12 years ago

Where are the libraries and headers?

g3d commented 12 years ago

how can i install it in freebsd?

brianmario commented 12 years ago

Assuming you installed icu from a freebsd package, the library could be in /usr/lib or even /usr/local/lib - have you tried installing the gem without specifying the --with-icu-dir option?

g3d commented 12 years ago

yes, of course. i find that option in error report from installing the gem without specifying the --with-icu-dir option

jirihelmich commented 12 years ago

Hi, I was experiencig the same problem. After many hours, I finally found a solution for FreeBSD:

gem install charlock_holmes -- --with-icu-dir=/usr/lib --with-opt-include=/usr/local/include/

sun-yr commented 12 years ago

you have this lib "libicu-dev" ??

sun-yr commented 12 years ago

https://github.com/brianmario/charlock_holmes/issues/3 look at this

herrBeesch commented 12 years ago

Got it working on freeBSD with this patch https://github.com/brianmario/charlock_holmes/pull/20/files

and installing icu (I installed it from source, not from ports, may work also) and setting these options

gem install charlock_holmes -- --with-opt-include=/usr/local/include/ --with-opt-lib=/usr/local/lib/

or

bundle config build.charlock_holmes --with-opt-include=/usr/local/include/ --with-opt-lib=/usr/local/lib/
krzysztofantczak commented 11 years ago

it works as expected under fbsd after installing devel/icu from ports

hmschreiner commented 9 years ago

Thanks a lot, @jirihelmich! You saved my day! haha! I was about 3-4 hours looking for a solution for this issue! :+1:

jirihelmich commented 9 years ago

@hmschreiner Glad to help!

celadevra commented 9 years ago

@herrBeesch Your solution works for me with FreeBSD 10.1. Thanks!

aaronjwood commented 8 years ago

I had to do a bit extra to get this working with GitLab's upgrade process:

sudo -u git -H bundle config build.charlock_holmes --with-icu-dir=/usr/lib --with-opt-include=/usr/local/include/
sudo -u git -H bundle install -j4

If you don't set the config the flags needed will never be used with bundle install.