Building RTKLIB code in Windows

For most users running RTKLIB in Windows there is probably no need to build their own executables, it’s simpler to just download the pre-built demo5 executables from here or the 2.4.3 executables from here.

However, there are a few reasons why you might choose to download the source code and build your own executables instead. First of all, the pre-built executables are built with a large number of options enabled, but not all options. This means they will work for most user configurations but there are some less common configurations they won’t be able to handle. In addition, because they have so many options enabled, they will run slower and use more memory than executables built with only the minimum required number of options enabled.

Also, the latest available executables will not include the most recent updates to the code, you will need to build your own version to get these. And of course, anyone who wants to make any changes to the code will have to build their own executables.

OK, so let’s say you’ve decided to build your own versions. How do you go about doing it? It’s not a complicated process, most reasonably computer-savvy users would be able to figure it out on their own, but I’ll try to provide a few tips below to make it a little quicker and less painful.

The first step is to download the source code from the Github repository. I will assume you are using the demo5 code which is available here, but the same process will work with the official 2.4.2 or 2.4.3 code as well. Click on the “Code” box on the Github repository page to download the code. If you are familiar with Github you may choose to clone the repository or open with Github desktop but for most users it is probably simplest to just choose the “Download ZIP” option and then unzip the code to your desired location on your local drive.

The next step is to choose your compiler. You can use either Microsoft Visual Studio or Embarcadero C++ Builder. Both have community editions which can be downloaded and used for free for non-commercial use. However, Visual Studio will only build the RTKLIB command line apps, not the GUIs, so unless you already have Visual Studio on your computer and only need the command line apps, I would suggest using the Embarcadero compiler.

Now go back to the RTKLIB code folder you just downloaded and unzipped. Most of the common source code is in the “/src” folder but each RTKLIB app has its own sub-folder inside the “/app” folder. Let’s use RNX2RTKP, the RTKLIB command line post-processing solution app, as an initial example. In the “/app/rnx2rtkp” folder you will see a number of different sub-folders for different build methods.

Build a single app with the Embarcadero C++ Builder

Let’s assume for now you are using the Embarcadero compiler and want to build the 64-bit version of the code. You will want to open the “/bcc_win64” folder and within that folder you will see an Embarcadero project file called “_rnx2rtkp_win64.cbproj”. Double-click on this file to open the 64-bit version of the project in the Embarcadero compiler. If your hardware only supports 32-bit executables, you can select the “/bcc/_rnx2rtkp.cbproj” project file instead. When the compiler opens, it should look something like this:

From the “Project” menu, click on “Make _rnx2rtkp_win64” to compile the code. When done, the result should look like the image below. Make sure it says “Linking: Done” and “Errors: 0”

And that’s it. The result, “_rnx2rtkp_win64.exe”, will be in the “\app\rnx2rtkp\bcc_win64\Release_Build” folder.

The only differences for the GUI apps are that the project files are directly in the app folders rather than in sub-folders and in some cases there are separate app folders for the 32 bit and 64 bit versions. For example, for RTKNAVI, you will find a “app/rtknavi/rtknavi.cbproj” project file and a “app/rtknavi_win64/rtknavi_win64.cbproj” project file.

Build a single command line app with Microsoft Visual Studio.

The instructions for Microsoft Visual Studio are very similar, however you will only be able to build the CONVBIN and RNX2RTKP apps since Visual Studio does not support the GUI apps.

After installing Visual Studio, click on the “msc.sln” project file in the “\app\rnx2rtkp” folder to open the project.

Choose “Build Solution” from the “Build” menu to compile the code. The resulting executable will be in the “app\rnx2rtkp\msc\Release” folder.

The project will default to a 32-bit version but you can add a 64-bit version using the Configuration Manager, just be sure to to check the Build box in the new configuration as shown below.

Building and installing the entire RTKLIB library with the Embarcadero C++ Builder

If you are using the Embarcadero compiler and would like to build all the RTKLIB apps at once instead of one at a time, you can use the “rtklib_consapp.groupproj” and “rtklib_winapp.groupproj” project files in the “/app” folder to build the console apps and GUI apps respectively. From the “Project” menu, select “Make All Projects” for each of these group projects. You will see errors when the GUI project attempts to build the RTKVIDEO and RTKVPLAYER apps but you can ignore these, assuming you don’t plan to use these apps.

After completing the builds, run the batch files “app/install_consapp.bat” and “app/install_winapp.bat” to copy all the executables from the “Release” folders to the single “../RTKLIB_bin/bin” folder. You will need to create the destination folder first to avoid errors when it copies the files.

Modifying the build options with the Embarcadero C++ builder

So far, I’ve assumed you want to build with the default build options but sometimes you will want to change these. I will describe the procedure for the Embarcadero compiler, but the procedure is very similar for Visual Studio.

Open the project in Embarcadero for an individual app and then select “Options” from the Project Menu. Select “C++ Compiler->Directories and Conditionals” from the choices in the left column and then set the “Target” box near the top center to “All configurations – All platforms” as shown in the image below. Click on the three dots at the end of the “Conditional defines” list to open up a list of the current defines.

You can now add or remove any of the “Conditional defines” from the list. The definitions of the default defines are as follows:

WIN32: Use the WIN API – use for 32 bit or 64 bit apps
ENAGLO: Enable GLONASS
ENAGAL: Enable Galileo
ENAQZS: Enable QZSS
ENACMP: Enable Beidou
ENAIRN: Enable IRNSS
NFREQ=3: Max # of frequencies, 3=L1+L2+L5, must be >=2 for u-blox
NEXOBS=3: # of extra observations, used to store multiple codes per freq

Other optional defines are:

ENALEO: Enable LEO
ENALEX: Enable QZSS LEX extension
WIN_DLL: Generate Library as Windows DLL

I have not tested any of these optional defines, so no guarantee if any of them work.

Well, I think that’s about it. I’ve probably forgotten something, but this should be enough to get you started.

In my next post, I will cover building the code in Linux.

20 thoughts on “Building RTKLIB code in Windows”

  1. Ended on this page looking for the options in RTKconv, particularly the “ENAGLO” option…

    It started with a struggle of not getting any GLONASS readings in the rinex file exported from BIN raw file coming from a Hemisphere S320 receiver. I then found out here (https://github.com/tomojitakasu/RTKLIB/issues/351) that “-ENAGLO” is to be manually entered in the options field of the RTKconv interface. However, this seems to not be documented anywhere…

    This page along with the “ENAGLO” command lists one “ENA***” commands and i wondering if there is a source for all the possible commands one can additionally use in RTKconv???

    Not the issue i am experiencing is that the RTKconv-derived rinex3.04 file does not have SBAS values, while the file exported from the same raw *.bin using the Hemisphere in-house software calles RINEX-Desktop does have the values. So i was wondering if a command similar to “enaglo” is to be used…

    Like

    1. I have not used a Hemisphere receiver with RTKLIB, but looking at the source code, I see that there is an undocumented “-ENAGLO” receiver option for the Hemisphere receivers. There are no other “-ENA???” receiver options so that is not your issue. Appendix D.5 of the RTKLIB user manual list receivers options for each receiver type but is somewhat out of date and does not include all receiver options that have been added more recently. Looking at the input_???() functions in the /rcv subfolder in the source code is the only way to be certain you are seeing all available options. It looks like there is only limited support for SBAS satellite messages in the crescent.c file where the Hemisphere message support functions reside. You will need to look at those to see if the message type you are trying to decode is supported.

      Like

  2. Hi Tim,
    I would want to build RTKRCV under windows, either using Visual studio (which is my preferred option) or the GCC. However, some of the header files are not available. More specifically:
    #include <unistd.h>

    #include <sys/time.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netinet/tcp.h>
    #include <arpa/inet.h>
    #include <netdb.h>

    Now, I understand that <unistd.h> can be replaced by <windows.h>, but what about the others? I have also tried GCC (I used the makefile in RTKLIB-rtklib_2.4.3\app\consapp\rtkrcv\gcc), but I got an error (../rtkrcv.c:47:10: fatal error: sys/socket.h: No such file or directory) for sys/socket.h

    Thank you,

    Andrea

    Like

    1. Hi Andrea. As you mention, RTKRCV does not compile in Windows. My understanding is that this is because windows doesn’t support the pthread library that RTKRCV uses for multithreading. I don’t know the details on how hard it would be to change this.

      Like

  3. Tim,
    I was able to repeat your Ubuntu build, works great, thanks! Out of curiosity, what’s the challenge with building RTKLIB (GUI versions) with Visual Studio? Are there some specific Embarcadero GUI libs that are used in the build? Don

    Like

  4. I have found a possible issue with RTCM MSM7 message for the BeiDou satellite system in str2str for the rtklib demo5 release. By using SNIP and using the RTCM3 decoder I could see that no data in RTCM msg 1127 for L1 was visible, L2 did have data attached. At line 181 and 182 in ublox.c I changed the return code to CODE_L1I, after this change L1 portion did contain data. Another observation was that I have not seen any BeiDou satellites with SVID higher than 28, in the interface documentation Ublox says they should handle BeiDou satellites up to 37. I am using the latest firmware for my ZED-F9P device. Another small issue I saw was that in RTCM 1005 and 1006 the Galileo bit was not set, I than changed line 526 and 556 in rtcm3e.c to setbitu(rtcm->buff,i, 1,1 … instead of setbitu(rtcm->buff,i, 1,0 …
    I should also add that I am using str2str in raw ubx mode.

    I am not sure if CODE_L1I should be returned for both sigid 0 and 1
    Tank you very much for keeping the rtklib project alive

    Like

    1. Hi Assar. I believe you must not be using the latest version (b33e) of the demo5 code since at least some of the issues you mention have been fixed over the last year and a half. Can you try again with the latest code and verify if that helps?

      Regarding the Beidou codes, my understanding from the latest RINEX documentation is that B1 (1561.098 MHz) should use the C2/L2/D2/S2 codes and B2 (1207.140 MHz) should use the C7/L7/D7/S7 codes and this is how I’ve set up the conversion. The C2/L2/D2/S2 codes are processed as part of the L1/E1/B1 single frequency solution and the C7/L7/D7/S7 codes are processed as part of the L1/E1/B1/L2/E5b/B2 dual frequency solution. The latest firmware for the u-blox F9P (1.13) does not support the B2 coding for many of the newer Beidou satellites, so these only report a single set of B1 observations (C2/L2/D2/S2). I think your proposed change just labels the B1 observation with C1/L1/D1/S1 codes instead of C2/L2/D2/S2 codes but should not affect the solution. Using the “1” would seem logical, but these are reserved for the Beidou 1575.42 Mhz signals. I know, it’s very confusing!!

      Regarding Beidou satellites with SVID between 28 and 37, support for these was only added in the ZED-F9P 1.12 firmware so if you are not seeing these then you most likely need to update your receiver firmware. The latest F9P firmware (currently 1.13) is available for download here

      Like

  5. Hi, as a Ubuntu user, I’m really looking forward to your next post (building RTKLIB in Linux)! I guess I wasn’t aware that there is a QT version, so that will be neat to see. Don

    Like

  6. Embarcadero may well offer a free ‘community edition’, but their website is so badly broken, I’ve never been able to download it. I go jump through their registration hoops, them I’m told:

    ‘The most recent request was denied because it had an invalid security token. Please refresh the page and try again.’

    When I retry, it seems to recognize the email I registered, so it won’t allow me to re-register – I have to ‘login’. When I attempt to login, I get the same message regarding ‘… an invalid security token’. This kind of issue always drives me toward open source solutions. Have you looked at the emlid/reach QT branch?

    Like

    1. Hi Robb. I’ve not run into that myself, and in fact just downloaded the newest version a few days ago without problem. I’d suggest resetting your password if you haven’t already done so and if that doesn’t work, register with a different email account. Regarding the QT versions of RTKLIB code, they have been in the demo5 repository for a long time. I haven’t been actively supporting them, but did just recently fix some build errors in RTKCONV_QT that had been there a while. The QT apps all build now and as far as I know are all fully functional. I plan to cover the build process for them in my next post.

      Like

      1. That’s great – I’m looking forward to your post!
        I would suggest you check out the makefile in the root of the emlid/RTKLIB (reach branch). Having a single makefile that does all the heavy lifting is very helpful. Helping anyone unfamiliar with making the code, obtaining a list of make targets is helpful. On Linux distros with ‘bash-completion’ installed, typing ‘make’, followed by ” will provide a list of make targets. For a more universal (?) solution, there is a small addition to the make file that will list all targets by running ‘make list’ (here: https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile).

        BTW – I noticed running ‘make all’ in the demo5 ‘./apps’ folder does NOT make the QT apps (so I guess ‘all’ is a bit misleading… 😉

        Like

        1. Hi Robb. Thanks, the makefile from Emlid does look like it could be a good addition to the demo5 repository. I will take a closer look at it when I get a chance. The existing makefile in the app folder is leftover from before the Qt apps were added to the repository so should also probably be updated or replaced.

          Like

          1. Clarification of above (dumbing down the syntax to hopefully display properly…):
            On Linux distros with ‘bash-completion’ installed, typing ‘make’, followed by the key sequence space-tab-tab will provide a list of make targets.

            Like

    2. Hi Robb, I had the exactly same problem using Firefox , so tried again using Chrome browser with success, but I guess you could try any other, and just to be sure changed to an alias email. Probably a cookie problem or a pending update on Firefox.

      Like

      1. Thanks for the suggestion. All of my previous attempts were with Chrome, and I had tried creating a new email account (GMail), and tried MSEdge. I just tried again using Firefox with a new email account. After filling out the ‘new customer account’ form, and submitting, the screen refreshed & I was told that my session had expired (it took maybe <2 minutes to fill everything in). I’d say that left the ‘cookie’ possibility, but I’m not sure if cookies are visible across browsers (Chrome, Edge & Firefox), and I’ve tried this on two separate machines.

        I’ve wasted more time than it’s worth obtaining their ‘free’ community tools – I prefer the GCC+QT community.

        Like

        1. Hi, thanks for the site. It has been a great find for me, quite insightful. I am working on a project that involves deployment of rtklib post processing on a server using php, as of now I’m learning php, did do a bit of c++. Any advice you can give me on how to efficiently do this, linking the php site to the rtklib post processing app for a real time post processing in the field. Thanks

          Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.