My favorites | Sign in
Project Home Wiki Issues Source
Search
for
Faq  
Frequently asked questions.
Updated Nov 3, 2009 by dthomp...@gmail.com

Faq

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

MinGW/GCC

  • MinGW provides a very basic GNU environment in Windows, allowing you to use GCC.
  • This answer was provided by Warlei in a comment on my blog.
  • It should work with Python 2.5 and 2.6.
  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

  • This method should work with Python 2.6.
  • I tried this method with Visual Studio C++ 2008 Express Edition, which is a free download from Microsoft.
  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?

  • AmFast is anywhere from 2x to 12x quicker than cPyAmf version 0.5.1 at encoding and decoding binary AMF streams.
  • The exact difference depends on system architecture, Python version, and the type of objects in the stream.
  • Benchmarks coming soon!
Comment by leavesma...@gmail.com, 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 project member dthomp...@gmail.com, 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 leavesma...@gmail.com, 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 leavesma...@gmail.com, 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 leavesma...@gmail.com, 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 project member dthomp...@gmail.com, 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 leavesma...@gmail.com, 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.Zhangb...@gmail.com, 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 project member dthomp...@gmail.com, 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 nootropi...@gmail.com, 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 nootropi...@gmail.com, 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.Zhangb...@gmail.com, 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 2, 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....@gmail.com, Jul 7, 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 project member dthomp...@gmail.com, Jul 7, 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....@gmail.com, Jul 7, 2009

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

Comment by project member dthomp...@gmail.com, Jul 7, 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....@gmail.com, Jul 7, 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....@gmail.com, Jul 12, 2009

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

Comment by project member dthomp...@gmail.com, 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 cgm...@gmail.com, 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.og...@gmail.com, Dec 9, 2009

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

Comment by patrickl...@gmail.com, Dec 10, 2009

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

Python runs easy on Ubuntu

Comment by sein.ada...@gmail.com, Apr 8, 2010

CONFIRMED

changing all ".c" files to ".cpp" in ext_src folder and in setup.py paths fixes a lot of compiling problems

Comment by alexis.tejeda, Jul 17, 2010

Install in Fedora

Install dependencies first.

[atejeda@fedora amfast]$ sudo yum install gcc gcc-devel python-devel
[atejeda@fedora amfast]$ sudo python setup.py install
Comment by williamgeraldo, Mar 28, 2011

I can not compile with py2.7 on win64, not with mingw64 or VS. Can someone help me?

Comment by avekir, May 24, 2011

building 'amfast.encode' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c amfast/ext_src/encoder.c -o build/temp.linux-i686-2.7/amfast/ext_src/encoder.o amfast/ext_src/encoder.c:5:17: fatal error: amf.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1


Ubuntu 11.04/x32 and Python 2.7.1-dev

Hey! Guys ! You created awesome code but you did not created any install help and now this code have no meaning.


Sign in to add a comment
Powered by Google Project Hosting