How to build and use epgsql (erlang)

强颜欢笑 提交于 2019-12-13 02:56:47

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/33485205/how-to-build-and-use-epgsql-erlang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!