Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. need help compiling library...
Forum Updated to NodeBB v4.3 + New Features

need help compiling library...

Scheduled Pinned Locked Moved Solved QtonPi
15 Posts 3 Posters 3.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CharlesHuff
    wrote on 30 Oct 2018, 22:32 last edited by
    #6

    Thanks, this was very helpful....

    1 Reply Last reply
    0
    • C Offline
      C Offline
      CharlesHuff
      wrote on 31 Oct 2018, 20:13 last edited by
      #7

      Pablo,
      Step 1,2,3,4 i followed ok. Step 5 didn't see any .h file, so i right clicked on Headers, then add existing directory, navigated to sFoundation, clicked on Parse, then clicked Ok. This step added all the .h files (much faster than typing them in by hand!)
      I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.
      I installed Qtcreator on the pi itself. Is that why i get warnings? I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch. Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

      P 1 Reply Last reply 31 Oct 2018, 20:32
      0
      • C CharlesHuff
        31 Oct 2018, 20:13

        Pablo,
        Step 1,2,3,4 i followed ok. Step 5 didn't see any .h file, so i right clicked on Headers, then add existing directory, navigated to sFoundation, clicked on Parse, then clicked Ok. This step added all the .h files (much faster than typing them in by hand!)
        I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.
        I installed Qtcreator on the pi itself. Is that why i get warnings? I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch. Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

        P Offline
        P Offline
        Pablo J. Rogina
        wrote on 31 Oct 2018, 20:32 last edited by
        #8

        @CharlesHuff said in need help compiling library...:

        Step 1,2,3,4 i followed ok.
        Step 5 didn't see any .h file

        if you don't have any .h files by following steps 1-4 something went wrong... Anyway, those steps are not really necessary if you use the .pro file I provided. They were there just to explain how I created such .pro file

        I still didn't see anything that seemed to be unneeded by QT? I went ahead and did a qmake, clean all, and build all. I got the same 647 warnings as before.

        Please try using the provided .pro file. In Ubuntu x64 I've just got only 4 warnings

        I installed Qtcreator on the pi itself. Is that why i get warnings?

        How did you installed Qt Creator on the RPi? Did you build it? or just did apt-get install?

        I think the pi is 64 bit, but have read that the Raspbian is still 32 bit? I am using Raspbian Stretch.

        Raspberry Pi 3 is ARM 64 bit, but Raspbian is just 32 bit as they created just one distribution for all different boards (1, 2, Zero, 3, etc) There are other distributions targeting aarch64 if you like/need that (i.e. Alpine Linux)

        Should I build the library on Linux Ubuntu? If I do that, will it then work on the Raspbian Stretch? Will it fix the warnings?

        If you plan to build the library in Linux Ubuntu you will need to consider doing cross-compile

        Please be aware, that all in all you don't need Qt Creator or Qt framework at all to build this library for ARM architecture.
        However, once you do actually build the library you'll be able to use it in a Qt application via Qt Creator if you like.

        You may want to check this tutorial about Qt Creator for RPi

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        1
        • C Offline
          C Offline
          CharlesHuff
          wrote on 31 Oct 2018, 20:54 last edited by
          #9

          @Pablo-J.-Rogina said in need help compiling library...:

          tutorial

          Pablo,
          I have a machine with Ubuntu (not sure how to tell if it's x64)?
          Will the compiled library on Ubuntu work on the Raspberry?
          I installed the Qt creator:
          sudo apt-get install qt5-default
          sudo apt-get install qtcreator
          uninstall a plugin, "Remote Linux" from "About Plugins...", which
          is under "Help" menu
          find "Remote Linux" and you need to uncheck it and restart QtCreator.
          setup the path of gcc and gdb from "Options..." under "Tools" on menu.
          Go to "Build & Run" and click "Tool Chains" tab. Click "Add" and add "GCC".
          Fill out the form: "Compiler path" and "Debugger".
          you can figure it out by a command "whereis gcc, whereis gdb".
          set the path of make from the tab "QtVersions".
          Make sure you see "Desktop" on the bottom after you set the path of "qmake".
          I don't think I need cross compile. I am trying to go the easiest way. My program will be only a couple of screens with buttons.
          Cross compile on Mac does not seem to be possible... but I came closer on Ubuntu. I never really got cross compile to work right so I decided to trade ease of compile for speed and opted to do it all on Raspberry...

          J 1 Reply Last reply 31 Oct 2018, 21:26
          0
          • C CharlesHuff
            31 Oct 2018, 20:54

            @Pablo-J.-Rogina said in need help compiling library...:

            tutorial

            Pablo,
            I have a machine with Ubuntu (not sure how to tell if it's x64)?
            Will the compiled library on Ubuntu work on the Raspberry?
            I installed the Qt creator:
            sudo apt-get install qt5-default
            sudo apt-get install qtcreator
            uninstall a plugin, "Remote Linux" from "About Plugins...", which
            is under "Help" menu
            find "Remote Linux" and you need to uncheck it and restart QtCreator.
            setup the path of gcc and gdb from "Options..." under "Tools" on menu.
            Go to "Build & Run" and click "Tool Chains" tab. Click "Add" and add "GCC".
            Fill out the form: "Compiler path" and "Debugger".
            you can figure it out by a command "whereis gcc, whereis gdb".
            set the path of make from the tab "QtVersions".
            Make sure you see "Desktop" on the bottom after you set the path of "qmake".
            I don't think I need cross compile. I am trying to go the easiest way. My program will be only a couple of screens with buttons.
            Cross compile on Mac does not seem to be possible... but I came closer on Ubuntu. I never really got cross compile to work right so I decided to trade ease of compile for speed and opted to do it all on Raspberry...

            J Offline
            J Offline
            JonB
            wrote on 31 Oct 2018, 21:26 last edited by
            #10

            @CharlesHuff

            I have a machine with Ubuntu (not sure how to tell if it's x64)?
            Will the compiled library on Ubuntu work on the Raspberry?

            Umm, I don't think so.

            1 Reply Last reply
            1
            • C Offline
              C Offline
              CharlesHuff
              wrote on 1 Nov 2018, 07:33 last edited by
              #11

              Ignoring the 600 plus warnings seems to work ok. I don't see them when I link the dynamic library into my project (I know they are still there, but it's working).

              Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator? I cannot simply call the functions via signals and slots as I hoped. I guess I need to somehow declare the "SysManager myMgr;" as "global" in scope. sorry I am such a newbie...

              Thanks again Pablo....

              P 1 Reply Last reply 1 Nov 2018, 11:52
              0
              • C CharlesHuff
                1 Nov 2018, 07:33

                Ignoring the 600 plus warnings seems to work ok. I don't see them when I link the dynamic library into my project (I know they are still there, but it's working).

                Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator? I cannot simply call the functions via signals and slots as I hoped. I guess I need to somehow declare the "SysManager myMgr;" as "global" in scope. sorry I am such a newbie...

                Thanks again Pablo....

                P Offline
                P Offline
                Pablo J. Rogina
                wrote on 1 Nov 2018, 11:52 last edited by
                #12

                @CharlesHuff said in need help compiling library...:

                , but it's working).
                ...
                Is there a good tutorial that could show me the way to use the axis.h and axis.cpp as a class in Qt Creator?

                Please don't bury a completely different question in this post. If you think this issue is working for you, go and mark the post as solved and then open another post with the question for the chart...

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                1
                • C Offline
                  C Offline
                  CharlesHuff
                  wrote on 1 Nov 2018, 15:50 last edited by
                  #13

                  Yes Sir, I marked it solved. Many parts of my question are solved and working. I think the warnings are due to the change to Raspberry pi format, but I am not sure of that. Maybe now I can gain enough knowledge to actually use this library...

                  Thank you again.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    CharlesHuff
                    wrote on 8 Nov 2018, 04:39 last edited by
                    #14

                    I followed your instructions to the letter and got the library built on the raspberry... yay!

                    I decided to try to build the same library on linux 'ubuntu' because it's so slow on the raspberry pi 3. I didn't yet get to the cross compile because the library does not compile. Qt gives the same fatal error twice: Ordered comparison between pointer and zero: char * and int.....

                    I am running apt-get update and apt-get upgrade now. Guess I will go back to the raspberry...

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      CharlesHuff
                      wrote on 8 Nov 2018, 16:46 last edited by
                      #15

                      Errors in compile.....
                      MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
                      {
                      comHubPorts.clear();
                      FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
                      if ( pfd <= 0 )
                      {
                      throw std::runtime_error( "Command or process could not be executed." );
                      }
                      while ( !feof(pfd) )
                      {
                      char buf[ 1024 ] = {0};
                      if ( fgets(buf, sizeof(buf), pfd) > 0 )
                      {
                      std::string str(buf);
                      // TODO: check the VID/PID of the device using udevadm/libudev to
                      // verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
                      comHubPorts.push_back(str.substr(0, str.length()-1));
                      }
                      }
                      pclose( pfd );
                      return MN_OK;
                      }
                      ERRORS FIXED BY:
                      MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
                      {
                      comHubPorts.clear();
                      FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
                      if ( !pfd )
                      {
                      throw std::runtime_error( "Command or process could not be executed." );
                      }
                      while ( !feof(pfd) )
                      {
                      char buf[ 1024 ] = {0};
                      if ( fgets(buf, sizeof(buf), pfd) != NULL)
                      {
                      std::string str(buf);
                      // TODO: check the VID/PID of the device using udevadm/libudev to
                      // verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
                      comHubPorts.push_back(str.substr(0, str.length()-1));
                      }
                      }
                      pclose( pfd );
                      return MN_OK;
                      }
                      If you use this fix, I must warn that I have no idea if it is the CORRECT way to fix the compile error.

                      1 Reply Last reply
                      0

                      15/15

                      8 Nov 2018, 16:46

                      • Login

                      • Login or register to search.
                      15 out of 15
                      • First post
                        15/15
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved