1

I have closely followed the rebar documentation regarding the dependencies management and release handling and tried to create a release similar to the one described in the accepted answer to one of my previous questions.

However, I can not make yaws to be included as an OTP application inside an OTP Release generated by rebar.

Here is what I do:

  • create a release as per official rebar documenation (done, a simple gen_server can be run with /rel/myapp/bin/myapp start)
  • specify the yaws dependency in the rebar.config file in the project directory
  • run rebar get-deps (this pulls yaws and ibrowse)
  • add this to reltool.config: {app, yaws, [{incl_cond, include}]}
  • add yaws to the list of applications in myapp.app.src
  • rebar compile generate:

... ==> Leaving directory '/myapp/deps/yaws/rel' ==> yaws (compile) yaws.erl:13: can't find include file "yaws_appdeps.hrl" yaws.erl:220: undefined macro 'YAWS_APPDEPS' yaws.erl:174: function start_app_deps/0 undefined yaws.erl:194: function start_app_deps/0 undefined ERROR: Command [compile] failed!

Notes:

  • The official yaws documentation does not seem to be very explanatory regarding this matter.

  • If I change yaws to cowboy, I do not get such an error.

Update

Here is my directory structure:

. ├── apps │   └── myapp ├── deps │   ├── ibrowse │   └── yaws └── rel └── files

Community
  • 1
  • 1
skanatek
  • 5,133
  • 3
  • 47
  • 75
  • 1
    What version of rebar are you using? This would seem to be a problem caused by rebar not running the `src/yaws.app.src.script` file. There was a bug in this area of rebar fixed recently in commit [7d55c99](https://github.com/rebar/rebar/commit/7d55c9986f6d0c76575083dae440f06a94c1afc1), for example. – Steve Vinoski Dec 16 '14 at 20:20
  • 1
    Unfortunately I was unable to make it work with a new-ish rebar unless I checkout out rebar commit b796065, built that, and used that rebar to build yaws and the app, and to then generate the release. That commit is the one just prior to the one I mentioned in my previous comment. – Steve Vinoski Dec 16 '14 at 21:30
  • 1
    Steve, thanks a lot for your comment. I fetched b796065, re-compiled rebar and used it to compile/generate. Unfortunately I get exactly the same error. – skanatek Dec 17 '14 at 17:06
  • 1
    What version of yaws are you fetching? Make sure it's 1.98 or newer. You also might try removing `deps/yaws` completely and letting your new rebar re-fetch and rebuild it. – Steve Vinoski Dec 17 '14 at 17:10
  • 1
    I have removed `deps/yaws` and re-fetched yaws 1.99. Unfortunately I get exactly the same error. – skanatek Dec 17 '14 at 20:58
  • Are you using a project structure with `apps` and `rel` as sibling directories, `myapp` as a subdir of `apps`, and yaws specified as a dep in `apps/myapp/rebar.config`? Just yesterday I successfully built a working release with that directory structure using the specified rebar, yaws 1.99, and the yaws rebar templates mentioned in the yaws rebar documentation. – Steve Vinoski Dec 17 '14 at 21:16
  • Yes, I think that my directory structure is correct (I have added it to the question). Actually it is a surprise for me that myapp should have its own `rebar.config`. I have a `rebar.config` in the parent directory and I thought that there should be only one. I have added `apps/myapp/rebar.config` though, but I still get the same error. Could you point me to some documentation that says that there should be a separate rebar.config for each app/dependency? Thanks. And btw, is the use of yaws rebar templates mandatory here? – skanatek Dec 18 '14 at 15:37
  • Use of yaws rebar templates is not mandatory; they exist just to try to help make this task easier. Regarding your rebar docs question, no, I can't point to any such documentation (I've never had good luck with rebar and docs, in general). I'm just saying that my project was structured that way and it worked. If you're really using the same rebar version I am, I don't understand why this fails for you but works for me. – Steve Vinoski Dec 18 '14 at 16:55
  • It looks like the yaws rebar templates contain some lines that are not mentioned in any rebar/yaws guides or documentation. I have double-checked my rebar version and my yaws version and I still get the same error. Could I ask you to post your directory structure and maybe the contents of your rebar.config and reltool.conf files? I hope we could find an answer to this question together. – skanatek Dec 19 '14 at 19:46
  • I created the `apps/myapp` and `rel` directories. I ran `rebar create-app appid=myapp` in `apps/myapp`, and then back at the top level ran `rebar create template=yawsnode nodeid=foo appid=myapp`. I added `apps/myapp/rebar.config` containing `{deps, [{yaws, ".*", {git, "git://github.com/klacke/yaws", {tag, "yaws-1.99"}}}]}.` Then I ran `rebar get-deps compile`, changed to the `rel` dir, and ran `rebar generate`. At that point I followed the [Yaws rebar release doc](http://yaws.hyber.org/rebar_release.yaws) for creating and deploying a tarball, and the deployed code worked like a champ. – Steve Vinoski Dec 19 '14 at 21:33

1 Answers1

0

Open the the src directory of yaws. The missing 'yaws_appdeps.hrl' include file may likely have a '.ini' or 'in' extension. Remove that and compile again