Hi Ernie,
Firstly bear in mind that it's still a bit of a work in progress :-)
though it's getting pretty close to something I'd want to put onto the
main branch, mostly just tidying stuff up now and adding a few more
tests and examples.
That said it was working fine for me when I made the last commit a
couple of weeks ago (r1583389 I think)
I've just done a make from scratch
cd fadams-javascript-binding
mkdir bld
cd bld
cmake ..
make
in my fadams-javascript-binding directory I have a node_modules and in
that a qpid-proton directory.
However in my qpid-proton directory I have
a *directory* named lib and three files named LICENCE, package.json and
README.md
in the lib directory I have a file named proton.js
which is I think exactly what I'd expect to see.
I have no idea why you are seeing a *file* named lib in qpid-proton :-(
I'm using Linux, I don't suppose that you are using some other OS by any
chance? At a guess it's something different between how CMake works
between Linux and Windows, but that's just a guess and if you are using
Linux then it's really weird.
What the make ends up doing is copying the qpid-proton directory and
contents from fadams-javascript-binding/proton-c/bindings/javascript to
the node_modules under fadams-javascript-binding then copying the
proton.js built by the maike into the relevant subdirectory. The
relevant bit from the CMakeLists.txt under
fadams-javascript-binding/proton-c/bindings/javascript is:
# This command packages up the compiled proton.js into a node.js package
called
# qpid-proton and copies it to the <proton>/node_modules directory. This
allows
# the node.js test and example programs to do proton =
require("qpid-proton");
add_custom_command(
TARGET proton.js
COMMAND ${CMAKE_COMMAND}
-E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/qpid-proton
${PROJECT_SOURCE_DIR}/node_modules/qpid-proton
COMMAND ${CMAKE_COMMAND}
-E copy
${CMAKE_CURRENT_BINARY_DIR}/proton.js
${PROJECT_SOURCE_DIR}/node_modules/qpid-proton/lib
COMMENT "Building qpid-proton package for node.js"
)
I'm no sort of CMake expert I'm afraid I mostly wing it with help from
Mr Google, but as I say above that *should* copy the directory
qpid-proton and its contents from
fadams-javascript-binding/proton-c/bindings/javascript to
fadams-javascript-binding then copy proton.js to
fadams-javascript-binding/node_modules/qpid-proton/lib
Out of curiosity what do you see in
fadams-javascript-binding/proton-c/bindings/javascript/qpid-proton (i.e.
the directory that is being copied to nod_modules) is the lib you are
seeing there a file or a directory?
I'm seeing a directory there too and when I look in subversion at
http://svn.apache.org/repos/asf/qpid/proton/branches/fadams-javascript-binding/proton-c/bindings/javascript/qpid-proton/
I'm seeing a directory called lib too, if you are seeing a file there
then I wonder if it's something weird with the git->svn bridge, but I'm
clutching at straws.
Hmmm re-reading your mail you say "When I renamed the lib file to
proton.js, created a lib directory and moved the file under it, all was
well. " that's suggesting that proton.js got copied to a file called lib
rather than into the directory called lib, so that second CMake COMMAND:
"
COMMAND ${CMAKE_COMMAND}
-E copy
${CMAKE_CURRENT_BINARY_DIR}/proton.js
${PROJECT_SOURCE_DIR}/node_modules/qpid-proton/lib
"
certainly copies proton.js into node_modules/qpid-proton/lib for me on
my Linux box, but that is the most likely place for things behaving
differently between us...
BTW:
1. You shouldn't need to do a make install, just doing make should copy
this stuff I wanted to make sure a top level node_modules was in place
so that the tests and demos work without too much fuss (clearly I was
delusional :-D)
2. The spout.js and drain.js are currently *very* hacky (they just print
"spout not implemented yet" and exit ;->) the send.js and recv.js and
client.js and server.js should work pretty much as per the normal proton
examples of the same name and qpid-config.js is pretty much complete
(just the *generic* list mechanism to list AMQP 1.0 QMF objects still to
do).
3. One thing to bear in mind is that this stuff uses a *websocket*
transport, hopefully that's fairly obvious as it's JavaScript, but
perhaps not. I've tried it against the Java Broker's websocket transport
(though not for a couple of months and I've not tried qpid-config.js
with the QMF plugin yet either). If you want to talk to the C++ broker
I've included a simple node.js based WebSocket->TCP proxy (proxy.js). On
my TODO list is to put some more work into the emscripten network
library so that it's possible to configurably choose websockets or TCP
sockets (using the standard node net library)
Hopefully this gives you a few pointers, do let me know how you get on,
though I'm not getting a lot of computer time at the moment as I'm
digging loads of holes for fence posts :-(
Frase
On 22/08/14 19:34, Ernest Allen wrote:
I may have discovered a problem with the javascript bindings for proton that I
got from: git+ssh://git.app.eng.bos.redhat.com/srv/git/rh-qpid-proton.git
branch origin/fadams-javascript-binding
After the build, I got an error when running the examples. Specifically, this
is what I got:
node spout.js
module.js:340
throw err;
^
Error: Cannot find module 'qpid-proton'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous>
(/home/ernie/jsbindings/rh-qpid-proton/examples/messenger/javascript/spout.js:24:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
After verifying my environment, I finally tracked it down to the
node_modules/qpid-proton directory. The build creates a file named lib in that
directory. It should create a directory named lib that contains a file named
proton.js in it.
When I renamed the lib file to proton.js, created a lib directory and moved the
file under it, all was well.
I did not do a make install, so I was just running the examples from my git
checkout directory.
I'm not familiar enough with the cmake files to track this down any further, so
I'm hoping someone here can provide the fix.
-Ernie Allen