chipKIT® Development Platform

Inspired by Arduino™


Created Sun, 26 Jun 2011 02:50:56 +0000 by phgphd


Sun, 26 Jun 2011 02:50:56 +0000

I am getting the following error when 'verifying' a sketch in Linux Ubuntu on 64bit AMD processor:

/home/phil/projects/mpide-0022-chipkit-linux32-20110520/hardware/pic32/compiler/pic32-tools/bin/../pic32mx/bin/gcc/pic32mx/4.5.1/cc1plus: error while loading shared libraries: wrong ELF class: ELFCLASS64

I suspect the root cause is that chipkit is intended for 32 bit host platform and is accessing a host library built for my 64bit processor. I am not sure what a work around could be. Am I correct and what is solution? Thanks for you help.


Mon, 27 Jun 2011 11:32:25 +0000

You need to get the 32bit version and put it in the /usr/lib32 folder

visit [url][/url]

(make sure you pick your release from the links on the top right) click on the download link for "i386" under the Architecture heading.

Once you've downloaded it open the archive with an archive manager (not package installer) and extract the .so files to /usr/lib32. I wouldn't bother with trying to extract the documentation stuff it's no use anyway.

This is a fairly messy and low level solution but it worked for me. Let me know if you need more details.


Mon, 27 Jun 2011 23:52:45 +0000

Thanks. I have done what you suggested and am able to compile. However, I moved the libelf into /usr/lib32/elf and then added /usr/lib/elf to the LD_LIBRARY_PATH defined in the mpide bash script. I was not able to compiler after doing that. I would prefer to install libelf in /usr/lib32/elf as I noticed that there are no files directly under /usr/lib32, but rather sub-folders for various libraries. I'd like to keep that scheme uniform.

Unto the next step, my mpide has the serial port grayed out, ie, not active. So unable to upload. Would you have an idea about this? I have an Arduina card as well and with which the serial port is fully functional.


Tue, 28 Jun 2011 11:58:01 +0000

Glad to hear that worked. I'm not sure why it didn't work when you listed the LD_LIBRARY_PATH, I did notice you mentioned /usr/lib/elf and /usr/lib32/elf in the last post, make sure you have the same path in the system, could just be a typo in the post. I'd advise /usr/lib32 folder for all libs.

Serial port access requires a few things, I assume you've got librxtx-java installed, I don't think mpide will start without it. You need to be in the group "dialout" to be able to use the serial port (type "groups" on the command line to list which groups you're a member of) if you aren't part of the group use "sudo usermod -aG dialout <username>" replacing <username> with your user then log out and log in again to update your system permissions.

I think you'll also need the in 32bit to program the chip, you'll need to install that the same way as you did for libelf.


Thu, 30 Jun 2011 03:28:40 +0000

Well, I think it must be the USB cable that is causing Linux's failure to recognize the serial port even though the Max32 is powered through the USB. When I plug in my Arduino board, the MPIDE does recognize the serial port and of course the Arduino uses a different USB cable.


Thu, 30 Jun 2011 22:56:17 +0000

So I just happenned to discover a USB cable for my cell phone. Lo and behold, the serial port is now recognized and I am happily uploading to my heart's content.


Fri, 01 Jul 2011 09:42:01 +0000

Excellent news, happy hacking!