vrogier / ocilib

OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases

Home Page:http://www.ocilib.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

symbol not found in flat namespace '_OCIAQDeq' (macOS arm64)

KambizAsadzadeh opened this issue · comments

Hello!
I get this error in runtime: symbol not found in flat namespace '_OCIAQDeq'
Any advice to fix this error?

Hi,

Can you give more information?
OS and build tools versions?
Oracle version?
OCILIB version?
What are the link flags that you use?

Seems that error is a link issue on macos.

Vincent

Hi,

Can you give more information? OS and build tools versions? Oracle version? OCILIB version? What are the link flags that you use?

Seems that error is a link issue on macos.

Vincent

Hi,
Yes, The error belongs to the macOS environment, you're right.

I have installed the latest version of oclib: v4.7.6

And I have configured it like this command:

./configure --with-oracle-lib-path="/opt/homebrew/Cellar/instantclient-sqlplus/19.8.0.0.0dbru/lib" --with-oracle-lib-path="/opt/homebrew/Cellar/instantclient-basic/19.8.0.0.0dbru/lib" --with-oracle-headers-path="/opt/homebrew/Cellar/instantclient-sdk/19.8.0.0.0dbru/include/"

My third-party/oclib/lib folder contains the following files:
libocilib.4.dylib | libocilib.a | libocilib.dylib (alias) | libocilib.la

  • instantclient-sqlplus 19.8.0.0.0dbru (installed by brew)
  • instantclient-basic 19.8.0.0.0dbru (installed by brew)
  • macOS 13.2.1
  • Architecture arm64 (M1)
  • CMake 3.24.2
  • Compiler (GCC12.x | Clang 16.x)
cmake_minimum_required(VERSION 3.5)

project(OracleTest LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third-party/oclib/include)

add_executable(OracleTest main.cpp)

target_link_libraries(OracleTest "-L/${CMAKE_CURRENT_SOURCE_DIR}/third-party/oclib/lib -locilib")

install(TARGETS OracleTest
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

main.cpp example:

#include <iostream>

#include <ocilib.hpp>

using namespace ocilib;

int main()
{
    try
    {
        Environment::Initialize();

        Connection con("db", "usr", "pwd");

        Statement st(con);
        st.Execute("select * from products");

        Resultset rs = st.GetResultset();
        while (rs++)
        {
            std::cout << "code:" << rs.Get<ostring>(1) << " name:" << rs.Get<ostring>(2) << std::endl;
        }

        std::cout << "=> Total fetched rows : " << rs.GetCount() << std::endl;

    }
    catch (std::exception &ex)
    {
        std::cout << "Error:" << ex.what() << std::endl;
    }

    Environment::Cleanup();

    return EXIT_SUCCESS;
}

I think it is a problem due to lack of support for this (arm64 M1) architecture.

Closing issue as it is not an OCILIB issue.