vrogier / ocilib

OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases
http://www.ocilib.net
Apache License 2.0
325 stars 119 forks source link

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

Closed TheCompez closed 1 year ago

TheCompez commented 1 year ago

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

vrogier commented 1 year ago

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

TheCompez commented 1 year ago

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

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.

vrogier commented 1 year ago

Closing issue as it is not an OCILIB issue.