在Win10 WSL Ubuntu上使用带Oracle InstantClient 11.2的DBD-Oracle(1.74或1.76)

时间:2019-05-24 13:06:22

标签: linux windows oracle perl windows-subsystem-for-linux

我正在尝试在Windows 10的ubuntu wsl bash上安装1.74或1.76的DBD :: Oracle。

我使用的是64位架构,并且sqlplus64正在运行,并且可以连接到我的数据库!

使用cpanm安装或使用carton安装或尝试使用perl Makeperl.pm -l进行编译均无效,并且始终会导致相同的错误。

在/usr/lib/oracle/11.2/client64中使用Oracle ->失败超时(> 60秒)。使用--verbose重试。 ->不适用

我尝试了以下操作:

  1. 我试图提升文件夹权限,但是没有运气。
  2. 我在安装了其他软件包的公司代理后面 很好,但我也尝试在野外互联网上进行移动连接,也没有运气。

这是我的build.log

cpanm (Menlo) 1.9019 on perl 5.018002 built for x86_64-linux
Work directory is /home/user1/.cpanm/work/1558699904.1138
You have make /usr/bin/make
You have LWP: 6.39
You have LWP::Protocol::https: 6.07
You have /bin/tar: tar (GNU tar) 1.29
Copyright (C) 2015 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.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
--> Working on /mnt/c/project/
Entering /mnt/c/project
Configuring /mnt/c/project
-> OK
Checking if you have Try::Tiny 0.24 ... Yes (0.27)
Checking if you have Tie::IxHash 1.23 ... Yes (1.23)
Checking if you have Image::Size 3.300 ... Yes (3.300)
Checking if you have Dancer2 0.203001 ... Yes (0.203001)
Checking if you have HTTP::Request 0 ... Yes (6.11)
Checking if you have Test::Fixture::DBI 0 ... Yes (0.09)
Checking if you have Net::SSLeay 1.88 ... Yes (1.88)
Checking if you have Plack::Middleware::CrossOrigin 0.012 ... Yes (0.012)
Checking if you have Date::Format 2.24 ... Yes (2.24)
Checking if you have Dancer2::Plugin::Database 2.16 ... Yes (2.17)
Checking if you have MIME::Lite 3.030 ... Yes (3.030)
Checking if you have Crypt::JWT 0.018 ... Yes (0.018)
Checking if you have JSON 0 ... Yes (2.90)
Checking if you have LockFile::Simple 0.208 ... Yes (0.208)
Checking if you have DBD::Oracle 1.74 ... No
Checking if you have Date::Language 1.10 ... Yes (1.10)
Checking if you have HTML::TreeBuilder 5.03 ... Yes (5.03)
Checking if you have Date::DayOfWeek 1.22 ... Yes (1.22)
Checking if you have Data::Serializer 0.60 ... Yes (0.60)
Checking if you have Date::Manip 6.54 ... Yes (6.56)
Checking if you have Locale::Maketext 0 ... Yes (1.23)
Checking if you have Time::Piece 0 ... Yes (1.20_01)
Checking if you have Redis 1.991 ... Yes (1.991)
Checking if you have Unicode::String 2.09 ... Yes (2.10)
Checking if you have LWP::Protocol::https 6.06 ... Yes (6.06)
Checking if you have Date::Calc 6.4 ... Yes (6.4)
Checking if you have Test::More 0 ... Yes (0.98)
Checking if you have MooX::Types::MooseLike 0.29 ... Yes (0.29)
Checking if you have MIME::Types 2.13 ... Yes (2.13)
Checking if you have LWP::UserAgent 0 ... Yes (6.15)
Checking if you have Algorithm::Diff 1.1903 ... Yes (1.1903)
Checking if you have Moo 2.002004 ... Yes (2.002004)
Checking if you have Starman 0.4014 ... Yes (0.4014)
==> Found dependencies: DBD::Oracle
Searching DBD::Oracle on mirror index /mnt/c/project/local/cache/modules/02packages.details.txt ...
--> Working on DBD::Oracle
Fetching http://cpan.metacpan.org/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
-> OK
Unpacking DBD-Oracle-1.74.tar.gz
Copying DBD-Oracle-1.74.tar.gz to /mnt/c/project/local/cache/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
Entering DBD-Oracle-1.74
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.18)
Checking if you have DBI 1.51 ... Yes (1.631)
Configuring DBD-Oracle-1.74
Running Makefile.PL
Multiple copies of Driver.xst found in: /mnt/c/project/local/lib/perl5/x86_64-linux/auto/DBI/ /home/user1/.plenv/versions/5.18.2/lib/perl5/site_perl/5.18.2/x86_64-linux/auto/DBI/ at Makefile.PL line 39.
Using DBI 1.631 (for perl 5.018002 on x86_64-linux) installed in /mnt/c/project/local/lib/perl5/x86_64-linux/auto/DBI/

Configuring DBD::Oracle for perl 5.018002 on linux (x86_64-linux)

Remember to actually *READ* the README file! Especially if you have any problems.

Installing on a linux, Ver#4.4
Using Oracle in /usr/lib/oracle/11.2/client64
-> FAIL Timed out (> 60s). Use --verbose to retry.
-> N/A
Checking dependencies from META.json ...
Checking if you have DBI 1.51 ... Yes (1.631)
Checking if you have warnings 0 ... Yes (1.18)
Checking if you have Exporter 0 ... Yes (5.68)
Checking if you have strict 0 ... Yes (1.07)
Checking if you have DynaLoader 0 ... Yes (1.18)
-> FAIL Configure failed for DBD-Oracle-1.74. See /home/user1/.cpanm/work/1558699904.1138/build.log for details.
-> FAIL Installing the dependencies failed: Module 'DBD::Oracle' is not installed
-> FAIL Bailing out the installation for /mnt/c/project/.

运行perl Makefile.PL -F -v(强制冗长)在其输出PATH后停止:

Using DBI 1.642 (for perl 5.018002 on x86_64-linux) installed in /home/user1/.plenv/versions/5.18.2/lib/perl5/site_perl/5.18.2/x86_64-linux/auto/DBI/

Configuring DBD::Oracle for perl 5.018002 on linux (x86_64-linux)

Remember to actually *READ* the README file! Especially if you have any problems.

Installing on a linux, Ver#4.4
Using Oracle in /usr/lib/oracle/11.2/client64
PATH=/usr/lib/oracle/11.2/client64/bin:/usr/lib/oracle/11.2/client64:/home/user1/.plenv/versions/5.18.2/bin:/home/user1/.plenv/libexec:/home/user1/.plenv/plugins/perl-build/bin:/home/user1/.plenv/shims:/home/user1/.plenv/bin:/home/user1/.nodenv/shims:/home/user1/.nodenv/bin:/home/user1/.rbenv/shims:/home/user1/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/Program Files (x86)/Nmap:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_937390:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/user1/AppData/Local/Microsoft/WindowsApps

2 个答案:

答案 0 :(得分:1)

根据我在这里看到的https://github.com/perl-carton/carton/issues/139

添加--build-timeout值非常大以避免超时,您也可以尝试使用cpan而不是cpanm。祝你好运...

答案 1 :(得分:1)

我在调查类似问题时发现了这个问题。 从我在这里看到的:https://github.com/microsoft/WSL/issues/2294 “将子过程的结果分配给变量挂起”的问题

我查看了Makefile.PL和找到的〜第1635行

        open FH, ">define.sql" or warn "Can't create define.sql: $!";
        print FH "DEFINE _SQLPLUS_RELEASE\nQUIT\n";
        close FH;
        my $sqlplus_release = `$sqlplus_exe -S /nolog \@define.sql 2>&1`;

我在本地进行了快速测试

user@machine:~$ echo -e "DEFINE _SQLPLUS_RELEASE\nQUIT\n" > mydefine.sql
user@machine:~$ /usr/bin/sqlplus -S /nolog @mydefine.sql
DEFINE _SQLPLUS_RELEASE = "1903000000" (CHAR)
user@machine:~$ perl -e 'print `/usr/bin/sqlplus -S /nolog \@mydefine.sql`'
    <hangs forever>

所以...现在我们知道存在sqlplus时存在问题,无法将输出分配给变量。

在查看Makefile.PL之后,sqlplus仅用于确定已安装的oracle版本。我决定尝试破解此问题。这对我有用,但是您的里程可能会有所不同。您将需要更改用于oracle客户端安装的命令。

  • 重命名sqlplus可执行文件,使其无法使用。
  • 手动安装(先前下载的)DBD:Oracle源程序
  • 重命名sqlplus可执行文件,使其再次可用。

user@machine:~$ sudo su
root@machine:~# mv /usr/lib/oracle/19.3/client64/bin/sqlplus /usr/lib/oracle/19.3/client64/bin/sqlplusx 
root@machine:~# cd /home/user/.cpan/build/DBD-Oracle-1.80-0
root@machine:DBD-Oracle-1.80-0# perl Makefile.PL
...
root@machine:DBD-Oracle-1.80-0# make
root@machine:DBD-Oracle-1.80-0# make install
... SUCCESS ...
root@machine:DBD-Oracle-1.80-0# mv /usr/lib/oracle/19.3/client64/bin/sqlplusx /usr/lib/oracle/19.3/client64/bin/sqlplus
root@machine:DBD-Oracle-1.80-0# exit
exit
user@machine:~$