如何构建和使用 epgsql (erlang)
How to build and use epgsql (erlang)
我的erlang程序目录结构如下:
src
pgtest.erl
lib
epgsql
rebar
我从 https://github.com/epgsql/epgsql 下载了 epgsql 库
然后尝试使用 make
构建它,这给了我以下错误:
make: rebar: Command not found
make: *** [compile] Error 127
然后我从 https://github.com/basho/rebar 下载了 rebar 并构建了它。它构建成功并给了我消息。
Congratulations! You now have a self-contained script called "rebar"
in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
因此,根据我的理解,我将 rebar
脚本从 rebar
目录复制到我的 epgsql
目录,然后再次尝试制作。但是,我得到了同样的错误。我知道我做错了,但不知道该怎么办?
您可以在 epgsql Makefile[1] 中看到将命令定义为 rebar
。如果它被定义为 ./rebar
那么将它放在同一个目录中就可以了。因为它不是,所以您需要将它放在 PATH
中的某个位置,作为 rebar 的 make 指示的输出。
包含 rebar 本身的 Erlang 项目通常会指定 ./rebar
,而那些不包含 rebar 的项目会期望它位于您的 PATH 中的某个位置。
[1] https://github.com/epgsql/epgsql/blob/master/Makefile#L1
我的erlang程序目录结构如下:
src
pgtest.erl
lib
epgsql
rebar
我从 https://github.com/epgsql/epgsql 下载了 epgsql 库
然后尝试使用 make
构建它,这给了我以下错误:
make: rebar: Command not found
make: *** [compile] Error 127
然后我从 https://github.com/basho/rebar 下载了 rebar 并构建了它。它构建成功并给了我消息。
Congratulations! You now have a self-contained script called "rebar" in your current working directory. Place this script anywhere in your path and you can use rebar to build OTP-compliant apps.
因此,根据我的理解,我将 rebar
脚本从 rebar
目录复制到我的 epgsql
目录,然后再次尝试制作。但是,我得到了同样的错误。我知道我做错了,但不知道该怎么办?
您可以在 epgsql Makefile[1] 中看到将命令定义为 rebar
。如果它被定义为 ./rebar
那么将它放在同一个目录中就可以了。因为它不是,所以您需要将它放在 PATH
中的某个位置,作为 rebar 的 make 指示的输出。
包含 rebar 本身的 Erlang 项目通常会指定 ./rebar
,而那些不包含 rebar 的项目会期望它位于您的 PATH 中的某个位置。
[1] https://github.com/epgsql/epgsql/blob/master/Makefile#L1