Compiling node.js on Cygwin - build

I'm trying to build node.js on my Windows XP box (Yes, it IS painful, thanks.) using Cygwin following Ryans instructions here.
Sadly calling "./configure" from the node source directory barfs up this:
$ ./configure
/home/LWE/sources/node.js/wscript: error: Traceback (most recent call last):
File "/home/LWE/sources/node.js/tools/wafadmin/Utils.py", line 274, in load_module
exec(compile(code, file_path, 'exec'), module.__dict__)
File "/home/LWE/sources/node.js/wscript", line 12, in <module>
import js2c
File "/home/LWE/sources/node.js/tools/js2c.py", line 35, in <module>
import jsmin
File "/home/LWE/sources/node.js/tools/jsmin.py", line 1
../deps/v8/tools/jsmin.py
^
SyntaxError: invalid syntax
I'm absolutely not into Python so I'm having a hard time figuring this out. Am I missing some dependency or what?
I'd expect that there is some simple little configuration switch that I have to turn, to make this work. I just don't know where/what/why/...
I compiled node.js on my Mac before from the very same sources and that worked like a charm. And I also can't imagine that the build script from the node repository itself is broken.
PS: It's a totally fresh and up to date Cygwin installation with Python 2.6.5.

I also had a problem getting nodejs to compile using cygwin - also a Python issue. I eventually found a reference to having to rebase the cygwin DLL links to make everything work. Of course I couldn't find my original source for help. But I remembered enough to find similar help.
So from http://avalanche123.tumblr.com/post/855374337/nodejs-mongodb-tinyurl
I remembered that you can stop all cygwin processes, run ash (a minimal shell) that is typically found at C:\cygwin\bin\ash.exe and then, in this shell, run "/usr/bin/rebaseall"
Once I had run the rebaseall command I could, using the normal cygwin shell, successfully run the ./configure script for the nodejs source and proceed to "make" and "make install" nodejs.

This is old, but for anyone referencing this page: jsmin.py is a symbolic link. If you are using Git from msysGit in Cygwin, symbolic links will not be created properly. The Git client that comes with Cygwin deals with these pretty decently most of the time, however every now and then it barfs. If you bring up jsmin.py in an editor, you will see it actually contains the path to the file it is supposed to be linking to. To fix this and move on to compiling:
# from the node.js source directory, run:
% cd tools
% ln -fs `cat jsmin.py`
This will recreate the symlink pointing to the proper location. From here, re-run ./configure and you are all set.
A full set of build instructions is available at Github.

I had no problems using Ryan's current instructions -- until I tried install ing NPM as well, and then I got no output. If you are using cygwin and installing node.js, be sure to use the "works" tag when you git the file, instead of a specific version number. Otherwise, no output/non working npm.
Now to figure out getting mongo setup properly...

Related

Python2 required as dependencie but already installed

First of all, sorry for my english and sorry for taking your time, I'm pretty sure the answers are online but it seems like I can't find the right keywords for this issue.
The problem: Python2 is installed but still asked as a dependency for every python2 module I want to install with my package manager.
I built python2 from source on Archlinux in a proot environment
(because I use termux on a non rooted phone and it's probably why yay did not worked as expected to install python2) and I think I did it well because "python2" open the python command line and "python2 -V" return me "Python 2.7.18", i can execute python scripts with it, etc.
I built python by downloading and uncompressing python2 from python.org, then in the uncompressed file ./configure --enable-optimization , make -s and make install.
I'm a noob so i don't know but i probably just need a way to handle python2 with pacman or a way to tell pacman that python2 is indeed installed.
repo.
I know to handle manualy built pkgs with pacman, but not software built from source. So i'v found a PKGBUILD for python2 but (again, probably because of the proot) when i use makepkg here what's happen :
[...
...
...]
==> Extracting sources...
-> Extracting Python-2.7.18.tar.xz with bsdtar
==> Starting prepare()...
bsdtar: Removing leading '/' from member names
patching file Makefile.pre.in
patch: setting attribute security.selinux for security.selinux: Permission denied
==> ERROR: A failure occurred in prepare().
Aborting...
So if anyone know how could i make makepkg works as intended or how could i tell pacman that python2 is already installed, it would totaly make my day.
PS : I know python2 is deprecated and as it's not updated anymore the security is getting worse and worse, but it's not for my main setup so don't worry. I also think i could install modules manually but it is not something i wish to do since i'd like to install the all BlackArch repo.

Termux says "'Bad Interpreter: No such file or directory"

I have a problem and hope someone can help me. I am currently trying to write a script for Termux or Termux:Task. My script currently looks like this:
#!/data/data/com.termux/files/usr/bin/bash
cd /./sdcard/www/public/
wp post list sleep 5
Every time I load the script I get the following error message:
/data/data/com.termux/files/usr/bin/wp: /usr/bin/env: bad interpreter: No such file or directory.
I've been looking for a solution to my problem for hours, unfortunately without success.
I am using an extension for Termux called "WordPress CLI". When I start termux and enter the commands individually, everything works. But as soon as I write the commands into a sh script and start it doesn't work anymore. :(
Can anyone help me?
Thanks a lot
This is simple error you can fix it by replacing !/data/data/com.termux/files/usr/bin/bash. With #!/data/data/com.termux/files/usr/bin/bash
Please tell if you get error again
Try with #!/usr/bin/env bash in the shebang line.
Termux-exec allows you to execute scripts with shebangs for traditional Unix file structures. So shebangs like #!/bin/sh and #!/usr/bin/env python should be able to run without termux-fix-shebang.
From https://wiki.termux.com/wiki/Termux-exec
According to doc:
Why do I keep getting a '/bin/sh bad interpreter' error?
This error is thrown due to access script interpreter at nonexistent
location.
Termux does not have common directories like /bin, /sbin, /usr/bin at
their standard place. There is an exception for certain devices where
/bin is a symbolic link to /system/bin, but that does not make a
difference.
Interpreters should be accessed at this directory only:
/data/data/com.termux/files/usr/bin
There are three ways to fix this:
Install termux-exec by using pkg install termux-exec. It won’t affect the current session, but after a restart should work without
any setup. Not needed if your Termux is up to date. If still not
working, try the next workaround.
Use command termux-fix-shebang to fix the shebang line of specified file.
Use termux-chroot from package proot to setup a chroot environment mimicking a normal Linux file system in Termux.
termux-fix-shebang my_script.py of second method work for me, which it modify the shebang(first line of my_script.py) from #!/usr/bin/env python to #!/data/data/com.termux/files/usr/bin/env python. Since /usr/bin/ is not exist in Android, that's why it throws the error /usr/bin/env: bad interpreter: No such file or directory. The other solution is run with python my_script.py, neither of my_script.py nor ./my_script.py.
In my test, termux-exec of the first method only work if I added correct shebang in main script(child OR child of child script no need) and ran command export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so.
And for the issue of this question, error shows /usr/bin/env in the middle with /data/data/com.termux/files/usr/bin/wp even though the shebang of script #!/data/data/com.termux/files/usr/bin/bash looks ok, it means that wp command (located at /data/data/com.termux/files/usr/bin/wp) used inside the script contains shebang #!/usr/bin/env wp and should modify it to #!/data/data/com.termux/files/usr/bin/env wp too. termux-exec of first method should fix this specific case too(already has correct shebang in main script).

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Getting Leiningen & Cygwin Working

I am trying to get Leiningen and Cygwin working together.
One of the problems I think I have is that I have Java installed in "C:\Program Files\Java..." directory. The space appears to be causing issues.
When I try to run the lein script in Cygwin, I am getting the following error:
./lein: line 325: C:\Program Files\Java\jdk1.8.0_05\bin\java.exe : command not found
Then I thought the issue was the space. So I changed line 325 from:
"$LEIN_JAVA_CMD" \
to (for testing purposes):
"$'C:\\\Program Files\\\Java\\\jdk1.8.0_05\\\bin\\\java.exe'" \
But, I am still getting this error:
./lein: line 325: $'C:\\Program Files\\Java\\jdk1.8.0_05\\bin\\java.exe' : commande introuvable
However, this file clearly exists:
Owner#Owner-PC ~
$ ls -alh $'C:\\Program Files\\Java\\jdk1.8.0_05\\bin\\java.exe'
-rwxr-xr-x 1 Owner None 187K 8 mai 15:39 C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
The lein script appears to be properly configuring Leiningen for Cygwin, however I can't get it to work.
Note that I previously installed Leiningen outside of Cygwin (I was running it in Windows' normal shell).
What could be wrong with my setup, any ideas?
I use Leiningen via Cygwin with no problems.
Start over
Start over with a fresh copy of the lein script. There should be no need to edit it.
Set your PATH to include java
The easiest solution is to set your path in ~/.profile to include the path to Java's bin directory. Lein will then find java on the path and you'll have access to java and its related tools in your shell.
export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.8.0_05/"
export PATH="${JAVA_HOME}/bin/:${PATH}"
Restart your shell or source ~/.profile. Verify that which java finds java command. And run java to verify you get the help output.
And/or explicitly set the LEIN_JAVA_CMD and JAVA_CMD variables
Alternatively, set the LEIN_JAVA_CMD and JAVA_CMD variables used by lein in your ~/.profile
export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.8.0_05/"
export LEIN_JAVA_CMD="${JAVA_HOME}/bin/java"
export JAVA_CMD=`cygpath -w "${LEIN_JAVA_CMD}"`
Restart your shell or source ~/.profile.
Note: You can also set a separate LEIN_JVM_OPTS and JVM_OPTS if desired, but this should not be necessary.
If you have lein previously installed on Windows and want to reach it from cygwin, then do:
on cmd:
cd C:/Users/%userprofile%/.lein/bin
mklink lein lein.bat
on cygwin:
export CYGWIN=winsymlinks:nativestrict
I feel your pain. I tried something like this myself several years ago.
You have at least two problems. One is getting lein to run as under unix as you noted. There are really two lein scripts - one for unix, the other a batch script for use under windows.
Your bigger problem is java.exe - getting the windows java executable to behave as a cygwin shell, and particular the unix lein script running in a cygwin shell, expects is messy and fragile undertaking.
I would strongly recommend either using a clojure ide that supports Windows (perhaps LightTable) or installing a full linux virtual machine with the unix java SDK and doing clojure development in that environment. Ubuntu running on virtualbox is freely available and an option I have used in the past for just this purpose.
You need to create a symbolic link to the "lein.bat" file.so you use it properly in Cygwin.
Open CMD and go to the ".lein" path (cd %userprofile%\.lein\bin) and run this: mklink lein lein.bat
#a-webb is almost right ,but there are still some steps to complete.First,you will find a folder called “.lein” where you run the lein script in cygwin,go in,copy the folder "self-installs" inside to C:\Users\yourUserName.lein
,then,add C:\Users\yourUserName.lein\bin to the environment variable $Path.
I've found the easiest way is to:
Install via the windows binaries and
Copy the lein bash script into .lein/bin
Then it should just work in cygwin.

Build numpy for python3 when python not installed in /usr

Fedora 18, x86_64.
Okay, so:
I have installed python3 in ~/utils/src/python3/Python-3.3.0/ so that it's available on NFS and I don't have to reinstall it on every machine in the lab.
I want to install numpy.
I got the source, it's in ~/utils/src/python3/numpy-1.7.0/ When I run python3 ./setup.py, I get:
file "~/utils/src/python3/Python-3.3.0/Lib/distutils/text_file.py", line 115, in open
self.file=io.open(self.filename, 'r', errors=self.errors)
FileNotFoundError: [Errno 2] No such file or directory:
'/usr/local/lib/python3.3/config-3.3m/Makefile'
Going up the stack, I get to sysconfig.py, line 435, which seems to generate the path name by calling get_makefile_filename, which is in sysconfig.py, line 251. It accesses globals (python_build, _sys_home, and a bunch of others), and I'm not sure how they're configured.
I tried passing --prefix=~/utils/src/python3/Python-3.3.0 to setup.py, but got nowhere. (And I'm not sure what exactly --prefix does anyways)
Has anyone had luck installing packages with nonstandard python3 installs?
Thanks,
Charles.
Okay, so here's the thing: distutils.sysconfig uses sys.executable, which is the location of the python executable. If this file is in the python build directory, then it will try to put everything in /lib. This was happening to me because I had a symlink from ~/utils/bin/python3 to ~/utils/src/python3/Python-3.3.0/python. sys.executable returned ~/utils/bin/python3, which was not in python's build directory.
Invoking the command as ~/utils/src/python3/Python-3.3.0/python setup.py got it to work.
I picked an arbitrary prefix (actually /dev/shm) and then copied everything that belonged in site-packages to ~/utils/src/python3/Python-3.3.0/Lib/site-packages/numpy, and it seems to work for now.