Thread: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jan Mechtel
Date:
Our webhoster moved us to a 64Bit CentOS. I installed postgresql-9.1.3 from source.

I run into trouble when trying to create the tablefunc extension

b2blogin_mailrocket=# create extension tablefunc;
ERROR:  could not load library "/home/b2blogin/lib/postgresql/tablefunc.so": /home/b2blogin/lib/postgresql/tablefunc.so: wrong ELF class: ELFCLASS32

On google I didn't only find some clues, that this seems related to 64bit vs. 32bit.

Please help or point me in the right direction.

Jan

Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jeff Janes
Date:
On Sat, Oct 20, 2012 at 10:33 AM, Jan Mechtel <jmechtel@gmail.com> wrote:
> Our webhoster moved us to a 64Bit CentOS. I installed postgresql-9.1.3 from
> source.

Did you also install contrib from the same source?

>
> I run into trouble when trying to create the tablefunc extension
>
> b2blogin_mailrocket=# create extension tablefunc;
> ERROR:  could not load library "/home/b2blogin/lib/postgresql/tablefunc.so":
> /home/b2blogin/lib/postgresql/tablefunc.so: wrong ELF class: ELFCLASS32
>
> On google I didn't only find some clues, that this seems related to 64bit
> vs. 32bit.
>
> Please help or point me in the right direction.

It looks like your tablefunc is left over from a previous build/install.

Had you previously used the same source tree to install tablefunc
under 32 bit?  If so, you should start from a fresh source tree;  or
run "make clean" or "make maintainer-clean" before configuring and
building again.

Cheers,

Jeff


Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jan Mechtel
Date:
Thanks for the quick reply,
This could indeed be a solution since the webhosting migrated the old
folder I used for installation on 32bit.

I am not very familar with linux, I'd like to ask for two clarifications:
>If so, you should start from a fresh source tree;  or run "make clean" or
>"make maintainer-clean" before configuring and building again.
1. You refer to my installation of postgresql-9.1.3 ? as far as I
understand the tablefunc I am trying to load is included there

2. Would I need to "uninstall" postgresql-9.1.3 somehow before running
the install again?

Thanks,

Jan

> On 20 October 2012 19:54, Jeff Janes <jeff.janes@gmail.com> wrote:
>>
>> On Sat, Oct 20, 2012 at 10:33 AM, Jan Mechtel <jmechtel@gmail.com> wrote:
>> > Our webhoster moved us to a 64Bit CentOS. I installed postgresql-9.1.3 from
>> > source.
>>
>> Did you also install contrib from the same source?
>>
>> >
>> > I run into trouble when trying to create the tablefunc extension
>> >
>> > b2blogin_mailrocket=# create extension tablefunc;
>> > ERROR:  could not load library "/home/b2blogin/lib/postgresql/tablefunc.so":
>> > /home/b2blogin/lib/postgresql/tablefunc.so: wrong ELF class: ELFCLASS32
>> >
>> > On google I didn't only find some clues, that this seems related to 64bit
>> > vs. 32bit.
>> >
>> > Please help or point me in the right direction.
>>
>> It looks like your tablefunc is left over from a previous build/install.
>>
>> Had you previously used the same source tree to install tablefunc
>> under 32 bit?  If so, you should start from a fresh source tree;  or
>> run "make clean" or "make maintainer-clean" before configuring and
>> building again.
>>
>> Cheers,
>>
>> Jeff
>
>


Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jan Mechtel
Date:
Thanks a lot, this worked. I read to detail the tablefunc.so and then go to the postgres-9.1.3/contrib/ and call make + make install there.

On 20 October 2012 20:02, Jan Mechtel <jmechtel@gmail.com> wrote:
Thanks for the quick reply,
This could indeed be a solution since the webhosting migrated the old
folder I used for installation on 32bit.

I am not very familar with linux, I'd like to ask for two clarifications:
>If so, you should start from a fresh source tree;  or run "make clean" or
>"make maintainer-clean" before configuring and building again.
1. You refer to my installation of postgresql-9.1.3 ? as far as I
understand the tablefunc I am trying to load is included there

2. Would I need to "uninstall" postgresql-9.1.3 somehow before running
the install again?

Thanks,

Jan

> On 20 October 2012 19:54, Jeff Janes <jeff.janes@gmail.com> wrote:
>>
>> On Sat, Oct 20, 2012 at 10:33 AM, Jan Mechtel <jmechtel@gmail.com> wrote:
>> > Our webhoster moved us to a 64Bit CentOS. I installed postgresql-9.1.3 from
>> > source.
>>
>> Did you also install contrib from the same source?
>>
>> >
>> > I run into trouble when trying to create the tablefunc extension
>> >
>> > b2blogin_mailrocket=# create extension tablefunc;
>> > ERROR:  could not load library "/home/b2blogin/lib/postgresql/tablefunc.so":
>> > /home/b2blogin/lib/postgresql/tablefunc.so: wrong ELF class: ELFCLASS32
>> >
>> > On google I didn't only find some clues, that this seems related to 64bit
>> > vs. 32bit.
>> >
>> > Please help or point me in the right direction.
>>
>> It looks like your tablefunc is left over from a previous build/install.
>>
>> Had you previously used the same source tree to install tablefunc
>> under 32 bit?  If so, you should start from a fresh source tree;  or
>> run "make clean" or "make maintainer-clean" before configuring and
>> building again.
>>
>> Cheers,
>>
>> Jeff
>
>

Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jeff Janes
Date:
On Sat, Oct 20, 2012 at 11:00 AM, Jan Mechtel <jmechtel@keyrocket.com> wrote:
> Thanks for the quick reply,
>
> This could indeed be a solution since the webhosting migrated the old folder
> I used for installation on 32bit.

Sorry, I don't really know what this means.  They just copied the
folder, or the migration was more involved than that?

Did you install 9.1.3 from source after the migration, or before the
migration and then the installed binaries were migrated?

>
> I am not very familar with linux, I'd like to ask for two clarifications:
>
>>If so, you should start from a fresh source tree;  or run "make clean" or
>>"make maintainer-clean" before configuring and building again.

> 1. You refer to my installation of postgresql-9.1.3 ? as far as I understand
> the tablefunc I am trying to load is included there

Yes, I'm referring to your installation of 9.1.3.  tablefunc is a
"contrib" module, and it is not installed by default, i.e. if you just
run "make install" from the root of the source tree, it won't be
installed.  You have to do something else, like "make install-world",
or going to the contrib or contrib/tablefunc directories and running
"make install" from there.

So it is possible you recompiled the main pgsql executables and
libraries on 64-bit and overwrite the 32 bit versions with the new
ones, but accidentally did not recompile tablefunc and so inherited
the old version.

> 2. Would I need to "uninstall" postgresql-9.1.3 somehow before running the
> install again?

You could probably get away with just doing a make clean, then redoing
configure and make, and then doing "make install" only on contrib.
But, If your current installation has become a confusing mixture of 32
bit and 64 bit binaries, it would probably be best to uninstall it and
start from scratch to avoid additional confusion.  If the original
install was from source using the defaults, uninstalling it just means
removing the directories:

/usr/local/pgsql/include
/usr/local/pgsql/share
/usr/local/pgsql/lib
/usr/local/pgsql/bin

Of course you want to make sure you have a good backup of everything
before doing anything.

Cheers,

Jeff


Re: Create extension tablefunc fails with "wrong ELF class: ELFCLASS32"

From
Jan Mechtel
Date:
Thanks for the quick reply, 

This could indeed be a solution since the webhosting migrated the old folder I used for installation on 32bit.

I am not very familar with linux, I'd like to ask for two clarifications:

>If so, you should start from a fresh source tree;  or run "make clean" or
>"make maintainer-clean" before configuring and building again.
1. You refer to my installation of postgresql-9.1.3 ? as far as I understand the tablefunc I am trying to load is included there
2. Would I need to "uninstall" postgresql-9.1.3 somehow before running the install again?

Thanks,

Jan


On 20 October 2012 19:54, Jeff Janes <jeff.janes@gmail.com> wrote:
On Sat, Oct 20, 2012 at 10:33 AM, Jan Mechtel <jmechtel@gmail.com> wrote:
> Our webhoster moved us to a 64Bit CentOS. I installed postgresql-9.1.3 from
> source.

Did you also install contrib from the same source?

>
> I run into trouble when trying to create the tablefunc extension
>
> b2blogin_mailrocket=# create extension tablefunc;
> ERROR:  could not load library "/home/b2blogin/lib/postgresql/tablefunc.so":
> /home/b2blogin/lib/postgresql/tablefunc.so: wrong ELF class: ELFCLASS32
>
> On google I didn't only find some clues, that this seems related to 64bit
> vs. 32bit.
>
> Please help or point me in the right direction.

It looks like your tablefunc is left over from a previous build/install.

Had you previously used the same source tree to install tablefunc
under 32 bit?  If so, you should start from a fresh source tree;  or
run "make clean" or "make maintainer-clean" before configuring and
building again.

Cheers,

Jeff