Date: Wed, 15 Jun 2016 14:15:15 +0200 From: Erik Cederstrand <erik+lists@cederstrand.dk> To: freebsd-emulation@freebsd.org Subject: cx_Oracle on 64-bit FreeBSD, need help Message-ID: <23CF3D5D-93C0-4E19-A854-69A1D96B4DE6@cederstrand.dk>
next in thread | raw e-mail | index | archive | help
Hi, I'm trying to get the cx_Oracle Python package to run on 64-bit = 10.3-RELEASE. This has previously not been possible, so this is a first = attempt. cx_Oracle requires the Oracle instantclient libraries which are = only available for Linux. I have installed emulators/linux_base-c6 as = 64-bit. I installed a 64-bit Oracle instantclient SDK and installed a = libaio RPM from CentOS 6, and got to the point where "pip install = cx_Oracle" actually completes. But Python3.4 (with debug compiled in) = segfaults when I try to import the cx_Oracle module. Any suggestions = where to go from here? I'm thinking maybe the FreeBSD libc.so and the = Linux libc.so get mixed up? Here's the backtrace (I installed gdb from ports since stock gdb = couldn't handle the core file). I tried Python3.5 but got the same = backtrace. Line 95 in dynload_shlib.c is: handle =3D dlopen(pathname, dlopenflags); $ cat cx.py import cx_Oracle $ $ /usr/local/bin/gdb python3.4 GNU gdb (GDB) 7.11.1 [GDB v7.11.1 for FreeBSD] Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later = <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show = copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd10.3". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from python3.4...done. (gdb) run cx.py Starting program: /usr/local/bin/python3.4 cx.py Program received signal SIGSEGV, Segmentation fault. 0x0000000805f0dc8a in __strrchr_sse2 () from = /usr/local/oracle/instantclient_11_2/libc.so.6 (gdb) bt #0 0x0000000805f0dc8a in __strrchr_sse2 () from = /usr/local/oracle/instantclient_11_2/libc.so.6 #1 0x0000000805f737cb in __init_misc () from = /usr/local/oracle/instantclient_11_2/libc.so.6 #2 0x0000000805ea9c00 in _init () from = /usr/local/oracle/instantclient_11_2/libc.so.6 #3 0x0000000800605a9f in ?? () from /libexec/ld-elf.so.1 #4 0x000000080060a437 in ?? () from /libexec/ld-elf.so.1 #5 0x0000000800606ea0 in ?? () from /libexec/ld-elf.so.1 #6 0x0000000800eaf89e in _PyImport_GetDynLoadFunc = (shortname=3D0x80078b370 "cx_Oracle", pathname=3D0x800a7a8f0 = "/usr/local/lib/python3.4/site-packages/cx_Oracle.so", fp=3D0x0) at = ./Python/dynload_shlib.c:95 #7 0x0000000800e66389 in _PyImport_LoadDynamicModule (name=3D0x800a7b890,= path=3D0x8007a5170, fp=3D0x0) at ./Python/importdl.c:69 #8 0x0000000800e655b2 in _imp_load_dynamic_impl (module=3D0x8006e92d8, = name=3D0x800a7b890, path=3D0x8007a5170, file=3D0x0) at = Python/import.c:2271 #9 0x0000000800e6513d in _imp_load_dynamic (module=3D0x8006e92d8, = args=3D0x800a7f2f8) at Python/import.c:2247 #10 0x0000000800cfa8b8 in PyCFunction_Call (func=3D0x800713758, = arg=3D0x800a7f2f8, kw=3D0x800a7f288) at Objects/methodobject.c:93 #11 0x0000000800e32256 in ext_do_call (func=3D0x800713758, = pp_stack=3D0x7ffffffebe80, flags=3D3, na=3D0, nk=3D0) at = Python/ceval.c:4558 #12 0x0000000800e2a4b1 in PyEval_EvalFrameEx (f=3D0x8007c8838, = throwflag=3D0) at Python/ceval.c:2878 #13 0x0000000800e1778d in PyEval_EvalCodeEx (_co=3D0x8006c7040, = globals=3D0x8006ff838, locals=3D0x0, args=3D0x8024b1770, argcount=3D3, = kws=3D0x8024b1788, kwcount=3D0, defs=3D0x0, defcount=3D0, kwdefs=3D0x0, = closure=3D0x0) at Python/ceval.c:3588 #14 0x0000000800e343dd in fast_function (func=3D0x8007043f0, = pp_stack=3D0x7ffffffee560, n=3D3, na=3D3, nk=3D0) at Python/ceval.c:4344 #15 0x0000000800e3193b in call_function (pp_stack=3D0x7ffffffee560, = oparg=3D3) at Python/ceval.c:4262 #16 0x0000000800e29f80 in PyEval_EvalFrameEx (f=3D0x8024b15b8, = throwflag=3D0) at Python/ceval.c:2838 #17 0x0000000800e1778d in PyEval_EvalCodeEx (_co=3D0x8006ec100, = globals=3D0x8006ff838, locals=3D0x0, args=3D0x800a7bc50, argcount=3D2, = kws=3D0x80064f080, kwcount=3D0, defs=3D0x0, defcount=3D0, kwdefs=3D0x0, = closure=3D0x0) at Python/ceval.c:3588 #18 0x0000000800cc284c in function_call (func=3D0x80070f788, = arg=3D0x800a7bc28, kw=3D0x800a6f058) at Objects/funcobject.c:632 #19 0x0000000800c6e6ca in PyObject_Call (func=3D0x80070f788, = arg=3D0x800a7bc28, kw=3D0x800a6f058) at Objects/abstract.c:2058 #20 0x0000000800e32270 in ext_do_call (func=3D0x80070f788, = pp_stack=3D0x7fffffff0be0, flags=3D3, na=3D2, nk=3D0) at = Python/ceval.c:4561 #21 0x0000000800e2a4b1 in PyEval_EvalFrameEx (f=3D0x80247f238, = throwflag=3D0) at Python/ceval.c:2878 #22 0x0000000800e1778d in PyEval_EvalCodeEx (_co=3D0x8006c7580, = globals=3D0x8006ff838, locals=3D0x0, args=3D0x8024579d8, argcount=3D2, = kws=3D0x8024579e8, kwcount=3D0, defs=3D0x80070d700, defcount=3D1, = kwdefs=3D0x0, closure=3D0x80070d670) at Python/ceval.c:3588 #23 0x0000000800e343dd in fast_function (func=3D0x80070f840, = pp_stack=3D0x7fffffff32c0, n=3D2, na=3D2, nk=3D0) at Python/ceval.c:4344 #24 0x0000000800e3193b in call_function (pp_stack=3D0x7fffffff32c0, = oparg=3D1) at Python/ceval.c:4262 #25 0x0000000800e29f80 in PyEval_EvalFrameEx (f=3D0x802457838, = throwflag=3D0) at Python/ceval.c:2838 #26 0x0000000800e34245 in fast_function (func=3D0x800705eb8, = pp_stack=3D0x7fffffff5710, n=3D1, na=3D1, nk=3D0) at Python/ceval.c:4334 #27 0x0000000800e3193b in call_function (pp_stack=3D0x7fffffff5710, = oparg=3D0) at Python/ceval.c:4262 #28 0x0000000800e29f80 in PyEval_EvalFrameEx (f=3D0x8024b8b38, = throwflag=3D0) at Python/ceval.c:2838 #29 0x0000000800e34245 in fast_function (func=3D0x800705f70, = pp_stack=3D0x7fffffff7b60, n=3D1, na=3D1, nk=3D0) at Python/ceval.c:4334 #30 0x0000000800e3193b in call_function (pp_stack=3D0x7fffffff7b60, = oparg=3D0) at Python/ceval.c:4262 #31 0x0000000800e29f80 in PyEval_EvalFrameEx (f=3D0x80245db38, = throwflag=3D0) at Python/ceval.c:2838 #32 0x0000000800e34245 in fast_function (func=3D0x8007146d0, = pp_stack=3D0x7fffffff9fb0, n=3D2, na=3D2, nk=3D0) at Python/ceval.c:4334 #33 0x0000000800e3193b in call_function (pp_stack=3D0x7fffffff9fb0, = oparg=3D2) at Python/ceval.c:4262 #34 0x0000000800e29f80 in PyEval_EvalFrameEx (f=3D0x8024b88b8, = throwflag=3D0) at Python/ceval.c:2838 #35 0x0000000800e1778d in PyEval_EvalCodeEx (_co=3D0x8006f8b80, = globals=3D0x8006ff838, locals=3D0x0, args=3D0x8007a6080, argcount=3D2, = kws=3D0x0, kwcount=3D0, defs=3D0x0, defcount=3D0, kwdefs=3D0x0, = closure=3D0x0) at Python/ceval.c:3588 #36 0x0000000800cc284c in function_call (func=3D0x800714788, = arg=3D0x8007a6058, kw=3D0x0) at Objects/funcobject.c:632 #37 0x0000000800c6e6ca in PyObject_Call (func=3D0x800714788, = arg=3D0x8007a6058, kw=3D0x0) at Objects/abstract.c:2058 #38 0x0000000800c6fc5e in _PyObject_CallMethodIdObjArgs = (callable=3D0x800714788, name=3D0x8011f6ad8 = <PyImport_ImportModuleLevelObject.PyId__find_and_load>) at = Objects/abstract.c:2328 #39 0x0000000800e638d1 in PyImport_ImportModuleLevelObject = (name=3D0x800a7b890, given_globals=3D0x800735f38, locals=3D0x800735f38, = given_fromlist=3D0x8011d1ae0 <_Py_NoneStruct>, level=3D0) at = Python/import.c:1641 #40 0x0000000800e0cb57 in builtin___import__ (self=3D0x800692358, = args=3D0x8006b88d8, kwds=3D0x0) at Python/bltinmodule.c:210 #41 0x0000000800cfa923 in PyCFunction_Call (func=3D0x8006942f8, = arg=3D0x8006b88d8, kw=3D0x0) at Objects/methodobject.c:99 #42 0x0000000800c6e6ca in PyObject_Call (func=3D0x8006942f8, = arg=3D0x8006b88d8, kw=3D0x0) at Objects/abstract.c:2058 #43 0x0000000800e30133 in PyEval_CallObjectWithKeywords = (func=3D0x8006942f8, arg=3D0x8006b88d8, kw=3D0x0) at Python/ceval.c:4114 #44 0x0000000800e26bf5 in PyEval_EvalFrameEx (f=3D0x8024b1338, = throwflag=3D0) at Python/ceval.c:2478 #45 0x0000000800e1778d in PyEval_EvalCodeEx (_co=3D0x800792b80, = globals=3D0x800735f38, locals=3D0x800735f38, args=3D0x0, argcount=3D0, = kws=3D0x0, kwcount=3D0, defs=3D0x0, defcount=3D0, kwdefs=3D0x0, = closure=3D0x0) at Python/ceval.c:3588 #46 0x0000000800e16415 in PyEval_EvalCode (co=3D0x800792b80, = globals=3D0x800735f38, locals=3D0x800735f38) at Python/ceval.c:775 #47 0x0000000800e7e62f in run_mod (mod=3D0x80259a0a8, = filename=3D0x800a6c588, globals=3D0x800735f38, locals=3D0x800735f38, = flags=3D0x7fffffffe918, arena=3D0x8025001b0) at Python/pythonrun.c:2175 #48 0x0000000800e7f060 in PyRun_FileExFlags (fp=3D0x801c20170, = filename_str=3D0x80075d598 "cx.py", start=3D257, globals=3D0x800735f38, = locals=3D0x800735f38, closeit=3D1, flags=3D0x7fffffffe918) at = Python/pythonrun.c:2128 #49 0x0000000800e7da6f in PyRun_SimpleFileExFlags (fp=3D0x801c20170, = filename=3D0x80075d598 "cx.py", closeit=3D1, flags=3D0x7fffffffe918) at = Python/pythonrun.c:1601 #50 0x0000000800e7d1d4 in PyRun_AnyFileExFlags (fp=3D0x801c20170, = filename=3D0x80075d598 "cx.py", closeit=3D1, flags=3D0x7fffffffe918) at = Python/pythonrun.c:1287 #51 0x0000000800eb4e46 in run_file (fp=3D0x801c20170, = filename=3D0x802416110 L"cx.py", p_cf=3D0x7fffffffe918) at = Modules/main.c:319 #52 0x0000000800eb3a77 in Py_Main (argc=3D2, argv=3D0x802416090) at = Modules/main.c:751 #53 0x0000000000400cbe in main (argc=3D2, argv=3D0x7fffffffea48) at = ./Modules/python.c:69 (gdb) If I remove LD_LIBRARY_PATH from my environment, I get: Traceback (most recent call last): File "cx.py", line 1, in <module> import cx_Oracle ImportError: Shared object "libclntsh.so.11.1" not found, required by = "cx_Oracle.so" And here are my notes on the installation attempt: # /etc/rc.conf # linux64_enable=3D"YES" # /etc/make.conf # OVERRIDE_LINUX_BASE_PORT=3Dc6_64 # OVERRIDE_LINUX_NONBASE_PORTS=3Dc6_64 # kldload linux64 # cd /usr/ports/emulators/linux_base-c6 & make install clean # download 64-bit basic & sdk client for Linux from = http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html and = place in /usr/ports/distfiles/oracle/ # mkdir /usr/local/oracle # cd /usr/local/oracle # unzip = /usr/ports/distfiles/oracle/instantclient-sdk-linux.x64-11.2.0.4.0.zip # unzip = /usr/ports/distfiles/oracle/instantclient-basic-linux.x64-11.2.0.4.0.zip # export ORACLE_HOME=3D"/usr/local/oracle/instantclient_11_2" # export = LD_LIBRARY_PATH=3D"/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pk= g:${ORACLE_HOME}" # export PATH=3D"${PATH}:${ORACLE_HOME}" # cd /usr/local/oracle/instantclient_11_2 # cp -a libclntsh.so.11.2 libclntsh.so # brandelf -t FreeBSD libclntsh.so # cp -a libocci.so.11.2 libocci.so # brandelf -t FreeBSD libocci.so # cd /tmp # Download libaio.so.1 for CentOS 6 (64bit) from somewhere, e.g. an RPM = https://www.rpmfind.net/linux/rpm2html/search.php?query=3Dlibaio.so.1()(64= bit) # Extract the RPM (tar -zxvf libaio-0.3.107-10.el6.x86_64.rpm) # cp lib64/libaio.so.1* /compat/linux/lib64 # cd /compat/linux/lib64 && ln -s libaio.so.1.0.1 libaio.so.1 # ln -s /compat/linux/lib64/libdl.so.2 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/libm.so.6 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/libpthread.so.0 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/libnsl.so.1 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/libc.so.6 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/libaio.so.1 = /usr/local/oracle/instantclient_11_2/ # ln -s /compat/linux/lib64/ld-linux-x86-64.so.2 = /usr/local/oracle/instantclient_11_2/ # sudo pip install cx_Oracle Thanks, Erik=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?23CF3D5D-93C0-4E19-A854-69A1D96B4DE6>