tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Build problem on solaris with Sun compiler #179

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
pyodbc does not build on solaris with the Sun compiler.
I'm including some details about the problem and a diff showin what I did to 
make it compile.
Would it be possible to add this to get pyodbc to build with the sun compiler?

What steps will reproduce the problem?
1. set the CC/CXX environment variables to the Sun compiler.
2. set the CFLAGS/CXXFLAGS/LDFLAGS to "-m64"
3. python setyp.py.build

What is the expected output? What do you see instead?

output:
========
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.solaris-2.10-i86pc-2.7
creating build/temp.solaris-2.10-i86pc-2.7/slask
creating build/temp.solaris-2.10-i86pc-2.7/slask/epkmann
creating build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build
creating build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build/pyodbc-2.1.8
creating build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build/pyodbc-2.1.8/src
/proj/vau/devcs/products/3rd/cxx/12/_debug/solx86/bin/CC -DNDEBUG -O -m64 
-I/slask/epkmann/installed64/include -Kpic -DPYODBC_VERSION=2.1.8 
-I/slask/epkmann/installed64/include/python2.7 -c 
/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp -o 
build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.
o -Wno-write-strings
CC: Warning: Option -Wno-write-strings passed to ld, if ld is invoked, ignored 
otherwise
"/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp", line 44: Warning: String 
literal converted to char* in formal argument name in call to 
_PyObject_CallMethod_SizeT(_object*, char*, char*, ...).
"/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp", line 44: Warning: String 
literal converted to char* in formal argument format in call to 
_PyObject_CallMethod_SizeT(_object*, char*, char*, ...).
"/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp", line 49: Warning: String 
literal converted to char* in formal argument name in call to 
_PyObject_CallMethod_SizeT(_object*, char*, char*, ...).
"/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp", line 54: Warning: String 
literal converted to char* in formal argument name in call to 
_PyObject_CallMethod_SizeT(_object*, char*, char*, ...).
"/slask/epkmann/build/pyodbc-2.1.8/src/cnxninfo.cpp", line 59: Warning: String 
literal converted to char* in formal argument name in call to 
_PyObject_CallMethod_SizeT(_object*, char*, char*, ...).
5 Warning(s) detected.
/proj/vau/devcs/products/3rd/cxx/12/_debug/solx86/bin/CC -DNDEBUG -O -m64 
-I/slask/epkmann/installed64/include -Kpic -DPYODBC_VERSION=2.1.8 
-I/slask/epkmann/installed64/include/python2.7 -c 
/slask/epkmann/build/pyodbc-2.1.8/src/buffer.cpp -o 
build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build/pyodbc-2.1.8/src/buffer.o 
-Wno-write-strings
CC: Warning: Option -Wno-write-strings passed to ld, if ld is invoked, ignored 
otherwise
/proj/vau/devcs/products/3rd/cxx/12/_debug/solx86/bin/CC -DNDEBUG -O -m64 
-I/slask/epkmann/installed64/include -Kpic -DPYODBC_VERSION=2.1.8 
-I/slask/epkmann/installed64/include/python2.7 -c 
/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp -o 
build/temp.solaris-2.10-i86pc-2.7/slask/epkmann/build/pyodbc-2.1.8/src/cursor.o 
-Wno-write-strings
CC: Warning: Option -Wno-write-strings passed to ld, if ld is invoked, ignored 
otherwise
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 34: Warning: 
Identifier expected instead of "}".
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 278: Error: The 
function "_strlwr" must have a prototype.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 748: Error: The 
function "min" must have a prototype.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 764: Error: The 
function "min" must have a prototype.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1891: Warning: String 
literal converted to char* in initialization.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1892: Warning: String 
literal converted to char* in initialization.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1893: Warning: String 
literal converted to char* in initialization.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1894: Warning: String 
literal converted to char* in initialization.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1953: Warning: String 
literal converted to char* in initialization.
"/slask/epkmann/build/pyodbc-2.1.8/src/cursor.cpp", line 1953: Warning: String 
literal converted to char* in initialization.
3 Error(s) and 7 Warning(s) detected.
error: command '/proj/vau/devcs/products/3rd/cxx/12/_debug/solx86/bin/CC' 
failed with exit status 3

What version of the product are you using? On what operating system?
Pyodbc version: 2.1.8
% uname -a 
SunOS ws021-4 5.10 Generic_142901-04 i86pc i386 i86pc
% CC -V
CC: Sun C++ 5.9 SunOS_i386 Patch 124864-07 2008/08/22

Please provide any additional information below.

I did the following changes and got it to compile (git diff output):

--- a/src/getdata.cpp
+++ b/src/getdata.cpp
@@ -9,6 +9,7 @@
 #include "errors.h"
 #include "dbspecific.h"
 #include "sqlwchar.h"
+#include <alloca.h>

 void GetData_init()
 {
diff --git a/src/pyodbc.h b/src/pyodbc.h
index e49045b..cb6045b 100644
--- a/src/pyodbc.h
+++ b/src/pyodbc.h
@@ -103,7 +103,7 @@ inline void UNUSED(...) { }

 #include <stdarg.h>

-#if defined(__GNUC__) && !defined(__MINGW32__)
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) || (defined(__GNUC__) && 
!defined(__MINGW32__))
 #define CDECL cdecl
 #define min(X,Y) ((X) < (Y) ? (X) : (Y))
 #define max(X,Y) ((X) > (Y) ? (X) : (Y))

Original issue reported on code.google.com by mattias....@gmail.com on 27 May 2011 at 1:18

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 12 Jun 2011 at 5:29

GoogleCodeExporter commented 8 years ago
Thanks for the fixes. 

Checked into 2.1.9-beta16

Original comment by mkleehammer on 11 Jul 2011 at 12:34