Wednesday, August 16, 2017

Linux ODBC : GLIBCXX_3.4.20 not found, [RESOLVED]

I have done a setup of ODBC for Amazon Redshift on RedHat Linux 7.2 recently as per my earlier post OBIEE 12c: Amazon Redshift ODBC setup which was done a year ago.

All went well except i was not able to use the ODBC driver as it throws errors.

First i tried to see if my configuration was correct, the first step is to see if my DSN shows up or not.

To test this i use the odbcinst command 

[oracle@My-Linux ~]$ odbcinst -q -s
[ODBC]
[AnalyticsWeb]
[opss_datasource]
[biplatform_datasource]
[Redshift]

Next thing is to check if the DSN listed is working or not, which can be done using i sql

[oracle@My-Linux ~]$ isql -v Redshift
[01000][unixODBC][Driver Manager]Can't open lib '/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so' : file not found
[ISQL]ERROR: Could not SQLConnect

As the error says the file libamazonredshiftodbc64.so is not accessible for the ODBC manager, we will try and access the same to see if it has any issues.

[oracle@My-Linux ~]$ ldd /opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so
/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so)
        linux-vdso.so.1 =>  (0x00007fff88ffe000)
        libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007faf36d23000)
        libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007faf36b06000)
        librt.so.1 => /usr/lib64/librt.so.1 (0x00007faf368fe000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007faf365f5000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007faf362f2000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007faf360dc000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007faf35d1b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007faf39937000)


You can now see that the GLIBCXX_3.4.20 was not found in libstdc++.so.6 library file. Let us see what the file has to confirm if its available or not.

[oracle@My-Linux ~]$ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX               
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

So it is true that the GLIBCXX_3.4.20  is missing which is required by the Amazon driver, which is the root cause for the issue. Now lets see what can be done to resolve this.

We have to basically update the libstdc++ to a higher version which includes the GLIBCXX_3.4.20. For me the below command worked.

[oracle@My-Linux ~] yum update libstdc++

Depending on your OS you can update using different commands like

sudo apt-get install libstdc++6Above command will install it if not already donesudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get updatesudo apt-get upgradesudo apt-get dist-upgrade

Now try and run the isql command with username and password to verify the connection.
[oracle@My-Linux ~]$ isql Redshift username password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

No comments:

Post a Comment