I installed clang-format-3.8 via apt-get.
Now I try to use it in gVim, but it is not working.
I checked and clang-format-3.8 exists in the folder /usr/share/vim/addons/syntax.
But when I enter :pyf /usr/share/vim/addons/syntax/clang-format-3.8.py in my vim command line, it returns:
E319: Sorry, the command is not available in this version.
I use gVim 7.4 under Ubuntu 16.04.
Dahn's answer is correct that the Vim binary that ships with Ubuntu 16.04 is compiled with Python 3 rather than Python 2. The clang-format-3.8.py script in the Ubuntu 16.04 clang-format-3.8 package is not compatible with Python 3.
But the latest clang-format.py does work with Python 3. You can get it here:
https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py
I think it was just a matter of putting parentheses around the print statements.
Save this file somewhere on your computer such as /usr/local/share/vim/addons/syntax/.
This script uses clang-format as the binary name, so you'll want to install the clang-format package, which installs the clang-format command as a symlink to clang-format-3.8.
Since Vim is now loading a Python 3 script, replace your :pyf (not available) command with :py3f:
:py3f /usr/local/share/vim/addons/syntax/clang-format.py
The Vim binary shipped with Ubuntu 16.04 is compiled with Python 3. The vim addons of clang-format is written by Python 2.
You need to either:
write your own addon by Python 3
Compile your own vim with Python 2, which is the easiest way
The instructions to build vim with Python can be found by Google.
In addition to the above answers I had to do a few more things. I downloaded a new python file and changed the key mapping recommended by in the clang python file to the following in my .vimrc:
map <C-I> :py3file <path-to-this-file>/clang-format.py<cr>
imap <C-I> <c-o>:py3file <path-to-this-file>/clang-format.py<cr>
This solved the E319 problem I was getting.
I solved the problem differently using a combination of bash and vim commands.
First, I installed clang-format package
# apt-get install clang-format-3.5
(I choose version 3.5 but you can choose a different one)
Second, Test if clang-format is working
$ clang-format-3.5 -style=Google test.cpp
Then, run vim
$ vim test.cpp
vim allows to run an external command and print it's output into current buffer
:r ! clang-format-3.5 -style=Google %
(more details about external commands in vim https://www.linux.com/learn/vim-tips-working-external-commands)
This will append the output of clang-format into current buffer. To replace current buffer, which is the desirable effect, specify the lines to output into
:%! clang-format-3.5 -style=Google %
(the first % means all line in current file)
You can make this process more productive by defining new commands in vim (using command) for both visual and command-line modes.
Related
A while back, I created a fork of the RDCOMClient package to keep it working with R 3.6 (https://github.com/dkyleward/RDCOMClient). People are now running into issues again because it won't work with R 4.0. The problem doesn't seem as easy to fix, and I'm hoping for some help.
If I flip Rstudio back to R 3.6 (and rtools35), I can use the package after installing with devtools::install_github(). When I try in R 4.0 (and rtools40), the package builds and I can connect over COM to an application. The first line of code below works, and xl is a COM pointer; however, trying to do anything with it (like set Excel to visible) will crash R.
xl <- RDCOMClient::COMCreate("Excel.Application")
xl[["Visible"]] <- TRUE
Again, the above works in R 3.6.
Is there is a way to continue building with the previous rtools? I came across https://github.com/r-windows/rtools-backports#readme, which talks about using rtools35 to keep building packages, so I have hope, but I don't understand how to make it happen.
Alternatively, if there are minor changes I can make to the R or cpp code that will solve my problem, I'm all ears. I'm a cpp novice, though.
This was a quick fix :
install.packages("RDCOMClient", repos = "http://www.omegahat.net/R")
Install R-4.0.0
Install Rtools35
Edit $R_HOME/etc/x64/Makeconf (for R-4.0.0-x64)
Rcmd INSTALL RDCOMClient
Rik's answer was incredibly helpful and got a version working; however, after spending a day on it, I was able to improve on it. I want to put that here in case I have to do it again. The main improvement is being able to build a working package for both 32- and 64-bit architectures. By default, R installs both, and this makes things easier when installing dependent packages.
The first two steps are the same:
Install R-4.0.0 (https://cran.r-project.org/bin/windows/base/old/4.0.0/R-4.0.0-win.exe)
Install Rtools35 (https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe) in directory c:\Rtools
If (like me) you had already installed rtools40, a system environment variable named RTOOLS40_HOME is created. The first step is to change that to:
C:\rtools
If you don't have rtools40 installed, then create the RTOOLS40_HOME system environment variable.
Two changes are still needed in the make files. These are found in your R installation directory.
In etc\x64\Makeconf, add underscores to match the rtools35 directory structure by setting these values:
MINGW_PREFIX = /mingw_$(WIN)
BINPREF ?= "$(RTOOLS40_ROOT)/mingw_64/bin/"
Do the same in etc\i386\Makeconf:
MINGW_PREFIX = /mingw_$(WIN)
BINPREF ?= "$(RTOOLS40_ROOT)/mingw_32/bin/"
Do not set BINPREF as an environment variable, or this will overwrite the makefile changes (like RTOOLS40_HOME does). With these complete, finish off with the same steps that Rik outlined:
Open windows command prompt and change to the directory that contains the RDCOMClient subdirectory and type:
R CMD INSTALL RDCOMClient –-build RDCOMClient.zip
This installs RDCOMClient in the local installation of R-4.0.0 and additionally creates the file RDCOMClient_0.94-0.zip that can be installed on other systems using the following command:
install.packages("RDCOMClient_0.94-0.zip", repos = NULL, type = "win.binary")
I can confirm that the procedure delineated in the answer above leads in the right direction but a few extra steps may be required. I can also confirm that the procedure below produces a Windows binary file that can be installed and will run under R-4.0.0:
Install R-4.0.0 (https://cran.r-project.org/bin/windows/base/old/4.0.0/R-4.0.0-win.exe)
Install Rtools35 (https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe) in directory c:\Rtools
Edit $R_HOME/etc/x64/Makeconf (for R-4.0.0-x64) by changing
## The rtools40 installer sets RTOOLS40_HOME, default to standard install path
RTOOLS40_HOME ?= c:/rtools40
to
## The rtools40 installer sets RTOOLS40_HOME, default to standard install path
RTOOLS40_HOME ?= c:/rtools
Download RDCOMClient-master.zip from https://github.com/omegahat/RDCOMClient (click the green Clone button and select download zip)
Unpack to a directory named RDCOMClient
Ensure that the following PATH variables are set:
C:\Program Files\R\R-4.0.0\bin\x64 (assuming this is the location where R is installed)
C:\Rtools\bin
C:\Rtools\mingw_64\bin
Add environment variable BINPREF with the following value (the final slash is important):
C:/Rtools/mingw_64/bin/
Open windows command prompt and change to the directory that contains the RDCOMClient subdirectory and type:
R CMD INSTALL RDCOMClient –-build RDCOMClient.zip
This installs RDCOMClient in the local installation of R-4.0.0 and additionally creates the file RDCOMClient_0.94-0.zip that can be installed on other systems using the following command:
install.packages("RDCOMClient_0.94-0.zip", repos = NULL, type = "win.binary")
I am using R 4.1.2 and I found RDCOMClient will crash the R Session and the above solutions were not working.
Then, I further check with the source owner and found out the solution.
https://github.com/omegahat/RDCOMClient/issues/36
Duncantl gave the solution and it works.
dir.create("MyTemp")
remotes::install_github("BSchamberger/RDCOMClient", ref = "main", lib = "MyTemp")
If that is successful, we can then load the newly installed package with
library("RDCOMClient", lib.loc = "MyTemp")
Problem:
E319: Sorry, the command is not available in this version
Problem
When I run vim environment and try reformat code (CTRL+K) i get this warning on the screen
Environment:
System: Mac OS X
Settings:
Vim:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 17 2016 20:17:27)
MacOS X (unix) version
Included patches: 1-91
python:
python --version: Python 3.5.2
What I do
Update vim: 7.3 -> 8.0
Update python: ~2.7 -> ~3.5
I updated the .vimrc file
from
map <C-K> :pyf .../clang-format.py<cr>
imap <C-K> <c-o>:pyf .../clang-format.py<cr>
to
map <C-K> ggVG :py3f .../clang-format.py<cr>
imap <C-K> <c-o>:py3f .../clang-format.py<cr>
Also I update clang-format file
https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py
Thx,
Solution:
1. Go to .vimrc file and add commands
map <C-K> :pyf <path-to-this-file>/clang-format.py<cr>
imap <C-K><c-o>:pyf <path-to-this-file>/clang-format.py<cr>
2.Add this https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py source code to clang-format.py file, you can save this file to i.e
<path-to-this-file>/clang-format.py
where path-to-this-file is path to direction where you put this file.
3.Save clang-format.py file and run vim. Check that the command works.
You can also install macvim for OSX. Instruction you can find here. How can I install MacVim on OS X?
PS: If you get "Sorry, the command is not available in this version" error, try:
map <C-K> :py3f <path-to-this-file>/clang-format.py<cr>
imap <C-K><c-o>:py3f <path-to-this-file>/clang-format.py<cr>
Here
$ which clang-format
returns
/usr/local/bin/clang-format
Then
ls -ls /usr/local/bin/clang-format
points to
/usr/local/Cellar/clang-format/2018-04-24/share/clang/clang-format.py
So I do
$ vim ~/.vimrc
map <C-K> :pyf /usr/local/Cellar/clang-format/2018-04-24/share/clang/clang-format.py<cr>
imap <C-K> <c-o>:pyf /usr/local/Cellar/clang-format/2018-04-24/share/clang/clang-format.py<cr>
This works on vim (from terminal) but not on macvim.
Just mention the project https://github.com/rhysd/vim-clang-format
Which is very handy to use, and save us from repeated work.
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?
I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
The official solution for coexistence seems to be the Python Launcher for Windows, PEP 397 which was included in Python 3.3.0. Installing the release dumps py.exe and pyw.exe launchers into %SYSTEMROOT% (C:\Windows) which is then associated with py and pyw scripts, respectively.
In order to use the new launcher (without manually setting up your own associations to it), leave the "Register Extensions" option enabled. I'm not quite sure why, but on my machine it left Py 2.7 as the "default" (of the launcher).
Running scripts by calling them directly from the command line will route them through the launcher and parse the shebang (if it exists). You can also explicitly call the launcher and use switches: py -3 mypy2script.py.
All manner of shebangs seem to work
#!C:\Python33\python.exe
#!python3
#!/usr/bin/env python3
as well as wanton abuses
#! notepad.exe
Here's my setup:
Install both Python 2.7 and 3.4 with the windows installers.
Go to C:\Python34 (the default install path) and change python.exe to python3.exe
Edit your environment variables to include C:\Python27\;C:\Python27\Scripts\;C:\Python34\;C:\Python34\Scripts\;
Now in command line you can use python for 2.7 and python3 for 3.4.
From version 3.3 Python introduced Launcher for Windows utility https://docs.python.org/3/using/windows.html#python-launcher-for-windows.
So to be able to use multiple versions of Python:
install Python 2.x (x is any version you need)
install Python 3.x (x is any version you need also you have to have one version 3.x >= 3.3)
open Command Prompt
type py -2.x to launch Python 2.x
type py -3.x to launch Python 3.x
You can have both installed.
You should write this in front of your script:
#!/bin/env python2.7
or, eventually...
#!/bin/env python3.6
Update
My solution works perfectly with Unix, after a quick search on Google, here is the Windows solution:
#!c:/Python/python3_6.exe -u
Same thing: in front of your script.
Here is a neat and clean way to install Python2 & Python3 on windows.
https://datascience.com.co/how-to-install-python-2-7-and-3-6-in-windows-10-add-python-path-281e7eae62a
My case: I had to install Apache cassandra. I already had Python3 installed in my D: drive. With loads of development work under process i didn't wanted to mess my Python3 installation. And, i needed Python2 only for Apache cassandra.
So i took following steps:
Downloaded & Installed Python2.
Added Python2 entries to classpath (C:\Python27;C:\Python27\Scripts)
Modified python.exe to python2.exe (as shown in image below)
Now i am able to run both. For Python 2(python2 --version) & Python 3 (python --version).
So, my Python3 installation remained intact.
I'm using 2.5, 2.6, and 3.0 from the shell with one line batch scripts of the form:
:: The # symbol at the start turns off the prompt from displaying the command.
:: The % represents an argument, while the * means all of them.
#c:\programs\pythonX.Y\python.exe %*
Name them pythonX.Y.bat and put them somewhere in your PATH. Copy the file for the preferred minor version (i.e. the latest) to pythonX.bat. (E.g. copy python2.6.bat python2.bat.) Then you can use python2 file.py from anywhere.
However, this doesn't help or even affect the Windows file association situation. For that you'll need a launcher program that reads the #! line, and then associate that with .py and .pyw files.
When you add both to environment variables there will a be a conflict because the two executable have the same name: python.exe.
Just rename one of them. In my case I renamed it to python3.exe.
So when I run python it will execute python.exe which is 2.7
and when I run python3 it will execute python3.exe which is 3.6
Here you go...
winpylaunch.py
#
# Looks for a directive in the form: #! C:\Python30\python.exe
# The directive must start with #! and contain ".exe".
# This will be assumed to be the correct python interpreter to
# use to run the script ON WINDOWS. If no interpreter is
# found then the script will be run with 'python.exe'.
# ie: whatever one is found on the path.
# For example, in a script which is saved as utf-8 and which
# runs on Linux and Windows and uses the Python 2.6 interpreter...
#
# #!/usr/bin/python
# #!C:\Python26\python.exe
# # -*- coding: utf-8 -*-
#
# When run on Linux, Linux uses the /usr/bin/python. When run
# on Windows using winpylaunch.py it uses C:\Python26\python.exe.
#
# To set up the association add this to the registry...
#
# HKEY_CLASSES_ROOT\Python.File\shell\open\command
# (Default) REG_SZ = "C:\Python30\python.exe" S:\usr\bin\winpylaunch.py "%1" %*
#
# NOTE: winpylaunch.py itself works with either 2.6 and 3.0. Once
# this entry has been added python files can be run on the
# commandline and the use of winpylaunch.py will be transparent.
#
import subprocess
import sys
USAGE = """
USAGE: winpylaunch.py <script.py> [arg1] [arg2...]
"""
if __name__ == "__main__":
if len(sys.argv) > 1:
script = sys.argv[1]
args = sys.argv[2:]
if script.endswith(".py"):
interpreter = "python.exe" # Default to wherever it is found on the path.
lines = open(script).readlines()
for line in lines:
if line.startswith("#!") and line.find(".exe") != -1:
interpreter = line[2:].strip()
break
process = subprocess.Popen([interpreter] + [script] + args)
process.wait()
sys.exit()
print(USAGE)
I've just knocked this up on reading this thread (because it's what I was needing too). I have Pythons 2.6.1 and 3.0.1 on both Ubuntu and Windows. If it doesn't work for you post fixes here.
Try using Anaconda.
Using the concept of Anaconda environments, let’s say you need Python 3 to learn programming, but you don’t want to wipe out your Python 2.7 environment by updating Python. You can create and activate a new environment named "snakes" (or whatever you want), and install the latest version of Python 3 as follows:
conda create --name snakes python=3
Its simpler than it sounds, take a look at the intro page here: Getting Started with Anaconda
And then to handle your specific problem of having version 2.x and 3.x running side by side, see:
Managing Python Versions with Anaconda
Switching between Python 2 and Python 3 environments
As far as I know Python runs off of the commandline using the PATH variable as opposed to a registry setting.
So if you point to the correct version on your PATH you will use that. Remember to restart your command prompt to use the new PATH settings.
The Python installation normally associates .py, .pyw and .pyc files with the Python interpreter. So you can run a Python script either by double-clicking it in Explorer or by typing its name in a command-line window (so no need to type python scriptname.py, just scriptname.py will do).
If you want to manually change this association, you can edit these keys in the Windows registry:
HKEY_CLASSES_ROOT\Python.File\shell\open\command
HKEY_CLASSES_ROOT\Python.NoConFile\shell\open\command
HKEY_CLASSES_ROOT\Python.CompiledFile\shell\open\command
Python Launcher
People have been working on a Python launcher for Windows: a lightweight program associated with .py and .pyw files which would look for a "shebang" line (similar to Linux et al) on the first line, and launch Python 2.x or 3.x as required. See "A Python Launcher for Windows" blog post for details.
Here is how to run Python 2 and 3 on the same machine
install Python 2.x
install Python 3.x
Start Powershell
Type Python -2 to launch Python 2.x
Type Python -3 to launch Python 3.x
The Python Launcher for Windows was embedded into Python since Version 3.3, as promised in 2011 when the Stand alone first made its debut:
Python Launcher for Windows
Easy-peasy ,after installing both the python versions add the paths to the environment variables ;see. Then go to python 2 and python 3 folders and rename them to python2 and python3 respectively as shown and . Now in cmd type python2 or python3 to use your required version see .
I think there is an option to setup the windows file association for .py files in the installer. Uncheck it and you should be fine.
If not, you can easily re-associate .py files with the previous version. The simplest way is to right click on a .py file, select "open with" / "choose program". On the dialog that appears, select or browse to the version of python you want to use by default, and check the "always use this program to open this kind of file" checkbox.
You should make sure that the PATH environment variable doesn't contain both python.exe files ( add the one you're currently using to run scripts on a day to day basis ) , or do as Kniht suggested with the batch files .
Aside from that , I don't see why not .
P.S : I have 2.6 installed as my "primary" python and 3.0 as my "play" python . The 2.6 is included in the PATH . Everything works fine .
Before I courageously installed both simultaneously, I had so many questions. If I give python will it go to py3 when i want py2? pip/virtualenv will happen under py2/3?
It seems to be very simple now.
Just blindly install both of them. Make sure you get the right type(x64/x32).
While/after installing make sure you add to the path to your environment variables.
[ENVIRONMENT]::SETENVIRONMENTVARIABLE("PATH", "$ENV:PATH;C:\PYTHONx", "USER")
Replace the x in the command above to set the path.
Then go to both the folders.
Navigate to
python3.6/Scripts/
and rename pip to pip3.
If pip3 already exists delete the pip. This will make sure that just pip will run under python2. You can verify by:
pip --version
In case you want to use pip with python3 then just use
pip3 install
You can similarly do the same to python file and others.
Cheers!
I had the same problem where I wanted to use python3 for most work but IDA pro required python2. SO, here's what I did.
I first created 3 variables in the user environment variable as follows:
PYTHON_ACTIVE : This is initially empty
HOME_PYTHON27 : Has a path to a folder where Python 2 is installed. Eg. ";/scripts;"
HOME_PYTHON38 : Similar to python 2, this variable contains a path to python 3 folders.
Now I added
%PYTHON_ACTIVE%
to PATH variable. So, basically saying that whatever this "PYTHON_ACTIVE" contains is the active python. We programmatically change the contains of "PYTHON_ACTIVE" to switch python version.
Here is the example script:
:: This batch file is used to switch between python 2 and 3.
#ECHO OFF
set /p choice= "Please enter '27' for python 2.7 , '38' for python 3.8 : "
IF %choice%==27 (
setx PYTHON_ACTIVE %HOME_PYTHON27%
)
IF %choice%==38 (
setx PYTHON_ACTIVE %HOME_PYTHON38%
)
PAUSE
This script takes python version as input and accordingly copies HOME_PYTHON27 or HOME_PYTHON38 to PYTHON_ACTIVE. Thus changing the global Python version.
I would assume so, I have Python 2.4, 2.5 and 2.6 installed side-by-side on the same computer.
I am just starting out with python now. I'm reading Zed Shaw's book "Learn Python the Hard Way" which requires python version 2.x but am also taking a class that requires python 3.x
So here is what I did.
Download python 2.7
run power shell (should already be installed on windows)
run python IN POWERSHELL (if it doesn't recognize then go to step 4)
Only if powershell doesn't recognize python 2.7 type in the following:
"[ENVIRONMENT]::SETENVIRONMENTVARIABLE("PATH", "$ENV:PATH;C:\PYTHON27", "USER")"
(no outside quotes)
Now type python and you should see it say python 2.7 blah blah blah
NOW for python 3.x
Simple, python 3.x download comes with python for windows app. SO simply pin the Python for Windows app to your task bar, or create shortcut to the desktop and you are done!
Open Python for Windows for 3.x
Open Powershell for python 2.x
I hope this helps!
Hmm..I did this right now by just downloading Python 3.6.5 for Windows at https://www.python.org/downloads/release/python-365/ and made sure that the launcher would be installed. Then, I followed the instructions for using python 2 and python 3. Restart the command prompt and then use py -2.7 to use Python 2 and py or py -3.6 to use Python 3. You can also use pip2 for Python 2's pip and pip for Python 3's pip.
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.
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...