How to add libmraa to compile process

Sysprogs forums Forums VisualGDB How to add libmraa to compile process

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11150
    ThomasM
    Participant

    Hi there,

    I’m currently working on an Intel Edison and try to get the libmraa library working (https://iotdk.intel.com/docs/master/mraa/). If I compile the demo source with vi on the edison everything works (for my bash commands sroll down) and the build does not fail.

    If I try to use VisualGDB within the VisualStudio environment the build fails. The compiler tells me that the functions provided by the library  libmraa are not found.

    1>D:\HelloWorld\HelloWorld\HelloWorld\HelloWorld.cpp(12): error : undefined reference to `mraa_get_platform_name'
    1>D:\HelloWorld\HelloWorld\HelloWorld\HelloWorld.cpp(13): error : undefined reference to `mraa_get_version'

    My question is quite simple:
    How can I compile the project with a libmraa library on a Win7 computer with VisualGDB?

    Some more detailed information is coming up now. This is what I got on the edison:

    Contents of Test.c
    #include "mraa.h"
    int main(int argc, char *argv[])
    {    
        const char* board_name = mraa_get_platform_name();
        fprintf(stdout, "hello mraa\n Version: %s\n Running on %s\n", mraa_get_version(), board_name);
        return 0;
    }

     

    I compile on the edison with the following lines

    $ gcc -o HelloDemo Test.c -lmraa
    $ ./HelloDemo
    hello mraa
     Version: v1.6.1
     Running on Intel Edison

    Still on the edison

    $ uname -a
    Linux edison 3.10.17-poky-edison+ #1 SMP PREEMPT Fri Jun 19 12:06:40 CEST 2015 i686 GNU/Linux
    $ opkg list | grep mraa
    mraa - 0.9.0 - mraa built using CMake
    mraa - 1.6.1 - mraa built using CMake
    mraa - 0.7.5.60
    mraa-dbg - 0.7.5-r0
    mraa-dev - 0.7.5-r0
    mraa-doc - 0.7.5-r0

    Here are my settings on VisualGDB:

    ProjectSettings

    MakefileSettings

    The ../../../Bibliotheken/MRAA is the directory identical to the github page from https://github.com/intel-iot-devkit/mraa and contains nothing but *.h files.

    Thanks for all the help!

    • This topic was modified 7 years, 7 months ago by ThomasM. Reason: Fixed typos
    #11154
    support
    Keymaster

    Hi,

    Normally it should be as easy as adding “mraa” to the “Library names” field.

    If you get a “cannot find -lmraa” error, please try the following command line on your Edison:

    gcc -o HelloDemo Test.c -lmraa -Wl,-verbose

    Then check the verbose link log for the actual path of libmraa.a. Once you locate it, simply copy it in the corresponding directory inside your toolchain’s sysroot and VisualGDB should be able to link your program with it.

    #11173
    ThomasM
    Participant

    Hey,

    thanks for the answer. I tried the command on the Edison itself. This is a part of the gcc output

    attempt to open /usr/lib/gcc/i586-poky-linux/4.9.1/libmraa.so failed
    attempt to open /usr/lib/gcc/i586-poky-linux/4.9.1/libmraa.a failed
    attempt to open /usr/lib/gcc/i586-poky-linux/4.9.1/../../../i586-poky-linux/4.9.1/libmraa.so failed
    attempt to open /usr/lib/gcc/i586-poky-linux/4.9.1/../../../i586-poky-linux/4.9.1/libmraa.a failed
    attempt to open /usr/lib/gcc/i586-poky-linux/4.9.1/../../../libmraa.so succeeded

    I ran another command to make sure the libmraa.a is installed

    /usr/lib$ ls | grep mraa
    libmraa.so
    libmraa.so.0
    libmraa.so.1
    libmraa.so.1.6.1
    libmraajava.so

    It seems like I don’t have the libmraa.a installed. Is there an easy way to do so? Everything that I tried was just for dynamic linking.

    Greetings,
    Thomas

    #11174
    ThomasM
    Participant

    Nevermind. It seems like the build is happy with the libmraa.so as well 😉

    #11179
    support
    Keymaster

    Hi,

    No problem. The shared library should do as well, as long as it is always present on your target system.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.