blue-yonder / turbodbc

Turbodbc is a Python module to access relational databases via the Open Database Connectivity (ODBC) interface. The module complies with the Python Database API Specification 2.0.
http://turbodbc.readthedocs.io/en/latest
MIT License
616 stars 86 forks source link

turbodbc installation failed due to missing boost/locale.hpp file on AIX7.2 #287

Open bergen288 opened 3 years ago

bergen288 commented 3 years ago

I have compiled boost1.73 and generate its header files. As you can see below, locale.hpp is available in /software/thirdparty/boost_1_73_0/boost.

Login=xzhang: Line=130 > pwd
/software/thirdparty/boost_1_73_0/boost
Login=xzhang: Line=131 > ls -l locale.hpp
-rw-r--r--    1 xzhang   xzhang          887 Apr 22 2020  locale.hpp

I also defined BOOST_ROOT=/software/thirdparty/boost_1_73_0. However, turbodbc installation failed due to missing boost/locale.hpp file:

gcc -maix64 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -Iinclude/ -I/opt/freeware/lib/python3.7/site-packages/pybind11/include -I/opt/freeware/include/python3.7m -c src/cpp_odbc/level2/input_string_buffer.cpp -o build/temp.aix-7.2-3.7/src/cpp_odbc/level2/input_string_buffer.o --std=c++11
  gcc -maix64 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -Iinclude/ -I/opt/freeware/lib/python3.7/site-packages/pybind11/include -I/opt/freeware/include/python3.7m -c src/cpp_odbc/level2/input_u16string_buffer.cpp -o build/temp.aix-7.2-3.7/src/cpp_odbc/level2/input_u16string_buffer.o --std=c++11
  gcc -maix64 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -Iinclude/ -I/opt/freeware/lib/python3.7/site-packages/pybind11/include -I/opt/freeware/include/python3.7m -c src/cpp_odbc/level2/level1_connector.cpp -o build/temp.aix-7.2-3.7/src/cpp_odbc/level2/level1_connector.o --std=c++11
  src/cpp_odbc/level2/level1_connector.cpp:17:10: fatal error: boost/locale.hpp: No such file or directory
   #include <boost/locale.hpp>
            ^~~~~~~~~~~~~~~~~~
  compilation terminated.

How to make sure turbodbc installation will search for boost hpp files? Thanks.

xhochy commented 3 years ago

Can you post the full build log and the value of the environment variables CFLAGS, CXXFLAGS and LDFLAGS?

bergen288 commented 3 years ago

I didn't define CFLAGS, CXXFLAGS and LDFLAGS. I expected they are defined in your makefile or something similar. Attached is the complete log file. Thanks. turbodbc-4.1.1.tar.gz.log

bergen288 commented 3 years ago

@xhochy:

Do you have any update on my issue?

Thanks.

bergen288 commented 3 years ago

I checked your setup.py. Basically, you defined 3 platforms: darwin, win32, and others, which means AIX is in others group. So I defined UNIXODBC_INCLUDE_DIR and UNIXODBC_LIBRARY_DIR accordingly. Now I have totally different errors. The 1st error is below and the other errors are similar.

    gcc -maix64 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -fPIC -Iinclude/ -I/opt/freeware/lib/python3.7/site-packages/pybind11/include -I/usr/local/include/ -I/opt/freeware/include/python3.7m -c src/turbodbc/buffer_size.cpp -o build/temp.aix-7.2-3.7/src/turbodbc/buffer_size.o --std=c++11
    In file included from /usr/local/include/boost/variant/apply_visitor.hpp:16,
                     from /usr/local/include/boost/variant/detail/hash_variant.hpp:22,
                     from /usr/local/include/boost/variant/variant.hpp:34,
                     from include/turbodbc/field.h:3,
                     from include/turbodbc/description.h:3,
                     from include/turbodbc/buffer_size.h:3,
                     from src/turbodbc/buffer_size.cpp:1:
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected primary-expression before 'auto'
     inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
                     ^~~~
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected ')' before 'auto'
     inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
                    ~^~~~
                     )
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected primary-expression before 'auto'
     inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
                     ^~~~
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected primary-expression before 'auto'
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected primary-expression before 'auto'
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:17: error: expected primary-expression before 'auto'
    /usr/local/include/boost/variant/detail/apply_visitor_unary.hpp:131:8: error: expected unqualified-id before 'decltype'
     inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
            ^~~~~~~~

Attached are log file and hpp file in question. I have to add ".txt" suffix to fool around github system. Would you mind to take a look?

Thanks. turbodbc-4.1.1.tar.log

apply_visitor_binary.hpp.txt

bergen288 commented 3 years ago

I am confused with the following logic in your setup.py file. Apparently, turbodbc installation requires boost. However, BOOST_ROOT is only defined in "win32" platform. Does BOOST_ROOT is required or not on AIX? my unixODBC is installed in /usr/local/unixODBC while /usr/local/lib and /usr/local/include are boost lib/include libraries. How do I define UNIXODBC_INCLUDE_DIR and UNIXODBC_LIBRARY_DIR on AIX? I tried them with /usr/local/include and /usr/local/bin, but the installation failed as mentioned in my last post. Other tries were failed with missing files.

Any help is really appreciated.

if sys.platform == 'darwin':
    extra_compile_args.append('--std=c++11')
    extra_compile_args.append('--stdlib=libc++')
    extra_compile_args.append('-mmacosx-version-min=10.9')
    hidden_visibility_args.append('-fvisibility=hidden')
    include_dirs.append(os.getenv('UNIXODBC_INCLUDE_DIR', '/usr/local/include/'))
    library_dirs.append(os.getenv('UNIXODBC_LIBRARY_DIR', '/usr/local/lib/'))
    from distutils import sysconfig
    vars = sysconfig.get_config_vars()
    vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '')
    python_module_link_args.append('-bundle')
    builder = setuptools.command.build_ext.build_ext(Distribution())
    full_name = builder.get_ext_filename('libturbodbc')
    base_library_link_args.append('-Wl,-dylib_install_name,@loader_path/{}'.format(full_name))
    base_library_link_args.append('-dynamiclib')
    odbclib = 'odbc'
elif sys.platform == 'win32':
    extra_compile_args.append('-DNOMINMAX')
    if 'BOOST_ROOT' in os.environ:
        include_dirs.append(os.getenv('BOOST_ROOT'))
        library_dirs.append(os.path.join(os.getenv('BOOST_ROOT'), "stage", "lib"))
        library_dirs.append(os.path.join(os.getenv('BOOST_ROOT'), "lib64-msvc-14.0"))
    else:
        print("warning: BOOST_ROOT enviroment variable not set")
    odbclib = 'odbc32'
else:
    extra_compile_args.append('--std=c++11')
    hidden_visibility_args.append('-fvisibility=hidden')
    python_module_link_args.append("-Wl,-rpath,$ORIGIN")
    if 'UNIXODBC_INCLUDE_DIR' in os.environ:
        include_dirs.append(os.getenv('UNIXODBC_INCLUDE_DIR'))
    if 'UNIXODBC_LIBRARY_DIR' in os.environ:
        library_dirs.append(os.getenv('UNIXODBC_LIBRARY_DIR'))
    odbclib = 'odbc'
xhochy commented 3 years ago

I can look into the logs next week but you will probably be mostly on your own on this. AIX is not officially supported and will probably never be as well. I also don't have access to an AIX setup as this is really uncommon.