# Building GMT in windows

**URL:** <https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370>\
**Category:** Q&A\
**Created:** [October 23, 2023, 1:44pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370 "2023-10-23T13:44:11Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 23, 2023, 1:44pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/1 "2023-10-23T13:44:11Z")

</div>

I’ve been following the installation instruction given in this link: - [[gmt/BUILDING.md at master · GenericMappingTools/gmt · GitHub](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md)] using minGW linux emulator in windows, except for the ‘vcpkg part’ i have followed everything and ive installed vcpkg package directly through pacman command in minGW.

but execution of command " cmake --build . --config Release " is faliing with error i have attached in picture.

can someone help me with this error, i am trying to build GMT for almost a month.

 ![2023-10-23_19-13-25](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/1/15230fb19314231b97f847350a37c88fc75751da.png)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [October 23, 2023, 2:38pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/2 "2023-10-23T14:38:54Z")

</div>

You have certainly chosen the hard way to do this. Anyway, doring the cmake step, do you get

**– Looking for fseeko**  
**– Looking for fseeko - found**

Looks like HAVE\_FSEEKO is not getting set - perhaps no Posix functions? @Joaquim may have more info.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [October 23, 2023, 3:41pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/3 "2023-10-23T15:41:48Z")

</div>

Why not install WSL instead of using mingw? Instruction for Debian/Ubuntu applies.

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 24, 2023, 8:59am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/4 "2023-10-24T08:59:53Z")

</div>

Hey, I am trying to install GMT on the company’s laptop and they don’t allow me to directly install software WSL is not in their software centers, conda is there but the conda-forge command is not working in it, also pygmt installation has issue with the DLL files, so only way was to build it and this way also i am facing this issue.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [October 24, 2023, 10:26am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/5 "2023-10-24T10:26:32Z")

</div>

Any update on fseeko etc and other things it says is missing in your libs?

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 24, 2023, 12:17pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/6 "2023-10-24T12:17:27Z")

</div>

no, its not there, i mean if you talking about C files in src directory then its not there.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [October 24, 2023, 12:32pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/7 "2023-10-24T12:32:14Z")

</div>

I am not talking about C files in the GMT src directory. fseeko etc are basic standard Posix library function that your minGW libraries should provide. Since Cmake did not find what is needed then we are stuck. This is not a problem on Line, Windows, or MacOS, only on odd-ball systems like MinGW or Cygwin, perhaps. Not much we can do since I dont operative on those systems so cannot try things out. We would need your help to figure it out on your system and if that is something we can add to our checks for installation then we can do that. Suggest you look at those errors again and do some googling like ftello not found on MinGW etc and see what you get.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [October 24, 2023, 11:45pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/8 "2023-10-24T23:45:56Z")

</div>

Hmm, I must have changed something in settings as I’m not receiving e-mail warnings of forum posts.

First thing. Please do not post screen-captures with microscopic characters. I won’t even try to read them. Just text, no SCs with text.

Regarding the problem itself I don’t know. It works for me and also in the recipe for building the GMT artifact for Julia that uses MinGW for the Windows build

> <https://github.com/JuliaPackaging/Yggdrasil/blob/master/G/GMT/build_tarballs.jl#L32>

(and WSL is no true alternative to _pure_ Windows versions. File permissions just screw too much)

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 25, 2023, 9:03am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/9 "2023-10-25T09:03:48Z")

</div>

Hey, I have tried to look into it, and it build up to some extent, and now only one thing is failiing which is.  
“Linking C shared library src\gmt.dll  
FAILED: src/gmt.dll src/gmt.dll.a”  
and at the end it says  
“ninja: build stopped: subcommand failed.”

i have looked in the src directory and only gmt.dll.a file is there not simple gmt.dll file

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 27, 2023, 10:36am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/10 "2023-10-27T10:36:47Z")

</div>

And I’ve tried installing pygmt as well in python, but I am facing same DLL issue here as well. installation of pygmt is complete but when i import pygmt in python it gives an error as follows:

"  
GMTCLibNotFoundError: Error loading GMT shared library at ‘gmt.dll’.  
Could not find module ‘gmt.dll’ (or one of its dependencies). Try using the full path with constructor syntax.  
Error loading GMT shared library at ‘gmt\_w64.dll’.  
Could not find module ‘gmt\_w64.dll’ (or one of its dependencies). Try using the full path with constructor syntax.  
Error loading GMT shared library at ‘gmt\_w32.dll’.  
Could not find module ‘gmt\_w32.dll’ (or one of its dependencies). Try using the full path with constructor syntax.  
"

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [October 27, 2023, 10:48am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/11 "2023-10-27T10:48:02Z")

</div>

Pinging @Joaquim

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [October 27, 2023, 1:10pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/12 "2023-10-27T13:10:00Z")

</div>

I don’t know. It works fine for me. I always found the MinGW an horrible mess with multiple distributions and a total confusion between MinGW and MSYS. My guess is that it’s a faulty installation. I think I installed this one [https://www.msys2.org/](https://www.msys2.org/)

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [October 30, 2023, 10:12am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/13 "2023-10-30T10:12:58Z")

</div>

Hi Joaquim, i tried using this software as well, starting from uninstalling mingw and again installing this software, some progress is there in building GMT but still it is giving only one error now and that is of gmt.dll file only.  
“FAILED: src/gmt.dll src/gmt.dll.a”  
which is not there in src folder, if you have this DLL file maybe you can share this so i can see whether its working or not  
because i guess now its not issue with minGW, its issue with the DLL file only

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [October 30, 2023, 1:57pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/14 "2023-10-30T13:57:36Z")

</div>

I don’t have one right now because I build GMT with Visual Studio but you can get a full build from

> **[Release GMT-v6.4.3+0 · JuliaBinaryWrappers/GMT\_jll.jl](https://github.com/JuliaBinaryWrappers/GMT_jll.jl/releases/tag/GMT-v6.4.3+0)**

It’s the [https://github.com/JuliaBinaryWrappers/GMT\_jll.jl/releases/download/GMT-v6.4.3%2B0/GMT.v6.4.3.x86\_64-w64-mingw32.tar.gz](https://github.com/JuliaBinaryWrappers/GMT_jll.jl/releases/download/GMT-v6.4.3%2B0/GMT.v6.4.3.x86_64-w64-mingw32.tar.gz)

Don’t mind the name. It’s GMTdev built at 8 September.

---

<div class="post-metadata">

**Author:** ![Brock1729](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Brock1729](https://forum.generic-mapping-tools.org/u/Brock1729)\
**Post date:** [November 7, 2023, 12:13pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/15 "2023-11-07T12:13:22Z")

</div>

Hi @Joaquim and @pwessel, i have switched from MinGW to Cygwin and it is installed in Cygwin, looks like there is problem in MinGW gcc compiler only,  
But when i am running simple gmt shell file in terminal its now saving ps file properly.  
like i have taken this code from tutorial only

“ctr=”-Xc -Yc"  
gmt pscoast -R-130/-70/24/52 -JB-100/35/33/45/6i -Ba -B+t"Conic Projection" -N1/thickest -N2/thinnest -A500 -Ggray -Slightblue -Wthinnest -P $ctr \> GMT\_figure8.ps"

when i am running this shell script its saving ps like ps. something placing . after ps  
attched picture also for reference

 ![Screenshot 2023-11-07 174259](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/c/c1d252eb7321c0315043acecca108e03c5060cb0.jpeg)

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [November 7, 2023, 12:43pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/16 "2023-11-07T12:43:01Z")

</div>

> [@Brock1729](#):
>
> GMT\_figure8.ps"

seems like that double quote after GMT\_figure8.ps has become a part of the file name. remove it.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 7, 2023, 12:44pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-in-windows/4370/17 "2023-11-07T12:44:00Z")

</div>

Well, GMT has nothing to do with that. It is you who are creating files with redirection to the output file. GMT is not even aware that there is a file - it writes to stdout.
