install fails on ubuntu
amih opened this issue · comments
Edit by octalmage:
If RobotJS fails to build, install these packages:
sudo apt-get install libxtst-dev libpng++-dev
Original comment:
There's an error, some header .h file missing?
solution is to install X developer tools with:
sudo apt-get install xorg-dev
Perhaps add this to the README file.
never mind, doesn't work on Ubuntu :(
So far I've only tested RobotJS on Mac, although technically the code is cross platform. The build script probably needs to be modified.
You we're able to get it installed? What part doesn't work? Do you get any errors?
Thanks!
After installing the xorg-dev I successfully installed the robotjs but following the demo resulted in error messages:
> var robot = require("robotjs");
undefined
> var mouse=robot.getMousePos();
node: symbol lookup error: /home/amih3/tmp/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: XGetMainDisplay
I hope this helps, thank you!
Could you try installing ibxtst-dev?
sudo apt-get install ibxtst-dev
I believe this should resolve the issue.
Ah, you mean libxtst-dev
(I assume). Still doesn't work but I'm having a look at the build script and seeing if I can work it out :)
@amih, @DamonOehlman was able to get RobotJS building for Linux and I merged his pull request. Could you try the latest code to see if it works?
@DamonOehlman were there any additional packages needed?
Nope, xorg-dev
was all that was required and I suspect we can get it down to a tighter list also, but I haven't investigated that as yet...
Awesome!
So libxtst-dev
wasn't needed after all?
I think it was, but was brought in as a dependency of xorg-dev
. Let me uninstall xorg-dev
and I'll try and identify the specific packages that are required.
OK, I looks like libxtst-dev
is the best package to require as a dependency as bringing it in also brings in libx11-dev
which is also required. I did however also specify png
and z
as required link settings as these were expressed as dependencies in autopy.
Great, thanks again for your help. I'll get the readme updated and a new version out tonight. z and png may not be needed now, but they will be necessary dependencies as soon as I finish the screen and bitmap modules.
I'll confirm in a VM and close this out also.
Now I can start with continual integration and unit testing. I'm excited.
Nice. Note some changes for travis around the new docker containers around installing APT packages but yeah this should be pretty easy to test there :)
I tried building it on my machine under Ubuntu 14.10 and I ran into a dependency issue with a few items:
One was installing npm install nan
for node-gyp.
The other dependency I ran across was a libgd-dev error on node-gyp build
which prompted:/usr/bin/ld: cannot find -lpng
.
sudo apt-get install libgd-dev
resolved the /usr/bin/ld: cannot find -lpng
message.
In testing with @JohnDittmar we found that some functions don't work on Ubuntu, like keyTap and getPixelColor. These need to be working before I update the readme and close this.
Sure thing - if I get some more time I'll investigate and see if I can work out what's required.
Same here! I believe one issue is the snprintf function in getPixelColor.
Is there any solution for node: symbol lookup error: /home/amih3/tmp/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: XGetMainDisplay
?
System info:
node v0.12.0
Ubuntu 12.04.1
Also problem exist for other functions
getMousePos => XGetMainDisplay
typeString => XStringToKeysym
getPixelColor => XOpenDisplay
The Linux build still needs a lot of work, unfortunately I don't know a solution currently. probably missing includes or compiler flags.
Actually, did you try the code in this repository? Or just install using NPM?
Yesterday I use npm i robotjs
.
Now npm i git+https://git@github.com/octalmage/robotjs.git
fixed problem. getMousePos
and typeString
work correctly.
but new buffer overflow problem occurred with getPixelColor explained in #19
Great! I have an idea about getPixelColor, unfortunately it's not convenient for me to work on Linux.
For anyone who may have the same issue on debian, X11/extensions/XTest.h
is provided by libxtst-dev
.
Could someone let me know if this code works with RobotJS from the master branch?
var robot = require("robotjs");
//Press space.
robot.keyTap("space");
I just added space to keyTap, but I'm unsure if I got the Linux keycode right. See: 523cf3b.
Nevermind! I used my VM to test, and I was wrong. I fixed it in e935825 though.
Finally found the correct keycode in this code:
https://gitlab.com/higan/higan/blob/3ce1d19f7a6890b410f1687ea88759b3aff6a367/ruby/input/keyboard/xlib.cpp#L283
Ok I fixed the issue with gePixelColor
#19, but the returned colors seem off.
Could someone double check this?
Thanks!
Edit: I just ran some tests using Ubuntu and every other function works fine. getPixelColor
is the last issue, if there is an issue.
I test it on ubuntu. it works.
$ node index.js # readme example output.
#c80003 at x:1007 y:474
my os:
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
@smmoosavi Awesome! Does the hex match the screen?
yes, mouse is on red color when I run js file.
Great! Then it looks like we have full Linux support. I'll close this in a few days, just want to confirm everything is working as expected.
I've done some additional testing and I'm going to consider this closed!
should add a comment in README to help user setup build environment on ubuntu,
sudo apt-get install libxtst-dev libpng++-dev
Yeah for sure, Windows and Mac need instructions also. I'll work on this today.
Hi octalmage,
First of all, GREAT PROJECT! I tested it on a windows machine and it works like a charm, but now I am trying to install it on an Ubuntu (zorin) laptop and I got a few error and I got stuck on one.
The last one is:
Error: /home/a/test/robotjs/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: YTestFakeButtonEvent
at Error (native)
at Object.Module._extensions..node (module.js:435:18)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/a/test/robotjs/node_modules/robotjs/index.js:1:77)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
Any idea what can it be?
Sorry if its a stupid one, I am not using linux too much...
Thanks a lot for your efforts!
I am trying to support this project as much as I can.