It’s possible to build GEOtop with static and shared linking method. However, it’s not possible to build the source code through Microsoft Visual Studio at the moment. So that, it’s necessary to install Cygwin as following described.
1. Cygwin installation
Download the executable from the Official Web Site on the basis of your machine (32-64bit)
Run the executable and click Next
until arriving at Choose Download Site.
Now, choose a repository from which download the packages to install. Then click Next
and you should see a window like the following
Expand the Archive Libs section and select the following packages
- libbz2-devel
Expand the Devel section and select the following packages
- autoconf2.5
- cmake
- cmake-gui
- gcc-core
- gcc-g++
- git
- make
- patch
Now type proj
in the Search area
Expand the section Libs
Click on Skip on each on of the three proj
libraries:
libproj-devel
libproj1
proj
Then click on Next
Then click on Next again, in order to install all the required dependencies. At the end of the installation, you should find an icon on the Desktop and one on the Start Menu.
2. Bulding GEOtop: static linking
First of all, open the Cygwin terminal (a link should be available on the Desktop). Enter inside your user home typing:
where user
is your username. Now create a folder where put the source codes, e.g. src
, and enter into it.
Now you need the MeteoIO source code and then you have to build it. Unfortunately, in order to make it works with Cygwin you should apply a patch to the official version. I created the patched version od the MeteoIO 2.4.2 source code and then I uploaded it on GitHub, so you can easily clone and build it.
set the following flags
build_shared_libs
to OFFbuild_static_libs
to ON
and the other one
PROJ4
to ON
Now you have to build the Boost library. First of all, you can get tar.gz package from http://sourceforge.net/projects/boost/files/boost/1.58/, then move the package inside the src
folder. Extract the source code and then enter into the folder
Now, to configure and then build and install the Boost library, type
Now, the last step is building GEOtop. You can clone it from the GitHub repository, inside the src
directory
You might get the following Warning message:
CMake Warning at /usr/share/cmake-3.3.2/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-3.3.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:15 (project)
Linking mode: SHARED
Just ignore it and press e
to exit. Then switch the flag BUILD_STATIC
to ON, then
at the end start building the source code
To have the geotop.exe
working from within each and every folder of your pc, you have to Add C:cygwinbin
for 32bit pc or C:cygwin64bin
for 64bit pc to the environmental variables.
Click on Start-> Computer-> System properties-> Advanced system settings-> Environment Variables
, scroll down the System variables section looking for Path variable
double click on it and add the first item if your operating system is 32bit, the second one if it is 64bit. Pay attention that the initial semicolon is not a mistake, it’s the separator with the previous value.
;C:cygwinbin;C:cygwinusrlocalbin
;C:cygwin64bin;C:cygwin64usrlocalbin
Then you can call the geotop.exe
executable from within each folder in your system.
Thanks Francesco very useful!
My Mac recently crashed and I need to work on Windows …
but …
when I am here I asks for Passwords and Unsername …
$ git clone https://github.com/sidereus3/MeteoIO-2.4.2.patched
Cloning into ‘MeteoIO-2.4.2.patched’…
Username for ‘https://github.com’:
Password for ‘https://github.com’:
Thanks Giacomo for your feedback!
That’s my fault, the url I wrote in the guide is wrong (typo…sorry!)
The correct url is https://github.com/sidereus3/MeteoIO-2.4.2_patched, thus the command becomes
[code language=””]
$ git clone https://github.com/sidereus3/MeteoIO-2.4.2_patched.git
[/code]
Try this way, should work! Now I fix the guide immediately.
Thanks again! If you have any other kind of problem, just let me know!
Francesco,
Later when I make ccmake .
I got the following error:
Do you know how to fix it?
Thanks!
Giacomo
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-3.3.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:5 (PROJECT)
CMake Error at /usr/share/cmake-3.3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler “/usr/bin/cc” is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/GBertoldi/src/MeteoIO-2.4.2_patched/CMakeFiles/CMakeTmp
Errors occurred during the last pass
Hi Giacomo,
that one is just a Warning and nothing more. You can totally ignore it. In order to be clearer, I’m going to add the complete message on the guide.
What version of WIN7 are you using? 32bit or 64bit?
I tested the procedure on my own version of WIN7 32bit and it worked for me. If some steps are not clear enough, just let me know. Unfortunately, this guide is not so straightforward and it requires the solution of some small tricks to get to the end.
Cheers,
francesco
Greetings Francesco, thanks for the very useful and clear guide. With some minor troubleshooting, I have made it all the way to the final step (“make” GeoTop) before encountering the following error. I am using the latest version of GeoTop (https://github.com/geotopmodel/geotop) on 64-bit Windows 10. I am a novice to C++ but based on my familiarity with Fortran it seems there may be some variables that are not correctly defined as related to the MeteoIO plugin. I tried reinstalling the patched plugin from the git repository, but that didn’t seem to fix the problem. Any advice would be much appreciated!
[email protected] ~/src/geotop
$ make
[ 7%] Built target gt_utilities
[ 26%] Built target geotopCommon
[ 30%] Built target geotopPartSnow
[ 31%] Building CXX object src/meteoio_plugin/CMakeFiles/meteoioplugin.dir/meteoioplugin.cc.o
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc: In function ‘void hnw_correction(Par*, std::vector&)’:
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:206:19: error: ‘PSUM’ is not a member of ‘mio::MeteoData’
hnw = meteo[ii](MeteoData::PSUM);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:220:14: error: ‘PSUM’ is not a member of ‘mio::MeteoData’
meteo[ii](MeteoData::PSUM) = par->raincorrfact * rain + par->snowcorrfact * snow;
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc: In function ‘void merge_meteo_data(mio::Date&, std::vector&)’:
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:244:30: error: ‘TAU_CLD’ is not a member of ‘mio::MeteoData’
const size_t cloud_index = MeteoData::TAU_CLD;
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:256:33: error: ‘PSUM’ is not a member of ‘mio::MeteoData’
(*it2)(hnw_matteo) = (*it)(MeteoData::PSUM);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:267:6: error: ‘class mio::IOManager’ has no member named ‘add_to_points_cache’
io->add_to_points_cache(current, meteo);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc: In function ‘void meteoio_interpolate_cloudiness(Par*, const double&, GeoMatrix&, GeoVector&)’:
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:510:13: error: ‘TAU_CLD’ is not a member of ‘mio::MeteoData’
meteo[i](MeteoData::TAU_CLD) = (tau_cloud_vec[i+1] == geotop::input::gDoubleNoValue ? IOUtils::nodata : tau_cloud_vec[i+1]);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:517:7: error: ‘class mio::IOManager’ has no member named ‘add_to_points_cache’
io->add_to_points_cache(d1, meteo);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:541:30: error: ‘TAU_CLD’ is not a member of ‘mio::MeteoData’
io->interpolate(d1, dem, MeteoData::TAU_CLD, pointsVec, resultCloud);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:553:31: error: ‘TAU_CLD’ is not a member of ‘mio::MeteoData’
io->getMeteoData(d1, dem, MeteoData::TAU_CLD, cloudwgrid);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc: In function ‘void meteoio_interpolate(Par*, double, Meteo*, Water*)’:
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:624:39: error: ‘PSUM’ is not a member of ‘mio::MeteoData’
io->getMeteoData(current_date, dem, MeteoData::PSUM, hnwgrid);
^
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc: In function ‘void meteoio_interpolate_pointwise(Par*, double, Meteo*, Water*)’:
/cygdrive/c/Users/Sam/src/geotop/src/meteoio_plugin/meteoioplugin.cc:749:28: error: ‘PSUM’ is not a member of ‘mio::MeteoData’
io->interpolate(d1, dem, MeteoData::PSUM, pointsVec, resultHnw);
^
make[2]: *** [src/meteoio_plugin/CMakeFiles/meteoioplugin.dir/build.make:63: src/meteoio_plugin/CMakeFiles/meteoioplugin.dir/meteoioplugin.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:807: src/meteoio_plugin/CMakeFiles/meteoioplugin.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
Hi Sam,
thank you very much for commenting on my post. If I were you, instead of spending time in building GEOtop under Windows, I would go for the Dockerized version of GEOtop which is the future for modelling as well, in my personal opinion. I’m going to write a post as soon as possible on how this solution is easy, fast and maintainable.
Please, take a look at the link above and if you encounter any problem, please let me know.
Ciao,
francesco
Hi Sir.. I think I got all the step done correctly but I can generate after cloning geotop and configuring BUILD_STATIC to ON. how do i solve this? Im using Win7 32bit
Hi Edward,
I cannot really understand what is the issue? Can you please provide more informations?
After cloning geotop, I ran ccmake . and turn build_static to ON. but nothing happened when I want to generate. and this message pop up when i pressed configure:
CMake Error at /usr/share/cmake-3.6.2/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.
Boost version: 1.58.0
Boost include path: /usr/local/include
Could not find the following Boost libraries:
boost_regex
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:70 (FIND_PACKAGE)
Linking mode: STATIC