# Building GMT. CMake warning. Conflict with Anaconda3?

**URL:** <https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891>\
**Category:** Q&A\
**Created:** [May 7, 2022, 12:04pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891 "2022-05-07T12:04:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [May 7, 2022, 12:04pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/1 "2022-05-07T12:04:04Z")

</div>

## Intro

I try to build GMT from scratch (as indicated [here](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md#configuring)) on Ubuntu 20.04.

## Warning

When I run `cmake ..` I got this message (I copy the final of it):

```
...
* GMT_DOCDIR : /usr/local/share/doc
* GMT_MANDIR : /usr/local/share/man
-- Configuring done
CMake Warning at src/CMakeLists.txt:510 (add_library):
  Cannot generate a safe runtime search path for target gmtlib because files
  in some directories may conflict with libraries in implicit directories:

    runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/federico/anaconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at src/CMakeLists.txt:770 (add_library):
  Cannot generate a safe runtime search path for target supplements because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/federico/anaconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at src/CMakeLists.txt:561 (add_executable):
  Cannot generate a safe runtime search path for target gmt because files in
  some directories may conflict with libraries in implicit directories:

    runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/federico/anaconda3/lib

  Some of these libraries may not be found correctly.

-- Generating done
-- Build files have been written to: /home/federico/Software/gmt/build

```

## Error:

Then, when I run `cmake --build . --target install` I get an error.

```
...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libgdal.so: referencia a `TIFFReadScanline@LIBTIFF_4.0' sin definir
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libgdal.so: referencia a `TIFFNumberOfTiles@LIBTIFF_4.0' sin definir
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/gmt.dir/build.make:96: src/gmt] Error 1
make[1]: *** [CMakeFiles/Makefile2:833: src/CMakeFiles/gmt.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
```

---

<div class="post-metadata">

**Author:** ![seisman](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/seisman/32/4_2.png) [@seisman](https://forum.generic-mapping-tools.org/u/seisman)\
**Post date:** [May 7, 2022, 12:15pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/2 "2022-05-07T12:15:36Z")

</div>

That’s because your system have two copies of some library (e.g., `libz.so`), one from Anaconda and another one from the system.

I don’t have a final solution, but there are two workarounds:

1. You can temporarily uncomment conda init settings from shell init script, restart a terminal, and build GMT again. Before building GMT, remember to remove the old build directory completely. After building GMT, you need to restore the conda init settings.

2. You can specify the path to look for the libraries in your `ConfigUser.cmake` file. The folllowing works well for me on macOS. I think changing `/usr/local` to `/usr/lib` or `/usr/lib/x86_64-linux-gnu` for work for you.

```auto
set (GDAL_ROOT "/usr/local/")
set (GEOS_ROOT "/usr/local/")
set (PCRE_ROOT "/usr/local/")
set (NETCDF_ROOT "/usr/local/")

```

---

<div class="post-metadata">

**Author:** ![rmm-san](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rmm-san/32/3080_2.png) [@rmm-san](https://forum.generic-mapping-tools.org/u/rmm-san)\
**Post date:** [May 4, 2023, 6:20pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/3 "2023-05-04T18:20:28Z")

</div>

@seisman and @Esteban82 kindly, did you find a solution for this issue? I am using Ubuntu 22.04, and getting the same error when building GMT 6.4 from source. Here is part of the output I am getting:

CMake Warning at src/CMakeLists.txt:510 (add\_library):  
Cannot generate a safe runtime search path for target gmtlib because files  
in some directories may conflict with libraries in implicit directories:

```
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/robin/anaconda3/lib

```

Some of these libraries may not be found correctly.

CMake Warning at src/CMakeLists.txt:561 (add\_executable):  
Cannot generate a safe runtime search path for target gmt because files in  
some directories may conflict with libraries in implicit directories:

```
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/robin/anaconda3/lib

```

Some of these libraries may not be found correctly.

CMake Warning at src/CMakeLists.txt:770 (add\_library):  
Cannot generate a safe runtime search path for target supplements because  
files in some directories may conflict with libraries in implicit  
directories:

```
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/robin/anaconda3/lib

```

Some of these libraries may not be found correctly.

---

<div class="post-metadata">

**Author:** ![rmm-san](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rmm-san/32/3080_2.png) [@rmm-san](https://forum.generic-mapping-tools.org/u/rmm-san)\
**Post date:** [May 4, 2023, 6:25pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/4 "2023-05-04T18:25:18Z")

</div>

@pwessel and team, kindly help …

---

<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:** [May 4, 2023, 10:01pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/5 "2023-05-04T22:01:34Z")

</div>

Well, you have an advice in the post before yours. Did you try it?

---

<div class="post-metadata">

**Author:** ![rmm-san](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rmm-san/32/3080_2.png) [@rmm-san](https://forum.generic-mapping-tools.org/u/rmm-san)\
**Post date:** [May 5, 2023, 6:28am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/6 "2023-05-05T06:28:13Z")

</div>

Yes I tried that, still does not work \*\*\*\* After upgrading to Ubuntu 22.10, I was able to install from source seamlessly. The upgrade may have resolved the references to Anaconda3. Thank you

---

<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:** [May 5, 2023, 7:37am UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/7 "2023-05-05T07:37:17Z")

</div>

I am neither using conda nor Linux so have nothing to add beyond what was stated t

---

<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:** [May 5, 2023, 12:38pm UTC](https://forum.generic-mapping-tools.org/t/building-gmt-cmake-warning-conflict-with-anaconda3/2891/8 "2023-05-05T12:38:32Z")

</div>

If you move anaconda out of the path (how, I don’t know since I don’t use too and I’m a Win guy), the problem will disappear for sure.
