code:lib_dir/1 fails with ERL_LIBS set

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

code:lib_dir/1 fails with ERL_LIBS set

Vance Shipley-2
There appears to be a bug where code:lib_dir/1 fails with applications
appearing in an extra lib directory declared with ERL_LIBS.  The following
shows the problem:

$ ERL_LIBS=/Users/vances/foo erl
Erlang R16B03 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> application:load(bar).
ok
2> code:which(bar).
"/Users/vances/foo/ebin/bar.beam"
3> code:where_is_file("bar.app").
"/Users/vances/foo/ebin/bar.app"
4> code:lib_dir(bar).
{error,bad_name}


--
        -Vance

Reply | Threaded
Open this post in threaded view
|

code:lib_dir/1 fails with ERL_LIBS set

Loïc Hoguin-2
Two issues with your test.

ERL_LIBS is for specifying lib directories, that is, a directory that
contains directories of applications. What you specify is a directory of
an application directly. In your example the correct directory would be
ERL_LIBS=/Users/vances.

"/Users/vances/foo/ebin/bar.beam" should be
"/Users/vances/bar/ebin/bar.beam", the bar application is expected to
reside in a folder of the same name.

On 01/29/2014 03:27 PM, Vance Shipley wrote:

> There appears to be a bug where code:lib_dir/1 fails with applications
> appearing in an extra lib directory declared with ERL_LIBS.  The following
> shows the problem:
>
> $ ERL_LIBS=/Users/vances/foo erl
> Erlang R16B03 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
>
> Eshell V5.10.4  (abort with ^G)
> 1> application:load(bar).
> ok
> 2> code:which(bar).
> "/Users/vances/foo/ebin/bar.beam"
> 3> code:where_is_file("bar.app").
> "/Users/vances/foo/ebin/bar.app"
> 4> code:lib_dir(bar).
> {error,bad_name}
>
>

--
Lo?c Hoguin
http://ninenines.eu

Reply | Threaded
Open this post in threaded view
|

code:lib_dir/1 fails with ERL_LIBS set

Vance Shipley-2
On Wed, Jan 29, 2014 at 03:32:23PM +0100, Lo?c Hoguin wrote:
}  "/Users/vances/foo/ebin/bar.beam" should be
}  "/Users/vances/bar/ebin/bar.beam", the bar application is expected
}  to reside in a folder of the same name.

Yeah, that's it.  I was struggling to get autoconf's AC_ERLANG_CHECK_LIB
macro to work in a subproject folder where the to level directory can't
be known.

--
        -Vance