Building pyodbc from tar doesn't include LDFLAGS - python-3.7

I am using a Mac M1 and python 3.7. I have both unixodbc and freetds installed for arm64 using homebrew. I want to use pyodbc to be able to connect to a relational database. I am installing it using pip install pyodbc==4.0.28 but the import fails with:
% venv/bin/python3 -c "import pyodbc"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(~/src/venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so, 0x0002): Library not loaded: '/usr/local/lib/libodbc.2.dylib'
Referenced from: '~/src/venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so'
Reason: tried: '/usr/local/lib/libodbc.2.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))), '/usr/lib/libodbc.2.dylib' (no such file), '/opt/homebrew/Cellar/unixodbc/2.3.11/lib/libodbc.2.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))), '/usr/lib/libodbc.2.dylib' (no such file)
The otool -L output shows:
% otool -L venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so
venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so:
/usr/local/lib/libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
I uninstalled pyodbc and installed using tar with CPPFLAGS and LDFLAGS set:
% CPPFLAGS="-I/opt/homebrew/Cellar/unixodbc/2.3.11/include" LDFLAGS="-L/opt/homebrew/Cellar/unixodbc/2.3.11/lib" venv/bin/pip install ~/Downloads/pyodbc-4.0.28.tar.gz
Processing ~/Downloads/pyodbc-4.0.28.tar.gz
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... done
Successfully installed pyodbc-4.0.28
WARNING: You are using pip version 21.3.1; however, version 22.3 is available.
You should consider upgrading via the '~/src/venv/bin/python3 -m pip install --upgrade pip' command.
But the otool -L output doesn't include the LDFLAGS library:
% otool -L venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so
venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
The import fails with another error now:
% venv/bin/python3 -c "import pyodbc"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(~/src/venv/lib/python3.7/site-packages/pyodbc.cpython-37m-darwin.so, 0x0002): symbol not found in flat namespace (_SQLAllocHandle)
Could anyone please help me understand the reason? Also, is there a way to include the library after the package pyodbc has been installed? Is there a way to verify that pyodbc indeed was built for arm64 and not x86-64.

Related

Scipy Import Error with a 'Symbol not found: __gfortran_stop_numeric_f08'

I am getting an error when trying to import scipy in my Python venv. The full terminal commands/outputs are below. You can see that the scipy package was already installed in another terminal session within this venv. The error appears to be with some gfortran data type and the system looking for it my Matlab directory. I don't know why this would be or how to fix it. I am on a Mac. I tried these same commands on my Linux machine (which also has Matlab installed) and it worked fine. Thanks in advance.
mshafer#Michaels-MacBook-Pro-2 ~ % python3.9 -m venv /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv
mshafer#Michaels-MacBook-Pro-2 ~ % source /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/bin/activate
(uavrt_venv) mshafer#Michaels-MacBook-Pro-2 ~ % python3 -m pip install scipy
Requirement already satisfied: scipy in ./Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages (1.9.3)
Requirement already satisfied: numpy<1.26.0,>=1.18.5 in ./Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages (from scipy) (1.23.5)
(uavrt_venv) mshafer#Michaels-MacBook-Pro-2 ~ % python3
Python 3.9.15 (main, Oct 11 2022, 22:27:25)
[Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import interpolate
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/__init__.py", line 211, in __getattr__
return _importlib.import_module(f'scipy.{name}')
File "/usr/local/Cellar/python#3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/interpolate/__init__.py", line 166, in <module>
from ._interpolate import *
File "/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py", line 11, in <module>
import scipy.special as spec
File "/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/special/__init__.py", line 649, in <module>
from . import _ufuncs
ImportError: dlopen(/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so, 0x0002): Symbol not found: __gfortran_stop_numeric_f08
Referenced from: /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so
Expected in: /Applications/MATLAB_R2022a.app/sys/os/maci64/libgfortran.3.dylib
This error is arising because an incorrect libgfortran is being loaded. scipy is distributed with a vendored version of libgfortran. However, for some reason a libgfortran sited in a Matlab directory is being loaded. These kinds of problems can be got to the bottom of, but it can be complicated as there are various ways that shared libraries can be loaded, and the user can change how that occurs as well.
What is the output of otool -L /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_venv/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so?
I would expect this to be something like:
scipy/special/_ufuncs.cpython-310-darwin.so:
#loader_path/../.dylibs/libopenblasp-r0.3.20.dylib (compatibility version 0.0.0, current version 0.0.0)
#loader_path/../.dylibs/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
This means that the dlopen call should go up a directory, down into .dylibs (which is where the vendored libraries are placed), then load libgfortran from there.
Have you set the LD_LIBRARY_PATH variable?
How was Python installed?

How can I import libraries in PythonAnywhere and use them in a Python notebook?

I'm both updating and installing packages/libaries, but are only able to use them through the Python3.6 console.
10:40 ~ $ pip3.6 install -U --user scikit-learn
Requirement already up-to-date: scikit-learn in ./.local/lib/python3.6/site-packages
Requirement already up-to-date: numpy>=1.11.0 in ./.local/lib/python3.6/site-packages (from scikit-learn)
Requirement already up-to-date: joblib>=0.11 in ./.local/lib/python3.6/site-packages (from scikit-learn)
Requirement already up-to-date: scipy>=0.17.0 in ./.local/lib/python3.6/site-packages (from scikit-learn)
When using pip install it fails with :
10:40 ~ $ pip install -U --user scikit-learn
Collecting scikit-learn
Using cached https://files.pythonhosted.org/packages/18/28/5a48b00599b476875415b97bdfdb3849bafb31183c1d785501dbc8a77aa2/scikit-learn-0.22.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-JYw8w1/scikit-learn/setup.py", line 47, in <module>
import sklearn
File "sklearn/__init__.py", line 81, in <module>
from . import __check_build # noqa: F401
File "sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named _check_build
___________________________________________________________________________
Contents of sklearn/__check_build:
__init__.py _check_build.pyx __init__.pyc
setup.py
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JYw8w1/scikit-learn/
If you've installed a package using pip3.6, make sure that your kernel version for your notebook is 3.6 -- if it's (say) 3.7, then it won't work, because each version of Python has its own separate set of installed modules.
I imported the notebook, and forgot to change Kernel Python3.6. It was still on Python3. Changed notebook to 3.6, and the it used the updated libary's-
When you run pip on PythonAnywhere, outside virtual environment, it installs packages for python2. The latest version of scikit-learn to work with python2 is 0.20.4. So, install it with pip install scikit-learn==0.20.4
You tried to install 0.22.1 with python2.

How to install PySide2 in a Python3 virtual environment on Raspberry Pi3

I am having a hard time installing PySide2 in a Python3 virtual enviroment on a Raspberry Pi3. I use Python-3.5.3 and the updated version of pip.
(cv3) pi#raspberrypi:~ $ which cmake
/usr/bin/cmake
(cv3) pi#raspberrypi:~ $ which qmake
/usr/bin/qmake
(cv3) pi#raspberrypi:~ $ which python
/home/pi/.virtualenvs/cv3/bin/python
(cv3) pi#raspberrypi:~ $ python --version
Python 3.5.3
(cv3) pi#raspberrypi:~ $ pip --version
pip 19.0.1 from /home/pi/.virtualenvs/cv3/lib/python3.5/site-packages/pip (python 3.5)
(cv3) pi#raspberrypi:~ $ pip3 --version
pip 19.0.1 from /home/pi/.virtualenvs/cv3/lib/python3.5/site-packages/pip (python 3.5)
First I tried to install with pip install PySide2 but I got the error
(cv3) pi#raspberrypi:~ $ pip install PySide2
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PySide2
Could not find a version that satisfies the requirement PySide2 (from versions: )
No matching distribution found for PySide2
Following the instructions found at https://wiki.qt.io/Qt_for_Python/GettingStarted on how to install via the official release wheels of Qt for Python also gives an error.
(cv3) pi#raspberrypi:~ $ pip install --index-url=https://download.qt.io/official_releases/QtForPython/ pyside2 --trusted-host download.qt.io
Looking in indexes: https://download.qt.io/official_releases/QtForPython/, https://www.piwheels.org/simple
Collecting pyside2
Could not find a version that satisfies the requirement pyside2 (from versions: )
No matching distribution found for pyside2
Then I followed the instructions on the official package site https://pypi.org/project/PySide2/. I installed the dependencies, including libclang and build from source as suggested without any errors.
git clone https://code.qt.io/pyside/pyside-setup
cd pyside-setup
git branch --track 5.12 origin/5.12
git checkout 5.12
python setup.py install --qmake=</usr/bin/qmake/> --parallel=8 --build-tests
Yet after all this work, there are no signs of the module PySide2
(cv3) pi#raspberrypi:~/pyside-setup $ python
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySide2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'PySide2'
>>>
Next thing I followed the instructions found on https://wiki.qt.io/Qt_for_Python/GettingStarted/X11. I clone the official repository, checked the versions are fine and then build using the qmake path /opt/Qt5.12/bin/qmake:
(cv3) pi#raspberrypi:~/pyside-setup $ python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git
and the build gave two errors:
CMake Error at CMakeLists.txt:95 (message):
Unable to detect CLANG location by checking LLVM_INSTALL_DIR, CLANG_INSTALL_DIR or running llvm-config.
-- Configuring incomplete, errors occurred!
See also "/home/pi/pyside-setup/cv33_build/py3.5-qt5.12.0-32bit-release/shiboken2/CMakeFiles/CMakeOutput.log".
error: Error configuring shiboken2
I guessed perhaps updating CLANG and CMAKE will make a change. So I did the update to the latest version and the process went well without errors. Then I
While building PySide2 the process exits at 47% with the following error:
[ 47%] Linking CXX executable shiboken2
/home/pi/libclang/lib/libclang.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
generator/CMakeFiles/shiboken2.dir/build.make:181: set di istruzioni per l'obiettivo "generator/shiboken2" non riuscito
make[2]: *** [generator/shiboken2] Errore 1
CMakeFiles/Makefile2:2877: set di istruzioni per l'obiettivo "generator/CMakeFiles/shiboken2.dir/all" non riuscito
make[1]: *** [generator/CMakeFiles/shiboken2.dir/all] Errore 2
Makefile:140: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
error: Error compiling shiboken2
Traceback (most recent call last):
File "setup.py", line 296, in <module>
setup_runner.run_setup()
File "/home/pi/pyside-setup/build_scripts/setup_runner.py", line 157, in run_setup
raise RuntimeError(msg)
RuntimeError:
setup.py invocation failed with exit code: 1.
setup.py invocation was: /home/pi/.virtualenvs/cv3/bin/python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git --internal-build-type=shiboken2
Where is the problem?
As the version of the installed CLANG was out of date, I tried with updating it first by following the instructions found on codepool.biz. No problems arised.
Then again I pointed the LLVM and CLANG libraries to the PySide2 installation path with
export CLANG_INSTALL_DIR=/usr/local/clang_7.0.
export LLVM_INSTALL_DIR=/usr/local/clang_7.0.0
The build process successfully passed the 47% percent treeshold and finished bulding shiboken2 but got stuck at the PySide2 step at 2%. The error:
[ 2%] Built target pyside2
Makefile:140: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
error: Error compiling pyside2
Traceback (most recent call last):
File "setup.py", line 296, in <module>
setup_runner.run_setup()
File "/home/pi/pyside-setup/build_scripts/setup_runner.py", line 157, in run_setup
raise RuntimeError(msg)
RuntimeError:
setup.py invocation failed with exit code: 1.
setup.py invocation was: /home/pi/.virtualenvs/cv3/bin/python setup.py build --qmake=/opt/Qt5.12/bin/qmake --parallel=4 --build-tests --ignore-git --internal-build-type=pyside2
What is going on?

orange add-ons error Orange3-Text 0.1.9

my orange version 3.3
i installed all add-ons but when i want to install Orange3-Text 0.1.9
(i have xcode and python-3.4.4-macosx10.6)
An error occurred while running a subprocess
Command failed: python -m pip install
Orange3-Text exited with non zero status.
Show Details
Collecting Orange3-Text
Using cached Orange3-Text-0.1.10.tar.gz
Collecting gensim>=0.12.3 (from Orange3-Text)
Using cached gensim-0.12.4-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting nltk (from Orange3-Text)
Using cached nltk-3.2.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): numpy in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Requirement already satisfied (use --upgrade to upgrade): scikit-learn in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Requirement already satisfied (use --upgrade to upgrade): scipy in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from Orange3-Text)
Collecting setuptools-git (from Orange3-Text)
Using cached setuptools-git-1.1.tar.gz
Collecting smart-open>=1.2.1 (from gensim>=0.12.3->Orange3-Text)
Using cached smart_open-1.3.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.0 in /Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from gensim>=0.12.3->Orange3-Text)
Collecting boto>=2.32 (from smart-open>=1.2.1->gensim>=0.12.3->Orange3-Text)
Using cached boto-2.39.0-py2.py3-none-any.whl
Collecting httpretty==0.8.10 (from smart-open>=1.2.1->gensim>=0.12.3->Orange3-Text)
Using cached httpretty-0.8.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 86, in <module>
version=read_version(),
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 46, in read_version
finder.visit(ast.parse(local_file('httpretty', '__init__.py')))
File "/private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty/setup.py", line 78, in <lambda>
open(os.path.join(os.path.dirname(__file__), *f)).read()
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 133: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/75/kxgr97zd7kggxsp8r0v12tph0000gn/T/pip-build-a9iyny1h/httpretty
You are using pip version 7.1.2, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
We are well aware of this problem and are currently trying to resolve it with authors of smart_open (which we require through gensim - one of our dependencies). The problem occurs since gensim cannot be installed with environment variable LC_ALL=C which is how we install add-ons. Currently, I would suggest to install it through the terminal. On a Mac this can be done by going to Orange's installation folder and running the pip install:
cd /Applications/Orange3.app/Contents/MacOS
./pip install Orange3-Text
Beware that Orange3-Text is still in development and some major changes are coming through the summer. So if you encounter any issues, please report them on our issue tracker.

How do you install perl DBD::Oracle on OSX Snow Leopard 10.6

I'm trying to connect to Oracle 10.2.0.4 on a remote system from my intel mac running OSX 10.6 snow leopard. I've tried using perl CPAN to install DBD::Oracle (DBI worked ok) but get compilation errors. Could someone provide an easy to follow guide?
Getting a mac install of perl to play nicely with oracle is a bit of a pain - once it's running it is fantastic, getting it running is a little frustrating..
The below has worked for me on a few different intel macs, there could well be superfluous steps in there and it is likely not going to be the same for other platforms.
This will require use of shell, the root user and a bit of CPANing - nothing too onerous
First off create a directory for the oracle pap - libraries, instant client etc
sudo mkdir /usr/oracle_instantClient64
Download and extract all 64 bit instant client packages from oracle to the above directory
Create a symlink within that directory for one of the files in there
sudo cd /usr/oracle_instantClient64
sudo ln -s /usr/oracle_instantClient64/libclntsh.dylib.10.1 libclntsh.dylib
The following dir is hardcoded into the oracle instant client - god knows why - so need to create and symlink it
sudo mkdir -p /b/227/rdbms/
sudo cd /b/227/rdbms/
sudo ln -s /usr/oracle_instantClient64/ lib
Need to add a couple of environment variables, so edit /etc/profile and add them so they exist for all users:
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
Now try and install DBD::Oracle through CPAN - this will fail, but it means any dependencies will be downloaded and it retrieves the module for us
sudo perl -MCPAN -e shell
install DBD::Oracle
When this fails exit CPAN and head to your .cpan/build dir - if you used automatic config of CPAN it'll be
cd ~/.cpan/build
if you didn't auto configure you can find your build directory with the following command in CPAN
o conf build_dir
Once in the build dir look for the DBD::Oracle dir which has just been created (it'll be called something like DBD-Oracle-1.28-?) and cd into it.
Now we need to switch to the root user. Root isn't enabled as default in osx - for details on enabling see this post on the apple website
Once logged in as root we need to set the above environment variables for root:
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
Now while still logged in as root we need to run the makefile for the module, then make, then install
perl Makefile.pl
make
make install
Assuming that all worked without error log out of root: we're DBD'd up! If this didn't work it's time to bust out google on whatever errors you're seeing
Now just to install the DBI module
sudo perl -MCPAN -e shell
install DBI
Now you're all set - enjoy your perly oracley new life
Additional info from user852637:
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile created after the perl Makefile.pl step and remove all occurrences of the following text :
-arch ppc
It looks with the XCode4 change (removal of PPC arch support) the Perl installation was not updated in any of the 10.6.X updates to also remove PPC binaries (probably because Rosetta is still present).
Because of this, the configuration files retain "-arch ppc" causing all CPAN module compiles with C libraries to fail because MakeMaker's output Makefile contains -arch ppc.
To fix this one can edit the following file:
/System/Library/Perl/5.10.0/darwin-thread-multi-2level/Config_heavy.pl
at line 1219 you'll see:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386 -arch ppc';
change that to:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386';
Once you do this the generated Makefile will be correct.
These are a great set of instructions. I have a few other comments about potential "gotchas".
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile created after the perl Makefile.pl step and remove all occurrences of the following text :
-arch ppc
It seems as though the "Perl MakeFile.pl" command is not finding the version of Perl correctly and I get this error message:
bash-3.2# perl Makefile.PL
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 37
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Configuring DBD::Oracle for perl 5.010000 on darwin (darwin-thread-multi-2level)
Remember to actually *READ* the README file! Especially if you have any problems.
Installing on a darwin, Ver#10.0
Using Oracle in /usr/oracle_instantClient64
Can't find sqlplus. Pity, it would have helped.
I'm having trouble finding your Oracle version number... trying harder
WARNING: I could not determine Oracle client version so I'll just
default to version 8.0.0.0. Some features of DBD::Oracle may not work.
Oracle version based logic in Makefile.PL may produce erroneous results.
You can use "perl Makefile.PL -V X.Y.Z" to specify a your client version.
Oracle version 8.0.0.0 (8.0)
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 175.
I've triple checked that I've downloaded and installed the proper 64-bit drivers from Oracle. I also checked to make sure that I'm running 64-bit Perl.
If I force the version number like this:
perl MakeFile.pl -V 10.2.0.4
It completes, but I receive the error message when running "make":
Oracle.c:2267: error: ‘SQLT_BIN’ undeclared (first use in this function)
Oracle.c:2277: error: ‘SQLCS_NCHAR’ undeclared (first use in this function)
Oracle.c:2281: error: ‘SQLT_INT’ undeclared (first use in this function)
Oracle.c:2283: error: ‘OCI_FETCH_PRIOR’ undeclared (first use in this function)
Oracle.c:2287: error: ‘OCI_FETCH_NEXT’ undeclared (first use in this function)
lipo: can't open input file: /var/tmp//ccyIFLPN.out (No such file or directory)
make: *** [Oracle.o] Error 1
I realize this is because of the "-arch ppc" argument that needs to be removed from Makefile, but even after removal the removal of all 32-bit references, I still saw the error message.
Running 10.6.8 Snow Leopard with Oracle Driver version 10.2.0.4
I found that the key to this issue was making sure that MakeFile.pl could find the Oracle version.
The problem I ran into was that Safari was downloading the zip files from Oracle.com, but unzipping them and somehow corrupting the library.
Instead, I used a different browser and downloaded all the zip files into one directory. Then I ran the following tar commands:
tar -xf instantclient-basic-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sdk-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sqlplus-10.2.0.4.0-macosx-x64.zip
The copy all the contents in the folder "instantclient_10_2" to $ORACLE_HOME (set previously)
sudo cp -R instantclient_10_2/* $ORACLE_HOME
Also, I did not need to edit the Makefile generated by the MakeFile.pl script to remove the "-arch ppc" references.
You should not recreate on your machine the same directory structure as of the client libraries packager.
Don't do mkdir -p /b/227/rdbms/
Use MacOSX library header management tools: otool and install_name_tool
For instance, I have updated the library headers to my deployment architecture:
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
install_name_tool -id /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 \
-change /ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
Check all files that come with the Oracle instantclient libraries and fix the path of all dependent libs
otool -L adrci
otool -L genezi
otool -L libclntsh.dylib.11.1
otool -L libheteroxa11.dylib
otool -L libnnz11.dylib
otool -L libocci.dylib.11.1
otool -L libociei.dylib
otool -L libocijdbc11.dylib
otool -L libsqlplus.dylib
otool -L libsqlplusic.dylib
otool -L sqlplus
otool -L uidrvci
Then, you link your dynamic libraries to the place they're supposed to be.
And you can avoid using that export DYLD_LIBRARY_PATH because you know how to setup your system
cd /usr/lib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 libclntsh.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libheteroxa11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 libocci.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libociei.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocijdbc11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplus.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplusic.dylib .