472,353 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 1369

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Robert Ferrell | last post by:
I'm trying to do some debugging of python extensions on Windows2K. MS Visual Studio (.NET) says it can't find the debug version of the python...
1
by: Mathieu Malaterre | last post by:
Hello, I thought this would be easy but I guess I didn't get the distutil feeling. I am trying to write a setup for install my package but I...
15
by: Colin J. Williams | last post by:
The distutils download page has: -------------------------------------------------------- Current stable release The current stable release is...
1
by: Terry Hancock | last post by:
Some time ago, I got the idea that I wanted to build image resources from vector graphic originals, instead of marshalling hundreds of tiny little...
7
by: Frans Englich | last post by:
This is silly. How do I access data files I've installed with distutils? In a portable, generic way, I want to find out what is the following path...
6
by: ajikoe | last post by:
Hello I tried to combine c++ and python together. So I follow from this website: http://kortis.to/radix/python_ext/ I have this code: #...
1
by: Bo Peng | last post by:
Dear list, My python modules depend on a few boost libraries. For convenience, I include the source code of these libraries with my distribution...
1
by: Alexandre Guimond | last post by:
Hi. I want to create a portable setup.py file for windows / linux for an extension package that i need to link with external libraries (gsl and...
0
by: Alexandre Guimond | last post by:
Hi. I just noticed that the "libraries" options under the section in setup.cfg doesn't seem to get expanded. In particular, in...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.