Hi, I'm working to port a python module from Unix to Windows under cygwin. I've made enough changes that there are no compilation errors and the DLLl file gets built, but python generates an error message when loading it:
$ python Python 2.2.2 (#1, Mar 9 2003, 08:18:26) [GCC 3.2 20020927 (prerelease)] on cygwin Type "help", "copyright", "credits" or "license" for more information.
import _rpy.dll Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: dlopen: Win32 error 193
I built the package under
$ uname -a CYGWIN_NT-5.0 GRDGROL780DCZZ 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin
$ python setup.py build
running build running build_py creating build creating build/lib.cygwin-1.3.22-i686-2.2 copying rpy.py -> build/lib.cygwin-1.3.22-i686-2.2 copying io.py -> build/lib.cygwin-1.3.22-i686-2.2 running build_ext building '_rpy' extension creating build/temp.cygwin-1.3.22-i686-2.2 gcc -DNDEBUG -DUSE_DL_IMPORT -UPRE_2_2 -UWITH_NUMERIC -IC:/Progra~1/R/rw1062/src/include -I/home/warneg/src/R-1.6.2/src/include -Isrc -I/usr/include/python2.2 -c src/rpymodule.c -o build/temp.cygwin-1.3.22-i686-2.2/rpymodule.o [.. more compilation lines ommitted ..] gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.3.22-i686-2.2/rpymodule.o build/temp.cygwin-1.3.22-i686-2.2/R_eval.o build/temp.cygwin-1.3.22-i686-2.2/io.o build/temp.cygwin-1.3.22-i686-2.2/setenv.o -LC:/Progra~1/R/rw1062/bin -LC:/rpy/bin -L/usr/lib/python2.2/config -lR -lpython2.2 -o build/lib.cygwin-1.3.22-i686-2.2/_rpy.dll Info: resolving _R_NilValue by linking to __imp__R_NilValue (auto-import) Info: resolving _R_NamesSymbol by linking to __imp__R_NamesSymbol (auto-import) Info: resolving _R_LevelsSymbol by linking to __imp__R_LevelsSymbol (auto-import) Info: resolving _R_DimSymbol by linking to __imp__R_DimSymbol (auto-import) Info: resolving _R_ClassSymbol by linking to __imp__R_ClassSymbol (auto-import) Info: resolving _R_GlobalEnv by linking to __imp__R_GlobalEnv (auto-import) Info: resolving _R_UnboundValue by linking to __imp__R_UnboundValue (auto-import)
I'm not very familiar with programming under Cygwin. Can someone suggest how to determine exactly what the problem is?
LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
On Sat, Mar 29, 2003 at 04:20:57PM -0500, Warnes, Gregory R wrote:
import _rpy.dll Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: dlopen: Win32 error 193 ^^^^^^^^^^^^^^^
It appears you built a "bad" shared extension module (i.e., DLL):
$ fgrep 193L /usr/include/w32api/winerror.h #define ERROR_BAD_EXE_FORMAT 193L
gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.3.22-i686-2.2/rpymodule.o build/temp.cygwin-1.3.22-i686-2.2/R_eval.o build/temp.cygwin-1.3.22-i686-2.2/io.o build/temp.cygwin-1.3.22-i686-2.2/setenv.o -LC:/Progra~1/R/rw1062/bin ^^^^^^^^^^^^^^^^^^^^^^^^^^ -LC:/rpy/bin -L/usr/lib/python2.2/config -lR -lpython2.2 -o ^^^^^^^^^^^^ ^^^
The above raises the following questions/issues:
Are you linking directly against the DLL (i.e., R.dll) or the import library (i.e., R.dll.a or R.a)? Since the flagged -L options above end in "bin", I'm concerned that it's the former. If my WAG is correct, then linking against the import library may solve your problem. Note that you should only link directly against DLLs as a last resort.
You should use Posix style paths in Cygwin. Note that this is not causing your problem, but I find the Win32 style paths aesthetically unpleasing. :,)
-- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6