# Building with geo-ip when GeoIP lib in non-standard location

**URL:** <https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308>\
**Category:** NGINX\
**Created:** [October 11, 2010, 12:48pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308 "2010-10-11T12:48:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 12:48pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/1 "2010-10-11T12:48:28Z")

</div>

I have the GeoIP lib installed in a non standard location. I am  
configuring nginx like

`./configure --prefix=$NGX_PATH
--with-pcre=$HOME/tarballs/pcre-8.10 --without-http_autoindex_module
--without-http_charset_module --without-http_empty_gif_module
--without-http_geo_module --without-http_ssi_module
--with-http_gzip_static_module --with-http_realip_module
--with-http_geoip_module --with-cc-opt="-I $HOME/apps/GeoIP/include"
--with-ld-opt="-L $HOME/apps/GeoIP/lib"`

Nginx will configure, make and make install okay.

But when I try to start it I get the error

`error while loading shared libraries: libGeoIP.so.1: cannot open
shared object file: No such file or directory`

How should I get nginx with the geo-ip module to work when the GeoIP lib  
is installed in a non-standard location?

Thanks

Dave

Posted at Nginx Forum:

> **[Building with geo-ip when GeoIP lib in non-standard location](https://forum.nginx.org/read.php?2,139261,139261#msg-139261)**
>
> I have the GeoIP lib installed in a non standard location. I am configuring nginx like \[code\]./configure --prefix=$NGX\_PATH --with-pcre=$HOME/tarballs/pcre-8.10 --without-http\_autoindex\_module --without-http\_charset\_module...

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/2 "2010-10-11T13:44:04Z")

</div>

On Mon, Oct 11, 2010 at 06:47:22AM -0400, djeyewater wrote:

> Nginx will configure, make and make install okay.
> 
> But when I try to start it I get the error
> 
> `error while loading shared libraries: libGeoIP.so.1: cannot open
> shared object file: No such file or directory`
> 
> How should I get nginx with the geo-ip module to work when the GeoIP lib  
> is installed in a non-standard location?

Try

–with-ld-opt=“-R $HOME/apps/GeoIP/lib -L $HOME/apps/GeoIP/lib”[/code]

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 2:44pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/3 "2010-10-11T14:44:22Z")

</div>

Igor S. Wrote:

> Try
> 
> –with-ld-opt=“-R $HOME/apps/GeoIP/lib -L  
> $HOME/apps/GeoIP/lib”

Unfortunately I get the following error when running configure with  
that:

`./configure: error: the invalid value in --with-ld-opt="-R
/home/djeyewater/apps/GeoIP/lib -L
/home/djeyewater/apps/GeoIP/lib"`

Dave

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,139261,139292#msg-139292](http://forum.nginx.org/read.php?2,139261,139292#msg-139292)

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 2:49pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/4 "2010-10-11T14:49:03Z")

</div>

On Mon, Oct 11, 2010 at 08:43:04AM -0400, djeyewater wrote:

> /home/djeyewater/apps/GeoIP/lib -L  
> /home/djeyewater/apps/GeoIP/lib"[/code]

What is in objs/autoconf.err near this test ?

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 5:38pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/5 "2010-10-11T17:38:16Z")

</div>

## Igor S. Wrote:

> What is in objs/autoconf.err near this test ?

Hi Igor

objs/autoconf.err has

[code]checking for --with-ld-opt=“-R /home/djeyewater/apps/GeoIP/lib -L  
/home/djeyewater/apps/GeoIP/lib”

gcc: unrecognized option ‘-R’  
/home/djeyewater/apps/GeoIP/lib: file not recognized: Is a directory  
collect2: ld returned 1 exit status[/code]

The gcc and ld versions installed are:  
gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)  
GNU ld version 2.17.50.0.6-14.el5 20061020

Dave

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,139261,139368#msg-139368](http://forum.nginx.org/read.php?2,139261,139368#msg-139368)

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 9:26pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/6 "2010-10-11T21:26:11Z")

</div>

On Mon, Oct 11, 2010 at 11:36:48AM -0400, djeyewater wrote:

> gcc: unrecognized option ‘-R’  
> /home/djeyewater/apps/GeoIP/lib: file not recognized: Is a directory  
> collect2: ld returned 1 exit status[/code]
> 
> The gcc and ld versions installed are:  
> gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)  
> GNU ld version 2.17.50.0.6-14.el5 20061020

Then try:

–with-ld-opt=“-rpath $HOME/apps/GeoIP/lib -L $HOME/apps/GeoIP/lib”

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 9:26pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/7 "2010-10-11T21:26:14Z")

</div>

## Igor S. Wrote:

> Then try:
> 
> –with-ld-opt=“-rpath $HOME/apps/GeoIP/lib -L  
> $HOME/apps/GeoIP/lib”

Unfortunately that’s the same (from autoconf.err):

[code]checking for --with-ld-opt=“-rpath /home/djeyewater/apps/GeoIP/lib  
-L /home/djeyewater/apps/GeoIP/lib”

gcc: unrecognized option ‘-rpath’  
/home/djeyewater/apps/GeoIP/lib: file not recognized: Is a directory  
collect2: ld returned 1 exit status[/code]

Dave

Posted at Nginx Forum: [http://forum.nginx.org/read.php?2,139261,139436#msg-139436](http://forum.nginx.org/read.php?2,139261,139436#msg-139436)

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 11, 2010, 9:26pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/8 "2010-10-11T21:26:14Z")

</div>

On Mon, Oct 11, 2010 at 02:43:44PM -0400, djeyewater wrote:

> [code]checking for --with-ld-opt=“-rpath /home/djeyewater/apps/GeoIP/lib  
> -L /home/djeyewater/apps/GeoIP/lib”
> 
> gcc: unrecognized option ‘-rpath’  
> /home/djeyewater/apps/GeoIP/lib: file not recognized: Is a directory  
> collect2: ld returned 1 exit status[/code]

Oh, sorry, I have just noticed that this is an gcc’s error, but not  
linker’s one. Try

–with-ld-opt=“-Wl,-R,$HOME/apps/GeoIP/lib -L $HOME/apps/GeoIP/lib”

or

–with-ld-opt=“-Wl,-rpath,$HOME/apps/GeoIP/lib -L $HOME/apps/GeoIP/lib”

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![djeyewater](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@djeyewater](https://www.ruby-forum.com/u/djeyewater)\
**Post date:** [October 12, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/building-with-geo-ip-when-geoip-lib-in-non-standard-location/196308/9 "2010-10-12T16:27:47Z")

</div>

`--with-ld-opt="-Wl,-R,$HOME/apps/GeoIP/lib -L
$HOME/apps/GeoIP/lib"` worked

Thanks for the help!

Dave

Posted at Nginx Forum:

> **[Re: Building with geo-ip when GeoIP lib in non-standard location](https://forum.nginx.org/read.php?2,139261,139730#msg-139730)**
>
> I have the GeoIP lib installed in a non standard location. I am configuring nginx like \[code\]./configure --prefix=$NGX\_PATH --with-pcre=$HOME/tarballs/pcre-8.10 --without-http\_autoindex\_module --without-http\_charset\_module...
