如何构建和使用epgsql(erlang) [英] How to build and use epgsql (erlang)

查看:265
本文介绍了如何构建和使用epgsql(erlang)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  src 
pgtest.erl
lib $ b我从...下载了一个epgsql库,从 https://github.com/epgsql/epgsql
然后尝试使用 make 这给了我以下错误:

  make:rebar:命令未找到
make: *** [编译]错误127

所以我从 https://github.com/basho/rebar 并构建它。它成功建成,并给我留言。


恭喜!你现在有一个自包含的脚本叫做rebar

你当前的工作目录。将此脚本放在您的路径
的任何位置,您可以使用钢筋来构建符合OTP的应用程序。


所以,根据我的理解我从 rebar 目录中将 rebar 脚本复制到我的 epgsql 目录,然后再试一次。但是,我也有同样的错误。我知道我做错了,但不知道该怎么办?

解决方案

你可以在epgsql Makefile [1]这就是将命令定义为 rebar 。如果它被定义为 ./ rebar 那么它可以将它放在同一目录中。由于不是这样,您需要将其放在您的 PATH 中的某个地方,作为钢筋的输出指令。



包含钢筋本身的Erlang项目通常会指定 ./ rebar ,而那些不会期望的项目在你的路径中的某个地方。



[1] https ://github.com/epgsql/epgsql/blob/master/Makefile#L1


My erlang program directory structure is below:

src
   pgtest.erl
lib
   epgsql
   rebar

I downloaded the epgsql library from https://github.com/epgsql/epgsql then tried to build it with make which gave me the below error:

make: rebar: Command not found
make: *** [compile] Error 127

So then I downloaded rebar from https://github.com/basho/rebar and build it. It was build successfully and gave me the message.

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.

So as per my understanding I copied the rebar script from the rebar directory to my epgsql directory and then tried to make again. However, I got the same error. I know I am doing it wrong, but not sure what to do?

解决方案

You can see in the epgsql Makefile[1] that is defining the command as just rebar. If it were defined as ./rebar then it would work to put it in the same directory. Since it's not, you'll need to put it somewhere in your PATH, as the output of rebar's make instructed.

Erlang projects that include rebar itself will generally specify ./rebar, while those that don't will expect it in to be located somewhere in your PATH.

[1] https://github.com/epgsql/epgsql/blob/master/Makefile#L1

这篇关于如何构建和使用epgsql(erlang)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆