# Tutorial Step 5: log and exp not found

**URL:** <https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [February 14, 2020, 6:42pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636 "2020-02-14T18:42:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![IronMoose](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/a87d85/32.png) [@IronMoose](https://discourse.cmake.org/u/IronMoose)\
**Post date:** [February 14, 2020, 6:42pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/1 "2020-02-14T18:42:54Z")

</div>

Hello. I’m a bit stuck on step 5 of the CMake tutorial. Specifically, when I build the project I get:  
Looking for log  
Looking for log - not found  
Looking for exp  
Looking for exp - not found  
Configuring done  
Generating done

No matter what I have tried, I can’t get CMake to find the log and exp. I tried replacing check\_symbol\_exists(log “math.h” HAVE\_LOG) with check\_cxx\_symbol\_exists(std::log “cmath” HAVE\_LOG), but nothing changed. I also tried building step 6, but I have the same issue there. I also tested the example on the CHECK\_CXX\_SYMBOL\_EXISTS documentation page, and those didn’t find the target symbol either. I could use some help.

I’m using the latest version of CMake (3.17.0-rc1), and I am using Visual Studio 2019 on Windows 10 to build the tutorial.

Thanks.

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [February 14, 2020, 9:19pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/2 "2020-02-14T21:19:49Z")

</div>

The tutorial is tested as part of nightly builds, so it should work in general. Perhaps @betsy.mcphail has some ideas?

---

<div class="post-metadata">

**Author:** ![betsy.mcphail](https://discourse.cmake.org/user_avatar/discourse.cmake.org/betsy.mcphail/32/299_2.png) [@betsy.mcphail](https://discourse.cmake.org/u/betsy.mcphail)\
**Post date:** [February 18, 2020, 7:14pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/3 "2020-02-18T19:14:19Z")

</div>

If you remove the line `set(CMAKE_REQUIRED_LIBRARIES "m")` does it work on your system?

---

<div class="post-metadata">

**Author:** ![betsy.mcphail](https://discourse.cmake.org/user_avatar/discourse.cmake.org/betsy.mcphail/32/299_2.png) [@betsy.mcphail](https://discourse.cmake.org/u/betsy.mcphail)\
**Post date:** [February 18, 2020, 9:50pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/4 "2020-02-18T21:50:55Z")

</div>

I submitted a change so that this step works on Windows in the future (see [https://gitlab.kitware.com/cmake/cmake/merge\_requests/4375](https://gitlab.kitware.com/cmake/cmake/merge_requests/4375))

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [February 20, 2020, 12:20am UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/5 "2020-02-20T00:20:37Z")

</div>

Just clarifying, the original question was about the logged messages that `log` and `exp` were not found, but it seems that the project still configures and likely builds successfully, right? In that case, the fact that these were not found is not a problem, it’s perhaps just confusing for users. The merge request linked to by Betsy currently won’t change this behaviour, so I’ll follow-up there.

---

<div class="post-metadata">

**Author:** ![IronMoose](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/a87d85/32.png) [@IronMoose](https://discourse.cmake.org/u/IronMoose)\
**Post date:** [February 20, 2020, 8:03am UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/6 "2020-02-20T08:03:41Z")

</div>

While the project builds successfully, the issue is that check\_symbol\_exists does not find anything when I build. I tried building the tutorial, and I tried using the examples on the `check_symbol_exists` and `check_cxx_symbol_exists` documentation pages, and they did not work either. Removing the `set(CMAKE_REQUIRED_LIBRARIES "m")` line does not fix my issue with `check_symbol_exists` unfortunately. However, judging by the GitLab thread, it seems like a solution has already been found. I’m eager to test it with the next release of CMake.

---

<div class="post-metadata">

**Author:** ![mujina93](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/dfb087/32.png) [@mujina93](https://discourse.cmake.org/u/mujina93)\
**Post date:** [May 3, 2020, 2:41pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/7 "2020-05-03T14:41:57Z")

</div>

Same problem here. (CMake 3.17.2, Windows 10, Visual Studio 2017).

Removing the `set(CMAKE_REQUIRED_LIBRARIES "m")` part allowed me to find `log` and `exp` symbols. What could be the explanation for this?

---

<div class="post-metadata">

**Author:** ![airwin](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@airwin](https://discourse.cmake.org/u/airwin)\
**Post date:** [May 7, 2020, 7:10pm UTC](https://discourse.cmake.org/t/tutorial-step-5-log-and-exp-not-found/636/8 "2020-05-07T19:10:59Z")

</div>

The math library, libm, is always a cross-platform issue since  
Windows has no separate (libm) math library (as you just  
discovered) while Unix does. Here is the stanza I use to deal with  
this issue for PLplot.

if(NOT (WIN32 OR CYGWIN))  
find\_library(MATH\_LIB NAMES m PATHS /usr/local/lib /usr/lib)  
if(NOT MATH\_LIB)  
message(FATAL\_ERROR “Cannot find required math library”)  
endif(NOT MATH\_LIB)  
endif(NOT(WIN32 OR CYGWIN))

Then PLplot adds (the sometimes empty, depending on platform)  
${MATH\_LIB} to target\_link\_libraries commands whenever a target  
depends on math functions.
