7 Replies Latest reply on May 3, 2017 6:21 PM by Electrumpet

    Adding header files and library in Eclipse for Mac

    Electrumpet

      Dear all,

       

      I try to get the GestIC library from microchip working on the Edison. I have already been able to use the makefile in the GestIC SDK to build the example applications in Yocto on the Edison (after installing some extra stuff...) and that works with the Hillstar development board connected to the Edison through the OTG micro USB connection. (running the application while being ssh-ed into the Edison).

       

      The next step is to make my own application and I wanted to do that using the Eclipse IDE for development. I have tried a few example programs in the IDE and that works.

       

      I have been breaking my head now for a few weeks to get the GestIC package working in Eclipse but to no avail thus far.

       

      I have included the header files folder into the includes of the project. Furthermore I have included the paths to both the header files and the library...

       

      Still the compiler can't find the header files while they are in plain side in the includes:

       

      The most simple program to see if the GestIC works is this one:

       

       

      #include <gestic_api.h>

      #include <stdio.h>

       

       

      int main()

      {

          printf("Using the GestIC SDK %s\n", gestic_version_str());

          return 0;

      }

      And the result:

      ../src/gestICconnect.c:1:24: fatal error: gestic_api.h: No such file or directory

       

       

      I have been searching and searching and came across this post in the community that has now been closed:

      Help on using the iotkit-comm library in Eclipse 

       

      This seems to suggest that I should make the used files part of the image that is used by Eclipse. The method to accomplish that is described for Windows while I am on Mac and the include folders in eclipse are greyed out in my case.

       

      Should I copy the files to the suggested folder in the Docker image? I don't know how to change the Docker file and then make sure that that new image is used by Eclipse without screwing things up...

       

      Of course the files are already on the Edison itself... Maybe there is a way to let the Docker image reflect what is actually on the Edison so I can then link to it?

       

      I would rather link the files just from my computer. Any help in accomplishing that is welcomed as well....

       

      I hope my question is clear.

       

      Best, Hans.

        • 1. Re: Adding header files and library in Eclipse for Mac
          Electrumpet

          Maybe I should add that when I look at the build process I see this:

           

          docker exec -i 590cfd5f96e569763121b4447ee86b413a549fa71b907b0801ed38f1d64e077e /bin/bash -c "cd /workspace/gestIC_connection/Debug && i586-poky-linux-gcc -I/usr/include/mraa -I/Users/hansleeuwoud/Documents/newGestIC/apps/Linux/build/bin -I/Users/hansleeuwoud/Documents/newGestIC/api/include

           

          The prefix for the Docker image mraa include (-l) is exactly the same as the prefix for the include files and libraries for the SDK. Is that the root of the problem?

           

          Best, Hans.

          • 2. Re: Adding header files and library in Eclipse for Mac
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hello Hans,

            Thanks for reaching out!

            I've not much experience with Eclipse on OSX, but I found some documents online and I thought that perhaps they are of help.

            http://stackoverflow.com/questions/16469764/mac-osx-adding-libraries-to-c-specifically-gnuplot
            http://stackoverflow.com/questions/4435067/adding-boost-library-to-a-c-project-in-os-x-eclipse

            I hope this information helps you,
            Pedro M.

            • 3. Re: Adding header files and library in Eclipse for Mac
              Electrumpet

              Hi Pedro,

               

              Thanks for the suggestions but this is a little different I think. I found a solution though by copying stuff to the docker container. I will post it soon. My library and header files are now visible but compilation wise I have not succeeded yet. Getting there (hopefully).

               

              Best, Hans.

              • 4. Re: Adding header files and library in Eclipse for Mac
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                I understand, we'd appreciate if you share this with the community (when you are ready, of course) as this will probably help a lot of users with similar scenarios.

                Please keep us updated and if you have any questions, please let us know and we'll try our best to help you.
                Pedro M.

                • 5. Re: Adding header files and library in Eclipse for Mac
                  JaeHyuk

                  Hello Hans.

                   

                  I have same problem about it. I can't include external library into my eclipse project for mac and can't compilation. Could you share how to solve your problem?

                   

                  Regards,

                   

                  JaeHyuk.

                  • 6. Re: Adding header files and library in Eclipse for Mac
                    Electrumpet

                    Hi JaeHyuk,

                     

                    Did you already work with the docker container?

                    You will have to use Docker to be able to put files into the docker container. There is a good tutorial on Lynda that explains what docker is. You don't have to watch all of it but it gives you a clue to what it is exactly and for some basic getting around.

                     

                    Eclipse starts up a docker container when it starts (actually the same one each time). I mostly start up docker quickstart terminal first and then start Eclipse so the docker container is opened using the active virtual box from docker quickstart.

                     

                    Now you can find the docker container that is used by Eclipse by typing in the terminal 'docker ps' and you will get the credentials of the active docker container that is used by Eclipse:

                    IDhome096:~ hansleeuwoud$ docker ps

                    CONTAINER ID        IMAGE                                   COMMAND             CREATED             STATUS              PORTS                   NAMES

                    590cfd5f96e5        inteliotdevkit/intel-iot-yocto:latest   "/bin/bash"         5 months ago        Up 16 seconds       0.0.0.0:32768->22/tcp   intel-iot-yocto-EdisonWorkspace-407601000

                     

                    That last name is important because you use that to get into the docker container:

                     

                    docker exec -t -i --privileged intel-iot-yocto-EdisonWorkspace-407601000 /bin/bash;

                    bash-4.3#

                     

                    Now we are in the container. You can type ls:

                     

                    bash-4.3# ls

                    bin  boot  dev etc  home  lib lost+found  media  mnt opt  proc  run sbin  sketch  sys  tmp usr  var  workspace

                    We are now in the root directory of the Docker container.

                    You will have to place your includes somewhere where you can find it. I put my files in usr/include;

                     

                    bash-4.3# cd usr/include

                    bash-4.3# ls

                    3DTouchPad_SDK_0.9 aws_iot_log.h     ctype.h       etip.h grp.h   libcgroup       mraa.hpp       poll.h   spawn.h ucontext.h

                    FlexLexer.h aws_iot_mqtt_interface.h    curl       execinfo.h gshadow.h   libcgroup.h       mtd       printf.h   sqlite3.h ulimit.h

                    GestIC_SDK_1.2.0 aws_iot_shadow_actions.h    curses-32.h       expat.h gudev-1.0   libgen.h       multitree.h    protocols   sqlite3ext.h unctrl.h

                    My added packages are the 3DTouchPad_SDK and the GestIC_SDK_1.2.0. There are actually a lot more packages there but I only show the beginning where my packages are situated as well.

                    You can keep the libraries in these folders as well, but know the path to these libraries (the .a and .so files in linux)

                     

                    You can exit the docker container by typing 'exit' and you will be back in the 'normal' mac terminal:

                     

                    bash-4.3# exit

                     

                    To run things on the Edison these libraries have to be on the Edison as well. (at least in my case). On the Edison you have to place them in the libraries folder that is either:

                    /lib

                    or

                    /usr/lib

                     

                    Take a look. You will find the libupm and libmraa files there as well (also in the docker container).

                     

                    To copy things from your computer to the docker container you can use 'docker cp' and the name of your Docker container. To copy the afore mentiond 3DTouchPad_SDK_0.9 onto the Edison (root folder) I first navigated to the folder on my computer where I kept the package and then used the 'docker cp' command:

                    docker cp 3DTouchPad_SDK_0.9/ intel-iot-yocto-EdisonWorkspace-407601000:/3DTouchPad_SDK_0.9/

                     

                    To copy folders between the Edison and your computer this won't work. You can use a shared folder and use sshfs to do this (for which you have to install home-brew first)

                     

                    Hope this helps.

                     

                    Best, Hans.

                    • 7. Re: Adding header files and library in Eclipse for Mac
                      Electrumpet

                      Docker quickstart terminal has to be downloaded. Actually I have to use it because my mac system is 10.9.5 and I cannot upgrade because of my hardware. There is a new application that you can use on system 10.10 and higher.

                       

                      The docker WEBsite:

                      Docker - Build, Ship, and Run Any App, Anywhere

                       

                      Best, Hans.