Thread: Using code compiled in OpenSUSE on a microcontroller running Gentoo Linux

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    33

    Using code compiled in OpenSUSE on a microcontroller running Gentoo Linux

    I want to use code the I compiled on a desktop running OpenSUSE linux, and port it over to a microcontroller running Gentoo Linux. The primary means of sending data between the desktop and the microcontroller is to remove the microcontroller's memory card and insert it into a usb card reader connected to my desktop.

    Through the USB card reader, I have access to all the files, including all root folder files, that are part of the microcontroller's linux operating system. I can essentially install any program, package, library or module to this operating system as if it were my desktop computer.

    The problem is the system discrepancy, if I do install any packages to the microcontroller memory, those packages will be compiled in a openSUSE operating system, but ultimately used by a Gentoo Linux operating system. I have no idea what kinds of problems this might cause.

    Any advice on how to approach this issue would be greatly appreciated.

    Thanks for the help.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Can you take the source code and compile it on the Gentoo system? That would be the most straightforward way to do things.

    What are the kernel versions on the two systems? (Type uname -r.) Are they both running on 32-bit Intel CPUs, for example? If so, you could try it. There might be other issues, though, like incompatible versions of libc or something.

    You can tell GCC to target different platforms, assuming you have access to the source code. I don't know how, since I've never needed to.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Is the microcontroller an x86-based processor? Or something like ARM or MIPS?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    I am using a PC104 stack for the microcontroller. Apparently they come in all kinds of configurations so I am not sure what processor architecture it is using. I will have to look it up or perhaps even disassemble the stack to get. Although the uppoermost chip on the stack is the firewire controller and that uses a 32-bit PCI bus, which leads me to assume the CPU module would also use a 32-bit chip.

    The Desktop uses an Intel Pentium 4, and is a 32-bit architecture. The Kernel is 2.6.18.8-0.5-default.

    The PC104 stack Kernel is 2.6.14-gentoo-r5.

    As far as compiling on a Gentoo system, I don't have access to any systems with it installed. I could install Gentoo on my desktop, but the operating system is a major project to set up, and it is nearly impossible for me to get any assistance in using it. Most people who I managed to contact for assistance with Gentoo Linux simple told me to install another version of Linux. Its emerge function is completely arcane and I have absolutely no understanding of it, yet that is what I need to get programs like gcc to work on it. So I would prefer not to have to deal with any more Gentoo Linux than I need to.
    Last edited by Phanixis; 10-17-2007 at 03:49 PM.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Emerge is anything but arcane. But this is not a place to advertise Gentoo.

    In fact, I rather think that Gentoo is a poor choice for such an inaccessible system as you're building. Why do you need Gentoo just to get GCC to work?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    I don't need Gentoo to get gcc to work. I have gcc installed on OpenSUSE linux on the desktop, with a working copy of gcc and the program I compiled in gcc. I want to move said program to the microcontroller, which runs Gentoo Linux for no other reason than is what it came with.

    Now, the program is already a fully compiled stand alone application when I send it to the microcontroller. So I just send it over using the USB card reader and try to run it. However, the microcontroller claims it is missing libraries that it needs to run the program.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You could try adding -static on the gcc line that produces the final binary (e.g. gcc -o myprog myprog.o blah.o -lsomething -static).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    Interesting, it is giving me a cannot find -lcxcore error when compiling. That is the same error I was getting when I attempted to run the program on the PC104. This might work(as soon as a find this lcxcore).

    Thanks for the help.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, -static means "link everything into the binary" or, put a different way, "don't use shared libraries". Of course, if "libcxcore.a" doesn't exist, then you can't link against it....

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    Apparantly, cxcore is part of openCV. There are several files named cxcore on my machine, but none name libcxcore. Either my install of openCV is incomplete or the make file is not properly obtaining the files.

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Phanixis View Post
    Apparantly, cxcore is part of openCV. There are several files named cxcore on my machine, but none name libcxcore. Either my install of openCV is incomplete or the make file is not properly obtaining the files.
    You probably need to install somethng like OpenCV-devel or such.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    That might be the case. My makefile is currently searching for the necessary files in a strange filepath that currently doesn't exist on my machine:

    /usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld: cannot find -lcxcore

    Mind you, I have no idea why it is searching that particular path, the line in make that produces this error is:

    -g++ -o (all my .o files) -lcxcore

    And nowhere in the make file do I tell it to look up the above filepath. The one I provided make with is "/usr/local/include/opencv". I have no idea were the program got the idea to search that rather long filepath for cxcore.

  13. #13
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Phanixis View Post
    /usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld: cannot find -lcxcore

    Mind you, I have no idea why it is searching that particular path
    You have a version-specific installation of binutils. Not typical, but nothing wrong with it, either. It's not looking for a library there. That's where the "ld" binary is -- read the message more closely.

  14. #14
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    Ok, I found out that when I statically compile the code, I apparently need to statically compile all the libraries it is using. I statically compiled the openCV libraries on my computer and reinstalled them, and I was able to get rid of the errors. Problem is that now it is telling me it can't find various gtk functions on compiling, which means I might have to statically recompile that as well.

    Thanks for the help. Hopefully I will get this to work eventually.

  15. #15
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Phanixis View Post
    Ok, I found out that when I statically compile the code, I apparently need to statically compile all the libraries it is using.
    That shouldn't be the case... Can you give any more details on what you've tried? Recompiling GTK is going to really suck.

    EDIT: Do you mean "link it statically?" In that case, yes, all the libraries need to be static, but I would strongly recommend against linking it statically in the first place. If you can't dynamically link with cxcore, that's a separate issue we should investigate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wireless Network Linux & C Testbed
    By james457 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-11-2009, 11:03 AM
  2. running code in borland
    By Aisthesis in forum Tech Board
    Replies: 5
    Last Post: 05-19-2009, 12:06 AM
  3. Problems running compiled .exe on other machines.
    By Troels Leth in forum C++ Programming
    Replies: 39
    Last Post: 05-09-2008, 05:30 AM
  4. Problem in running turbo C code
    By bulogi in forum C Programming
    Replies: 6
    Last Post: 04-26-2008, 10:25 PM
  5. code to run (linux) programs WITH arguments
    By N8760 in forum C++ Programming
    Replies: 3
    Last Post: 12-27-2001, 03:35 PM