Instructions to install dependencies
I followed the instructions in the README to download rust with apt-get and clone oxidize. I run make and I get
make: *** No rule to make target rust-mustache/Makefile', needed by lib/mustache'. Stop.
I found the comment in the README "it is currently not compiling as of right now" and the one about the ugly hack in the Makefile. I'm probably rusty with Makefiles (did lots of them in the 80's/90's) but the only rust-mustache/Makefile I can find in this repository is in the examples tree and make doesn't seem to be able to cd into there.
So I cloned the rust-mustache repository in the oxidize directory. If this is the right thing to do you should add it to the README and this is the main point of this issue.
$ git clone https://github.com/erickt/rust-mustache.git
Cloning into 'rust-mustache'...
remote: Reusing existing pack: 521, done.
remote: Total 521 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (521/521), 215.02 KiB | 338 KiB/s, done.
Resolving deltas: 100% (290/290), done.
Now I get another error
$ make
/usr/bin/make -C rust-mustache/
make[1]: Entering directory `/XXXXX/oxidize/rust-mustache'
test -d build || mkdir build
rustc -O --out-dir=build src/mustache/lib.rs
src/mustache/parser.rs:122:25: 122:51 error: type `~str` does not implement any method in scope named `push_char`
src/mustache/parser.rs:122 self.content.push_char(ch);
^~~~~~~~~~~~~~~~~~~~~~~~~~
This is a mustache error so I should open an issue for that there, but I have a similar one with oxidize if I do this
$ make lib/libhttp.rlib
/usr/bin/make -C rust-http/
make[1]: Entering directory `/XXXXXX/oxidize/rust-http'
build/codegen read_method.rs src/http/generated/
mkdir -p build/
rustc -O src/http/lib.rs --out-dir=build
src/http/client/response.rs:80:21: 80:48 error: type `~str` does not implement any method in scope named `push_char`
src/http/client/response.rs:80 reason.push_char(b as char);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Am I using a version of rustc which is not compatible with oxydize?
$ rustc -v
rustc 0.11-pre
Hey, thanks for opening an issue about this! First things first, oxidize is right now getting cleaned up by me. What started off as a solo project, became a group project for a class, so it went through this weird phase where we needed to get code on it that wasn't necessarily the direction I wanted the library to go (gotta get a good grade even if it doesn't make for the best project :wink: ) So because of this, the code is not in very good shape right now, but I'm working hard on cleaning it up. If you looked at the benchmarking examples already, you will see what I mean when I say the code is in bad shape. Currently there is no way to introduce an ApplicationContext so in order for someone to add in other things they need to mess with ugly statics and unsafe code which is not desirable. (See https://github.com/jroweboy/oxidize/blob/benchmarks/example/benchmarks/techempower.rs#L91 for an example) That's the main reason I haven't pulled that branch is because I don't want the framework user's code to look like this at all! We just needed to get some code written for a grade and we accomplished that (and got a good grade as well! :smile:)
So now that that has been explained, I can answer some of your other questions.
Am I using a version of rustc which is not compatible with oxydize?
Yes, this version of the code probably only works on rust 0.10 (and it was right around that time that finals started up so I haven't updated to the latest rust master) I say probably, because you would also need the version of rust-http that compiles for rust 0.10 and even then, right before the 0.10 release there were some changes that might have broken the code without me knowing.
I run make and I get errors
Ah yes, my old makefile :s If you still want to compile the code, I recommend using the CMakefile. I'm actually surprised that no one in my group updated the Readme with the new build instructions! I suppose its not very important to do right now since I'm about to revitalize the whole codebase and add better build support. Instructions on building with cmake are pretty simple. First make sure that you have installed cmake ( http://www.cmake.org/ ), and then run from the base directory
mkdir -p build
cd build
cmake ../
make
In actuality, rust-mustache (and rust-pcre and rust-postgres) are no longer dependencies for oxidize, since they are only needed for userland code to begin with, so on my latest branch, they are moved from the main folder into the examples subfolder.
My recommendation is to wait just a little bit longer though. With my latest changes, I plan on allowing the user to make a struct that will present in the view functions so that they can pass in things such as a rendering context, a database adaptor, and whatever other business things they want. I've tried twice before to make this happen (I rewrote everything as a stripped down, bare minimum version first time: https://github.com/jroweboy/oxidize/blob/incoming/tmp/shared_ptr.rs and also here for the second time: https://github.com/jroweboy/oxidize/blob/incoming/tmp/matchblockheroes.rs) but due to technical reasons, neither of those worked, so I gave myself a few weeks to mull things over and this time I really think I'm going to be able to get it working. If you want me to, I can comment again on this issue which would give you a github notification and let you know when I get the new code version pushed so that you can try it out. I'm really excited to see someone interested in trying out my code! :smile:
Thank you for your detailed answer. I think I'll wait a little for all of this to settle down but going the cmake way does work. I had to remove rust-nightly and install the 0.10 compiler to get rid of those errors. Maybe you should change the instructions in the README to apt-get install rust-0.10.
Sorry that its taken so long to get back with you on this issue! I rewrote the base twice in this time period, but I think oxidize is much more stable now because of this. Now it should be quite easy to introduce context variables to be a part of your Web Application (things such as a persistent Database connection and middleware even!) and I hope that its starting to shape up to even be more than a pet project now!
In addition, I'm in the process of abstracting away my dependance on rust-http, so that when teepee is released, I can easily swap over to that along with enabling others to make their own OxidizeBackend to allow Oxidize to run on any server that people feel like supporting. (I for one want to try out Mongrel 2 as a backend)
Another OTHER thing I did was make a small and featureless c and rust wrapper for jinja 2 so that there will be some level of templating support. As I start to write my first web site in oxidize, I want to use jinja 2 for templating so I'll probably add more things to that in the mean time.
All in all, I hope this time the install instructions are clear and if they fail just let me know and I'll fix the issues right up! Just remember that I use the latest rust version and not 0.10