473,657 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('free imagewrapper',
define_macros = [('MAJOR_VERSION ', '3'),
('MINOR_VERSION ', '7')],
include_dirs = ['../../Source/'],
library_dirs=['../../Dist/'],
libraries = ['FreeImage'],
sources = ['freeimagemodul e.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 'freeimagewrapp er' extension
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\li nk.exe /DLL
/nologo
/INCREMENTAL:NO /LIBPATH:../../Dist/ "/LIBPATH:C:\Prog ram
Files\Python24\ libs"
"/LIBPATH:C:\Prog ram Files\Python24\ PCBuild" FreeImage.lib
/EXPORT:initfree image
wrapper build\temp.win3 2-2.4\Release\fre eimagemodule.ob j
/OUT:build\lib.w in32-2.
4\freeimagewrap per.pyd
/IMPLIB:build\te mp.win32-2.4\Release\fre eimagewrapper.l ib

The errors are like

Creating library build\temp.win3 2-2.4\Release\fre eimagewrapper.l ib and
object
build\temp.win3 2-2.4\Release\fre eimagewrapper.e xp
freeimagemodule .obj : error LNK2019: unresolved external symbol
_FreeImage_Unlo a
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 1446

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

Similar topics

9
7183
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 libraries. (The message is "python.exe does not contain any debugging information".) I installed the binaries from the Windows installer. How should I get the debug libraries? Or is that even what I need? I'm kind of new to Windows, and Visual Studio in particular, so maybe I'm way off base. ...
1
2649
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 don't understand how to do that. organisation: setup.py /bin/
15
4115
by: Colin J. Williams | last post by:
The distutils download page has: -------------------------------------------------------- Current stable release The current stable release is Distutils 1.0.2; you can download it as: * Distutils-1.0.2.tar.gz (source distribution) (233k) * Distutils-1.0.2.zip (source distribution) (274k) * Distutils-1.0.2.win32.exe (Windows installer) (187k)
1
1715
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 icon images by hand. I wrote "BuildImage" to do this for me, and so far, it works very well, so I'm trying to make it easier to use and available to more developers. There is a brief (and somewhat dated) tutorial explaining what BuildImage itself does at:
7
2299
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 on most systems: /usr/local/lib/python2.4/lib/site-packages/foo/bar.txt How do I figure out the rest, if I know foo/bar.txt? sys.prefix doesn't get me far. I've googled, and looked in the python reference. I must be blind if the
6
2341
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: # prmodule.c static PyObject *pr_isprime(PyObject *self, PyObject *args){ int n, input; if (!PyArg_ParseTuple(args, "i", &input))
1
1416
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 and treat them as standard source files. This results in huge cc.exe command lines and I get an error saying error: command 'cc' failed: Invalid argument under win32/mingw. (I am not quite sure this is the reason though.) How can I let setup.py build these boost libraries separately so that I
1
1374
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 boost). on windows i do something like this: imaging = Extension( 'pyag.imaging._imaging', sources = ( glob.glob( 'Source/pyag/imaging/Src/*.cpp' ) + glob.glob(
0
922
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 distutils.command.build_ext.py of python 2.4. (line147): if type(self.libraries) is StringType: self.libraries = though library_dirs for example gets split on ';' (line 156) elif type(self.library_dirs) is StringType:
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.