블로그 이미지
No pain, no gain!
lepoussin

Tag

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
  • total
  • today
  • yesterday
03-29 19:02
2007. 2. 6. 18:49 Language/Python

#   ifdef _DEBUG
#    pragma comment(lib,"python24.lib") <-- 수정
#   else
#    pragma comment(lib,"python24.lib")
#   endif /* _DEBUG */

그리고 다음 부분을 주석으로 처리하면 된다.

//#ifdef _DEBUG
//# define Py_DEBUG
//#endif

posted by lepoussin
2007. 2. 6. 18:45 Language/Python

SWIG 사용하기 위한 절차에서 C++ 컴파일을 이용한 build를 하게되면 아래와 같은 에러 발생하게 된다.

C:\Program Files\MinGW\bin\g++.exe -mno-cygwin -mdll -static --entry _DllMain@12
 --output-lib build\temp.win32-2.4\Release\lib_example.a --def build\temp.win32-
2.4\Release\_example.def -s build\temp.win32-2.4\Release\example_wrap.o -LC:\Pyt
hon24\libs -LC:\Python24\PCBuild -lpython24 -lmsvcr71 -o build\lib.win32-2.4\_ex
ample.pyd
g++: build\temp.win32-2.4\Release\lib_example.a: No such file or directory
error: command 'g++' failed with exit status 1

이런 에러를 막기 위해서는 C:\Python24\Lib\distutils\cygwinccompiler.py 파일의 아래 부분을 수정하면 된다.

# dllwrap uses different options than gcc/ld
if self.linker_dll == "dllwrap":
    extra_preargs.extend(["--output-lib", lib_file])
    # for dllwrap we have to use a special option
    extra_preargs.extend(["--def", def_file])

위 빨간색 부분을 주석 처리하면 에러를 제거시킬 수 있다.

posted by lepoussin
2007. 2. 6. 18:41 Language/Python

mingw32로 컴파일을 하기 위해서는

python setup.py build -cmingw32

위와 같이 옵션을 줘야 하나 C:\Python24\Lib\distutils\ccompiler.py 파일에서 아래 부분을 수정하면 편리하게 사용이 가능하다.

_default_compilers = (
    # Platform string mappings
    # on a cygwin built python we can use gcc like an ordinary UNIXish
    # compiler
    ('cygwin.*', 'unix'),
    ('os2emx', 'emx'),
    # OS name mappings
    ('posix', 'unix'),
    ('nt', 'msvc'),
    ('mac', 'mwerks'),
    )

msvc를 migw32로 변경하면 -c 옵션을 주지 않아도 자동적으로 mingw32로 컴파일을 하게 된다.

posted by lepoussin