How to install SWIG?
Asked Answered
R

4

24

Noob question ahead...

I'm trying to install SWIG on Windows. According to the INSTALL document, I have to

cd to the directory containing the package's source code and type ./configure to configure the package for your system.

I tried the command in both the root directory and in the /CCache directory (these are the only ones that have the configure and configure.in files), however, the shell reports back that

C:\swigwin-2.0.4>./configure
'.' is not recognized as an internal or external command,
operable program or batch file.

What am I missing?

Remorseful answered 16/9, 2011 at 10:7 Comment(0)
H
12

The page http://www.swig.org/download.html has a specific download for Windows with a pre-built version of swig.exe. You can download it and avoid the hassle of compiling swig by yourself.

If you really need to, you can consult the file Doc/Manual/Windows.html that contain Windows-specific instructions to build SWIG.

Finally, to answer your specific question, the syntax

./configure

is a UNIX-style command that means 'execute the program named configure in the current directory' (the dot)

On Windows, you would type

.\configure

or even simpler, as all files are executable on Windows, only

configure

... BUT this will not work as the said 'configure' script is a bash script that will not run in a Windows shell.

Hostler answered 16/9, 2011 at 10:17 Comment(2)
I just wanna know, how do I know if swig is installed. when I tried to run swig.exe it says "Must specify an input file. Use -help for available options."Hollington
@Christian-Eric-Paran that means it is installed, because it's telling you that it needs command line arguments and -help will help you.Immobility
S
56

no installation is needed. you just have to set the environment variable to point to the "swig" 's executable which is under the root directory of swig

On the SWIG site, you can download for example the swigwin-2.0.7 zip directory for windows's swig. unzip it in a directory of your choice for example on "C:\Program Files" directory if you want. After this, you have the swig executable in the "C:\Program Files\swigwin-2.0.7" directory: "C\Program Files\swigwin-2.0.7\swig" you have to set now the environment variable "path" to point to this swig exec: add for this the "C:\Program Files\swigwin-2.0.7" path to the "path"variable according to my example; that is all you need to use swig on windows. You can now play with swig so, open a prompt "cmd" and just type "swig --help" on this prompt you can see a list of the differents options you can use with swig. If you d'ont have visual c++, you can use for example codeblock, that is my case so the link below could be a help for you : http://wiki.codeblocks.org/index.phptitle=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

Semple answered 14/6, 2012 at 15:10 Comment(1)
Detailed solution for the question. Thank you, this information also helped me!Cedilla
H
12

The page http://www.swig.org/download.html has a specific download for Windows with a pre-built version of swig.exe. You can download it and avoid the hassle of compiling swig by yourself.

If you really need to, you can consult the file Doc/Manual/Windows.html that contain Windows-specific instructions to build SWIG.

Finally, to answer your specific question, the syntax

./configure

is a UNIX-style command that means 'execute the program named configure in the current directory' (the dot)

On Windows, you would type

.\configure

or even simpler, as all files are executable on Windows, only

configure

... BUT this will not work as the said 'configure' script is a bash script that will not run in a Windows shell.

Hostler answered 16/9, 2011 at 10:17 Comment(2)
I just wanna know, how do I know if swig is installed. when I tried to run swig.exe it says "Must specify an input file. Use -help for available options."Hollington
@Christian-Eric-Paran that means it is installed, because it's telling you that it needs command line arguments and -help will help you.Immobility
C
10

Download Miniconda.

Then follow this guide and do: conda install -c anaconda swig

Centenarian answered 11/1, 2018 at 8:2 Comment(2)
this is by far the best alternative !Trawick
Syntax error : f.__name__ for f in reversed((self.first,) + self.funcs), ^ SyntaxError: Generator expression must be parenthesizedCrypt
D
2

If you are using an environment with Python (and console scripts that end up on your PATH): pip install swig

The package provides binary wheels for Windows, Linux, and macOS on the most commonly used architectures (x86-64, aarch64, ppc). For less common architectures such as RISC-V, it will compile swig from source.

Dunfermline answered 7/7, 2023 at 19:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.