pymssql / pymssql

Official home for the pymssql source code.
https://pymssql.readthedocs.io/en/latest/
GNU Lesser General Public License v2.1
836 stars 310 forks source link

Can't compile on OS X 10.8.4 #129

Closed pymssql-issue-migrator closed 11 years ago

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 01, 2013 16:05:54

I got latest (pymssql-2.0.0b1-dev-20130403).

Here's the fatal error:

_mssql.c:257:10: fatal error: 'sqlfront.h' file not found

Full trace:

mark@macpro:pymssql-2.0.0b1-dev-20130403# python setup.py install Compiling module Cython.Plex.Scanners ... Compiling module Cython.Plex.Actions ... Compiling module Cython.Compiler.Lexicon ... Compiling module Cython.Compiler.Scanning ... Compiling module Cython.Compiler.Parsing ... Compiling module Cython.Compiler.Visitor ... Compiling module Cython.Compiler.FlowControl ... Compiling module Cython.Compiler.Code ... Compiling module Cython.Runtime.refnanny ... warning: no files found matching '.pyx' under directory 'Cython/Debugger/Tests' warning: no files found matching '.pxd' under directory 'Cython/Debugger/Tests' warning: no files found matching '.h' under directory 'Cython/Debugger/Tests' warning: no files found matching '.pxd' under directory 'Cython/Utility' /var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/easy_install-M9_3dW/Cython-0.19.1/Cython/Compiler/Code.c:50081:19: warning: expression result unused [-Wunused-value] PyObject_INIT(o, t); ^ /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7/objimpl.h:164:69: note: expanded from macro 'PyObject_INIT' ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) ^ 1 warning generated.

Installed /Users/mark/pymssql-2.0.0b1-dev-20130403/Cython-0.19.1-py2.7-macosx-10.8-x86_64.egg creating var creating var/folders creating var/folders/hn creating var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn creating var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T cc -arch x86_64 -c /var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/clock_gettimeOd2mcR.c -o var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/clock_gettimeOd2mcR.o /var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/clock_gettimeOd2mcR.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main (int argc, char **argv) { ^~~~ /var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/clock_gettimeOd2mcR.c:2:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration] clock_gettime(); ^ 2 warnings generated. cc -arch x86_64 var/folders/hn/40d_ql_d21n4kg32cc0sd5p40000gn/T/clock_gettimeOd2mcR.o -lrt -o a.out ld: library not found for -lrt clang: error: linker command failed with exit code 1 (use -v to see invocation) running install running bdist_egg running egg_info writing pymssql.egg-info/PKG-INFO writing top-level names to pymssql.egg-info/top_level.txt writing dependency_links to pymssql.egg-info/dependency_links.txt reading manifest file 'pymssql.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'win32/freetds.zip' writing manifest file 'pymssql.egg-info/SOURCES.txt' installing library code to build/bdist.macosx-10.8-x86_64/egg running install_lib running build_ext skipping '_mssql.c' Cython extension (up-to-date) building '_mssql' extension creating build creating build/temp.macosx-10.8-x86_64-2.7 cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mssql.c -o build/temp.macosx-10.8-x86_64-2.7/_mssql.o -Wno-parentheses-equality -DMSDBLIB _mssql.c:257:10: fatal error: 'sqlfront.h' file not found

include "sqlfront.h"

     ^

1 error generated. error: command 'cc' failed with exit status 1

Original issue: http://code.google.com/p/pymssql/issues/detail?id=125

pymssql-issue-migrator commented 11 years ago

From msabr...@gmail.com on September 02, 2013 12:05:21

This means that you need to install FreeTDS.

This is easily done on a Mac with:

You can also compile it from scratch if you don't use a package manager. Make sure to run ./configure with --enable-msdblib so that you don't get dates that are off by 1 month.

Status: WontFix
Owner: msabr...@gmail.com

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 02, 2013 12:25:13

Is there a different mirror I can use? I tried brew install freetds and get an HTTP 400:

curl: (22) The requested URL returned error: 400 Error: Download failed: http://mirrors.ibiblio.org/freetds/stable/freetds-0.91.tar.gz

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 02, 2013 12:30:23

Downloading the source from http://mirrors.ibiblio.org/freetds/stable/freetds-0.91.tar.gz and doing ./configure --enable-msdblib allowed pip install pymssql to build and install successfully. Thank you!!

pymssql-issue-migrator commented 11 years ago

From msabr...@gmail.com on September 10, 2013 22:18:04

Reopening, because I think that we could add code to setup.py to print some useful info about how to install FreeTDS, kind of like I did with FreeBSD (see https://code.google.com/p/pymssql/issues/detail?id=97#c12 )

Status: Accepted

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 11, 2013 04:51:47

Good call. Please let me know if I may be of assistance in testing this change.

pymssql-issue-migrator commented 11 years ago

From msabr...@gmail.com on September 18, 2013 22:44:27

Committed this change to add some helpful tips for installing FreeTDS on OS X.

@markarichman, let me know what you think.

Status: Fixed

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 19, 2013 05:53:38

I don't see the change. I'm looking here: https://code.google.com/p/pymssql/source/list Sorry, new to Google Code.

pymssql-issue-migrator commented 11 years ago

From msabr...@gmail.com on September 19, 2013 07:51:22

@markarichman,

Oops, I forgot to post the link to the change. Note that we recently moved the source code repo from Google Code (Mercurial) to GitHub. https://github.com/pymssql/pymssql/commit/5fddb67623b3f5b64d7cf3804105656861754b29 Let me know if that change would've made installing pymssql on OS X easier for you.

Though I'm now starting to come back to the idea of bundling FreeTDS, since FreeTDS by default builds without --enable-msdblib, which can lead to problems with dates (see https://code.google.com/p/pymssql/wiki/FreeTDSAndDates )

pymssql-issue-migrator commented 11 years ago

From markaric...@gmail.com on September 19, 2013 08:19:52

Ah yes! Sorry didn't know we switched to GitHub. Yes that message is perfect! The "--enable-msdblib" was the missing magic I needed.

pymssql-issue-migrator commented 11 years ago

From msabr...@gmail.com on September 19, 2013 08:51:33

Cool!

Status: Verified

dkalaria commented 7 years ago

On Mac

cliffwildman commented 7 years ago

@dkalaria your comment just saved me a few hours. Thanks!

cuishuang commented 6 years ago

brew unlink freetds brew install freetds@0.91 brew link --force freetds@0.91 sudo pip install pymssql

erg commented 6 years ago

Still having this problem on macOS, none of these solutions worked anymore except this:

sudo pip3 install git+https://github.com/pymssql/pymssql.git

tenadolanter commented 5 years ago

brew unlink freetds brew install freetds@0.91 brew link --force freetds@0.91 // if error,run brew link --force --overwrite freetds@0.91 sudo pip install pymssql

Ctrlsman commented 4 years ago

download: http://mirrors.ibiblio.org/freetds/stable/freetds-0.91.tar.gz ./configure --enable-msdblib make && make install

sscarduzio commented 1 year ago

The only thing that worked is this on apple M1

  1. brew install freetds
  2. brew install openssl
  3. export LDFLAGS="-L/opt/homebrew/Cellar/freetds/1.3.3/lib -L/opt/homebrew/Cellar/openssl@1.1/1.1.1l_1/lib"
  4. export CFLAGS="-I/opt/homebrew/Cellar/freetds/1.3.3/include"
  5. pip install pymssql

(change the versions to your systems libraries versions)

max-pfeiffer commented 11 months ago

@sscarduzio Thanks for the hint. I am using Mac Ports: in this case you need to tweak the flags for the directories a bit:

export CFLAGS="-I/opt/local/include/freetds"
export LDFLAGS="-L/opt/local/lib/"
pip install pymssql==2.2.8 

This worked for on a M2 Mac.