My favorites | Sign in
Project Logo
             
Search
for
Updated Nov 03, 2009 by dthomp325
Faq  
Frequently asked questions.

Faq

How do I get the encoder/decoder extensions to compile in Windows?

MinGW/GCC

  1. Download and install MinGW. http://sourceforge.net/project/showfiles.php?group_id=2435
  2. Add {MinGW}\bin directory to the system PATH
  3. Download and unpack AmFast source code from PyPi
  4. In the directory you've unpacked AmFast type:
    1. python setup.py build -c mingw32
    2. python setup.py install

Visual Studio 2008

  1. Open Visual Studio.
  2. Select 'Tools->Visual Studio 2008 Command Prompt'.
  3. In the directory you've unpacked AmFast type:
    1. python setup.py install

Trouble Shooting

How much faster is AmFast compared with PyAmf?


Comment by leavesmaple, May 20, 2009

Hi, I still failed in "python setup.py install" after "python setup.py build -c mingw32" successfully:(

The message said "extension must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32?, by passing "-c mingw32" to setup.py."

But I have Visual Studio 9.0 installed. Since I dont want to install older version of VS, could you give me some advice to solve the problem?

Thank you very much!

Comment by dthomp325, May 20, 2009

AmFast? is currently supported for Python 2.4, 2.5, and 2.6. However, the instructions for compiling on Windows only work for 2.5 and 2.6, the process for 2.4 is more involved, and I haven't posted anything about it yet. Please post the version of Python and the version of Windows you are using, so I can help you out. Thanks.

Comment by leavesmaple, May 20, 2009

I has just hacked this problem by modifying the msvccompiler.py under {Python}\Lib\distutils\. I commented the following lines:

try:
if version > 7.0:
self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
else:
self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
except KeyError?, exc: #
raise DistutilsPlatformError?, \
("""Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32?, by passing "-c mingw32" to setup.py.""")

But it is just a hack which may have pitfall. And my python version is 2.5 and windows is XP.

Comment by leavesmaple, May 21, 2009

And I met another error when build amfast in another computer which has Python 2.6.2 and windows XP. The error msg are: ... building 'amfast.encode' extension writing build\temp.win32-2.6\Release\amfast\ext_src\encode.def c:\cygwin\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.6\Release\amfast\ext_src\encoder.o build\temp.win32-2.6\Release\amfast\ext_src\amf.o build\temp.win32-2.6\Release\amfast\ext_src\encoder.def -Ld:\exDev\Python26\libs -Ld:\exDev\Python26\PCbuild -lpython26 -lmsvcr90 -o build\lib.win32-2.6\amfast\encode.pyd ld: dllcrt2.o: No such file:No such file or directory error: command 'gcc' failed with exit status 1

Do you have any clue? Thank you!

Comment by leavesmaple, May 21, 2009

Sorry for the last mess error msg. I wrapped: ...

building 'amfast.encode' extension

writing build\temp.win32-2.6\Release\amfast\ext_src\encode.def

c:\cygwin\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.6\Release\amfast\ext_src\encoder.o build\temp.win32-2.6\Release\amfast\ext_src\amf.o build\temp.win32-2.6\Release\amfast\ext_src\encoder.def -Ld:\exDev\Python26\libs -Ld:\exDev\Python26\PCbuild -lpython26 -lmsvcr90 -o build\lib.win32-2.6\amfast\encode.pyd

ld: dllcrt2.o: No such file:No such file or directory

error: command 'gcc' failed with exit status 1

Comment by dthomp325, May 21, 2009

It looks like the computer with Python 2.6 has Cygwin installed, and the build process is using the 'gcc.exe' binary that was installed with Cygwin. You might need to change your PATH variable so that it uses the 'gcc.exe' binary that is distributed with MinGW.

Comment by leavesmaple, May 21, 2009

You are right! It is because of Cygwin which I used for amfast in windows. After I reinstalled all the gcc libs of Cygwin, it can be successfully built and installed! Thank you for your hint!

Comment by C.Zhangbaby, May 25, 2009

when i execute the lastest step"python setup.py install" it shows: ...... running build_ext error: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32?, by passing "-c mingw32" to setup.py.

Comment by dthomp325, May 25, 2009

Zhangbaby, Cygwin allows you to run GNU programs on a Windows box: http://www.cygwin.com/. What version of Windows are you using? What version of Python are you using? Are you using the standard Python distribution, or something custom like ActiveState?

Comment by nootropic.kint, May 26, 2009

what's up?

C:\Documents and Settings\zallo\Desktop\AmFast?-0.3.2>python setup.py build -c mi ngw32 running build running build_py package init file 'init.py' not found (or not a regular file) running build_ext Traceback (most recent call last):

File "setup.py", line 50, in <module>
"Topic :: Utilities"
File "C:\Programmi\Python25\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Programmi\Python25\lib\distutils\dist.py", line 974, in run_commands
self.run_command(cmd)
File "C:\Programmi\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\Programmi\Python25\lib\distutils\command\build.py", line 112, in run
self.run_command(cmd_name)
File "C:\Programmi\Python25\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Programmi\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\Programmi\Python25\lib\site-packages\setuptools-0.6c9-py2.5.egg\setuptools\command\build_ext.py", line 46, in run File "C:\Programmi\Python25\lib\distutils\command\build_ext.py", line 255, in run
force=self.force)
File "c:\Programmi\Python25\lib\distutils\ccompiler.py", line 1175, in new_compiler
return klass (None, dry_run, force)
File "c:\Programmi\Python25\lib\distutils\cygwinccompiler.py", line 292, in init
CygwinCCompiler.init (self, verbose, dry_run, force)
File "c:\Programmi\Python25\lib\distutils\cygwinccompiler.py", line 84, in init
get_versions()
File "c:\Programmi\Python25\lib\distutils\cygwinccompiler.py", line 424, in get_versions
ld_version = StrictVersion?(result.group(1))
File "C:\Programmi\Python25\lib\distutils\version.py", line 40, in init
self.parse(vstring)
File "C:\Programmi\Python25\lib\distutils\version.py", line 107, in parse
raise ValueError?, "invalid version number '%s'" % vstring
ValueError?: invalid version number '2.18.50.20080109'

Comment by nootropic.kint, May 26, 2009

SOLVED?

before i had python 2.5 i installed then python 2.6 and reinstalled setuptools and now load correctly

sorry

Comment by C.Zhangbaby, May 27, 2009

My python'version is 2.5, my System is xp, I had installed the mingW32 and cygWin.

I can execute "python setup.py build -c mingw32" successfully,but then execute the "python setup.py install" , it will say:

'''Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32??, by passing "-c mingw32" to setup.py.
'''

I will crazy .. I hope someone can provide a particular tutorial about install amfast . and if it can take some image , it will be good.

Comment by dabodo.2, Jul 02, 2009

Correct idea, but invalid command line. Better try this:

python setup.py build --c=mingw32 install

Alternatively, you can create a 'distutils.cfg' file.

Both is explained here: http://twistedmatrix.com/trac/wiki/WindowsBuilds

Comment by a.hasib.bhati, Jul 07, 2009

hi, I have a problem when i run "python setup.py build -c mingw32". the error is like "import error:no module named setuptools" Kindly solve this problem

Comment by dthomp325, Jul 07, 2009

a.hasib.bhati - until the issue is fixed, you can get around the problem by downloading and installing setuptools from here: http://pypi.python.org/pypi/setuptools/0.6c9 before installing AmFast?

Comment by a.hasib.bhati, Jul 07, 2009

issue is fixed. Now I have another error "command gcc failed. No such file or directory ".

Comment by dthomp325, Jul 07, 2009

a.hasib.bhati - You probably need to add the directory where gcc.exe is located to your system path.

On my computer gcc.exe was installed at 'C:\MinGW\bin'.

Follow these steps to add a directory to your system path (Windows XP):

  • Right-click on 'My Computer' and select 'Properties'
  • Click the 'Advanced' tab.
  • Click the 'Environment Variables' tab.
  • Find and edit the 'Path' variable in the list of 'System variables'.
Comment by a.hasib.bhati, Jul 07, 2009

now i am facing another problem. the error is "C:windows\system32\cmd.exe; /c C:\MingGW\bin\gcc.exe -dumpversion :the system cannot find the file specified "

Comment by a.hasib.bhati, Jul 12, 2009

hi, still facing the same error. any clue. kindly help me

Comment by dthomp325, Jul 20, 2009

Can you check that gcc.exe is located in C:\MingGW\bin? If you're using Python 2.6, you could also try the instructions for compiling with VS 2008.

Comment by cgmelt, Sep 21, 2009

I changed the extnesions from .c to .cpp to the files in ext_src (and accordingly inside setup.py) and than, VS 2003 successfully compiled the code!!!

Comment by will.ogden, Dec 09, 2009

same as above...on Python 2.6 / VS2008 renamed source files to .cpp and compiles without issue!

Comment by patricklemiuex, Dec 10, 2009

Had no problems getting this set up, I might blog about how to get it started.

Python runs easy on Ubuntu


Sign in to add a comment
Hosted by Google Code