Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 下构建 oci8、pdo_oci 扩展,遇到的 Oracle Instant Client 库不是 .tar.gz 格式和无 Makefile 文件的问题。 #644

Closed
vkviyu opened this issue Jun 7, 2024 · 1 comment

Comments

@vkviyu
Copy link

vkviyu commented Jun 7, 2024

一、以下是我这里写的这个用的 PHP:

  1. 这是我在 builder/extension 目录下的 oci8.php
<?php

use SwooleCli\Preprocessor;
use SwooleCli\Extension;

return function (Preprocessor $p) {
    $p->addExtension(
        (new Extension('oci8'))
            ->withHomePage('https://www.php.net/oci8')
            ->withOptions('--with-oci8=instantclient,' . ORACLEINSTANTCLIENT_PREFIX)
            ->withDependentLibraries('oracleinstantclient')
    );
};
  1. 这是 builder/library 目录下的 oracleinstantclient.php
<?php

use SwooleCli\Library;
use SwooleCli\Preprocessor;

return function (Preprocessor $p) {
    $oracleinstantclient_prefix = ORACLEINSTANTCLIENT_PREFIX;

    $p->addLibrary(
        (new Library('oracleinstantclient'))
            ->withHomePage('https://www.oracle.com/database/technologies/instant-client.html')
            ->withLicense('https://www.oracle.com/downloads/licenses/instant-client-lic.html', Library::LICENSE_SPEC)
            ->withUrl('https://download.oracle.com/otn_software/linux/instantclient/2340000/instantclient-basic-linux.x64-23.4.0.24.05.zip')
            ->withPrefix($oracleinstantclient_prefix)
//             ->withConfigure(
//                 <<<EOF
//                 # Here you can put the configuration commands for oracleinstantclient
//                 # For example:
//                 # ./configure --prefix={$oracleinstantclient_prefix}
// EOF
//             )
            ->withPkgName('oracleinstantclient')
            ->withBinPath($oracleinstantclient_prefix . '/bin/')
    );
};

二、我在 ./make.sh all-library 阶段遇到的两个问题

  1. 第一个问题,下载的库的格式不是一个 tar archive。报错信息:oracleinstantclient tar: This does not look like a tar archive tar: Skipping to next header tar: Exiting with failure status due to previous errors [oracleinstantclient] [configure FAILURE]。 关于这个问题,应该是因为我下载的 Oracle Instant Client 的文件格式不是一个 .tar.gz 文件格式导致的(网上找不到 .tar.gz 格式的 Oracle 客户端库。我想到的办法是,将 .zip 转换到 .tar.gz 格式。然后再修改下面这个地方:
    image
    通过这种操作,确实不会报 not look like a tar archive tar 的错误了

  2. 第二个问题,在我的 oracleinstantclient 库里面找不到 Makefile 文件。报错信息如下图:
    image
    这个问题就不知道怎么解决了。因为 Oracle 提供的 Oracle Instant Client 库应该是一个预编译的直接可供 oci8pdo_oci 扩展使用的库,不需要(同时无法)再次去编译吧,所以也就没有所谓的 Makefile 文件?那么是否可以说对于 oci8 扩展和 oracle instant client 库而言,应该跳过 make all-library 这个编译库的步骤 直接到 编译配置、构建和打包的环节呢?但是我又不知道应该具体怎样去操作。

@jingjingxyk
Copy link
Contributor

jingjingxyk commented Jun 7, 2024

oci8、pdo_oci 没办法静态编译啊,原因是: oracleinstantclient 没有源码啊,下载到的已经编译好的二进制客户端

关于压缩包的解压问题,用 experiment 分支,实验分支里已经解决了这个问题, 更多请查看这里 #273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants