2

I am trying to install proj4rb on Ubuntu 14.04. Three methods are provided in the README file, but they all fail.

1. Using gem

$ gem install proj4rb
Building native extensions.  This could take a while...
ERROR:  Error installing proj4rb:
    ERROR: Failed to build gem native extension.

    /home/desousa/.rvm/gems/ruby-1.9.2-p290 extconf.rb
checking for proj_api.h... yes
checking for projects.h... yes
checking for pj_init() in -lproj... yes
creating Makefile

make "DESTDIR="
linking shared-object proj4_ruby.so
projrb.o: In function `proj_get_def':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:146: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:147: undefined reference to `pj_get_def'
projrb.o: In function `proj_is_geocent':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:135: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:136: undefined reference to `pj_is_geocent'
projrb.o: In function `proj_is_latlong':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:124: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:125: undefined reference to `pj_is_latlong'
projrb.o: In function `proj_initialize':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:79: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:86: undefined reference to `rb_ary_entry'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:87: undefined reference to `rb_string_value_ptr'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:90: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:91: undefined reference to `pj_init'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:94: undefined reference to `pj_get_errno_ref'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:35: undefined reference to `rb_funcall'
projrb.o: In function `rb_int2num_inline':
c:\mingw64\mingw64\local\src\proj4rb\ext/c:/mingw64/mingw64/local/ruby/include/ruby-2.1.0/ruby/ruby.h:1286: undefined reference to `rb_int2big'
projrb.o: In function `proj_initialize':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:96: undefined reference to `rb_raise'
projrb.o: In function `proj_free':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:41: undefined reference to `pj_free'
projrb.o: In function `proj_error_message':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:62: undefined reference to `pj_strerrno'
projrb.o: In function `rb_num2long_inline':
c:\mingw64\mingw64\local\src\proj4rb\ext/c:/mingw64/mingw64/local/ruby/include/ruby-2.1.0/ruby/ruby.h:598: undefined reference to `rb_num2long'
projrb.o: In function `proj_error_message':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:62: undefined reference to `pj_strerrno'
projrb.o: In function `proj_forward':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:161: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:163: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:163: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:164: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:164: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:165: undefined reference to `pj_fwd'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:167: undefined reference to `pj_get_errno_ref'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:35: undefined reference to `rb_funcall'
projrb.o: In function `proj_forward':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:169: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:169: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:170: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:170: undefined reference to `rb_funcall'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/c:/mingw64/mingw64/local/ruby/include/ruby-2.1.0/ruby/ruby.h:1286: undefined reference to `rb_int2big'
projrb.o: In function `proj_forward':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:173: undefined reference to `rb_raise'
projrb.o: In function `proj_inverse':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:192: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:194: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:194: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:195: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:195: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:196: undefined reference to `pj_inv'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:198: undefined reference to `pj_get_errno_ref'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:35: undefined reference to `rb_funcall'
projrb.o: In function `proj_inverse':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:200: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:200: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:201: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:201: undefined reference to `rb_funcall'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/c:/mingw64/mingw64/local/ruby/include/ruby-2.1.0/ruby/ruby.h:1286: undefined reference to `rb_int2big'
projrb.o: In function `proj_inverse':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:204: undefined reference to `rb_raise'
projrb.o: In function `proj_transform':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:229: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:230: undefined reference to `rb_check_type'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:232: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:232: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:233: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:233: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:236: undefined reference to `rb_respond_to'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:242: undefined reference to `pj_transform'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:35: undefined reference to `rb_funcall'
projrb.o: In function `proj_transform':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:237: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:237: undefined reference to `rb_num2dbl'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:244: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:244: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:245: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:245: undefined reference to `rb_funcall'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:247: undefined reference to `rb_respond_to'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:248: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:248: undefined reference to `rb_funcall'
projrb.o: In function `raise_error':
c:\mingw64\mingw64\local\src\proj4rb\ext/c:/mingw64/mingw64/local/ruby/include/ruby-2.1.0/ruby/ruby.h:1286: undefined reference to `rb_int2big'
projrb.o: In function `proj_transform':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:252: undefined reference to `rb_raise'
projrb.o: In function `Init_proj4_ruby':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:494: undefined reference to `rb_intern2'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:496: undefined reference to `rb_define_module'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:501: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:501: undefined reference to `rb_define_const'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:505: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:505: undefined reference to `rb_define_const'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:509: undefined reference to `rb_float_new'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:509: undefined reference to `rb_define_const'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:511: undefined reference to `rb_path2class'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:511: undefined reference to `rb_define_class_under'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:512: undefined reference to `rb_define_singleton_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:514: undefined reference to `rb_define_class_under'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:515: undefined reference to `rb_define_alloc_func'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:516: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:520: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:521: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:522: undefined reference to `rb_define_alias'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:523: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:524: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:525: undefined reference to `rb_define_method'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:493: undefined reference to `rb_intern2'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:492: undefined reference to `rb_intern2'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:491: undefined reference to `rb_intern2'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:490: undefined reference to `rb_intern2'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:489: undefined reference to `rb_intern2'
projrb.o:c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:488: more undefined references to `rb_intern2' follow
projrb.o: In function `proj_get_def':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:147: undefined reference to `rb_str_new_cstr'
projrb.o: In function `proj_alloc':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:50: undefined reference to `rb_data_object_alloc'
projrb.o: In function `proj_error_message':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:64: undefined reference to `rb_str_new_cstr'
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:66: undefined reference to `rb_str_new'
projrb.o: In function `Init_proj4_ruby':
c:\mingw64\mingw64\local\src\proj4rb\ext/projrb.c:526: undefined reference to `rb_define_method'
projrb.o:projrb.c:(.rdata$.refptr.rb_cObject[.refptr.rb_cObject]+0x0): undefined reference to `rb_cObject'
projrb.o:projrb.c:(.rdata$.refptr.rb_eSystemCallError[.refptr.rb_eSystemCallError]+0x0): undefined reference to `rb_eSystemCallError'
collect2: error: ld returned 1 exit status
make: *** [proj4_ruby.so] Error 1

Gem files will remain installed in /home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/proj4rb-1.0.0 for inspection.
Results logged to /home/desousa/.rvm/gems/ruby-1.9.2-p290/extensions/x86_64-linux/1.9.1/proj4rb-1.0.0/gem_make.out

There is an open issue at GitHub with this problem.

2. Using rake

$ cd ~/temp/ruby/proj4rb-1.0.0
$ ls -la
total 56
drwx------ 7 desousa desousa 4096 Feb 24 09:59 .
drwxrwxr-x 3 desousa desousa 4096 Feb 24 10:00 ..
-rw-rw-r-- 1 desousa desousa 1050 Dec 15 04:13 ChangeLog
drwx------ 2 desousa desousa 4096 Feb 24 09:59 data
drwx------ 2 desousa desousa 4096 Feb 24 09:59 example
drwx------ 3 desousa desousa 4096 Feb 24 09:59 ext
-rw-rw-r-- 1 desousa desousa   86 Dec 15 04:13 .gitignore
drwx------ 2 desousa desousa 4096 Feb 24 09:59 lib
-rw-rw-r-- 1 desousa desousa 1130 Dec 15 04:13 MIT-LICENSE
-rw-rw-r-- 1 desousa desousa 1068 Dec 15 04:13 proj4rb.gemspec
-rw-rw-r-- 1 desousa desousa 1020 Dec 15 04:13 Rakefile
-rw-rw-r-- 1 desousa desousa 6211 Dec 15 04:13 README.rdoc
drwx------ 2 desousa desousa 4096 Feb 24 09:59 test

$ rake build --trace
rake aborted!
Don't know how to build task 'build'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/bin/rake:23:in `load'
/home/desousa/.rvm/gems/ruby-1.9.2-p290/bin/rake:23:in `<main>'

3. Using make

$ cd ext
$ ruby extconf.rb
checking for proj_api.h... yes
checking for projects.h... yes
checking for pj_init() in -lproj... yes
creating Makefile
$ make
gcc -I. -I/home/desousa/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/desousa/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/desousa/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_PROJ_API_H -DHAVE_PROJECTS_H    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC  -o projrb.o -c projrb.c
In file included from /usr/local/include/projects.h:244:0,
                 from projrb.c:3:
/usr/include/proj_api.h:61:5: error: unknown type name ‘projCtx_t’
     typedef projCtx_t *projCtx;
     ^
make: *** [projrb.o] Error 1

Update I: I have tried to install proj4rb19, a version specifically targeted for Ruby 1.9. While it compiles correctly, it fails to install.

Update II: I am using RVM, with the following setup:

$ rvm -v
rvm 1.26.10 (manual) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ gem -v
2.4.3
2

Try this instead of proj:

sudo apt-get install libproj-dev proj-data proj-bin

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Can you add more to your answer to say why they should do this – nmtoken Jul 21 '17 at 16:44
1

To install proj4rb in the easier way with gem is necessary to do that:

sudo apt-get install proj 
sudo apt-get install ruby-dev ruby-all-dev gem2deb
sudo gem install proj4rb-1.0.0.gem

where the gem file was downloaded from:

https://rubygems.org/gems/proj4rb/versions/1.0.0

Below, the picture of my bash console where it is observed that proj4rb was successfully installed.

enter image description here

  • Thanks for answering. Unfortunately I get more or the same results. I should also mention that I am using RVM 1.26.10 . – Luís de Sousa Feb 27 '15 at 7:57
  • Which Ruby and Gem versions are you using? – Luís de Sousa Feb 27 '15 at 8:01
  • Did you install the dependences? (proj, ruby-dev, ruby-all-dev, gem2deb). For ruby is gem2deb, no gem (this package also exists). I'm using Ubuntu 14.10 with ruby 1:2.1.0.0~ub and gem2deb 0.7.6. – xunilk Feb 27 '15 at 8:34
  • I already have Ruby and Gem installed through RVM (i.e., outside the Ubuntu package management). If I install it from the repositories it will break things up. – Luís de Sousa Feb 27 '15 at 9:39
  • When I try apt-get update && apt-get install proj, I get "E: Package 'proj' has no installation candidate". I tried this in a fresh docker image of both Ubuntu 14.04 and 16.04. (I need 16.04 at the end of the day). Is the 'proj' package still around? Do I need a specific repository added that doesn't come with apt-get update? – Streamline May 6 '17 at 16:24
-1

If you're having problems with the above, then Breasal maybe the solution. (Breasal offers the translation from GB coordinates to lat/lng. I'm not the author).

Or at least it worked for me :)

https://github.com/theodi/breasal

  • It would be great to complete your answer with a few comments about this tool (in what is it useful?). – ArMoraer Apr 19 '16 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.