469,575 Members | 1,193 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

libraries with distutils

Hi I have a question about writing a portable setup.py script for distutils.

I have a directory structure like this.

FreeImage/
|----------Source/
| |------ FreeImage.h
|
|----------Dist/
| |------FreeImage.lib
| |------FreeImage.dll
|
|----------Wrapper/
|---------Python/
|----------build/
|

|----------freeimagemodule.c
|----------setup.py

I want to create a setup file that works on both unix and Windows but I
am having trouble with windows.
My setup.py file is like the following:

from distutils.core import setup, Extension

ext_module = Extension('freeimagewrapper',
define_macros = [('MAJOR_VERSION', '3'),
('MINOR_VERSION', '7')],
include_dirs = ['../../Source/'],
library_dirs=['../../Dist/'],
libraries = ['FreeImage'],
sources = ['freeimagemodule.c'])

setup (name = 'freeimage',
version = '1.0',
author = 'Glenn Pierce',
description = 'Python wrapper for the freeimage library',
ext_modules = [ext_module])
I am getting link errors as vs can't seem to find ../../Dist/FreeImage.lib

The output is

running build
running build_ext
building 'freeimagewrapper' extension
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe /DLL
/nologo
/INCREMENTAL:NO /LIBPATH:../../Dist/ "/LIBPATH:C:\Program
Files\Python24\libs"
"/LIBPATH:C:\Program Files\Python24\PCBuild" FreeImage.lib
/EXPORT:initfreeimage
wrapper build\temp.win32-2.4\Release\freeimagemodule.obj
/OUT:build\lib.win32-2.
4\freeimagewrapper.pyd
/IMPLIB:build\temp.win32-2.4\Release\freeimagewrapper.lib

The errors are like

Creating library build\temp.win32-2.4\Release\freeimagewrapper.lib and
object
build\temp.win32-2.4\Release\freeimagewrapper.exp
freeimagemodule.obj : error LNK2019: unresolved external symbol
_FreeImage_Unloa
d referenced in function _destroy

Also I guess when the python module is installed it will still need to
find FreeImage.dll in a libray path searched by the system or will
distutils place the actual dll and lib files where thay can be found ?

I have read the distutils guide but wasn't clear on the library section
for ext modules.

Thanks for any help.

Glenn

Jul 19 '05 #1
0 1303

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Robert Ferrell | last post: by
1 post views Thread by Mathieu Malaterre | last post: by
15 posts views Thread by Colin J. Williams | last post: by
1 post views Thread by Terry Hancock | last post: by
7 posts views Thread by Frans Englich | last post: by
6 posts views Thread by ajikoe | last post: by
1 post views Thread by Bo Peng | last post: by
1 post views Thread by Alexandre Guimond | last post: by
reply views Thread by Alexandre Guimond | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.