# build issue with libmetal package

**URL:** https://discourse.cmake.org/t/build-issue-with-libmetal-package/700
**Category:** Usage
**Tags:** os:linux, gen:makefiles
**Created:** [February 25, 2020, 1:01pm UTC](https://discourse.cmake.org/t/build-issue-with-libmetal-package/700 "2020-02-25T13:01:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![biswajit](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/e56c9b/32.png) [@biswajit](https://discourse.cmake.org/u/biswajit)
#### Post date: [February 25, 2020, 1:01pm UTC](https://discourse.cmake.org/t/build-issue-with-libmetal-package/700/1 "2020-02-25T13:01:01Z")

</div>

Hi ,  
I am trying to cross compile the libmetal\_v2\_0 package using cmake on linux.  
while building i am getting error like :  
error: ‘METAL\_MUTEX\_INIT’ undeclared (first use in this function); did you mean ‘METAL\_LOG\_INFO’?  
metal\_mutex\_t lock = METAL\_MUTEX\_INIT;

step 1:  
/new-home/biswajit/rfdc/RFDAC\_BUILD\_STANDALONE/libmetal\_v2\_0/src/libmetal  
step 2:  
mkdir build\_libm  
Step 3:  
cmake … -DLIBRT\_LIBRARIES=/new-home/biswajit/svn\_ant\_rfdc/art-os-ant-revi/os-ant-revi/buildos/root-fs/lib/librt-2.28.so -DLIBSYSFS\_INCLUDE\_DIR=/new-home/biswajit/svn\_ant\_rfdc/art-ant-revi/ant-revi/buildsw/install/include -DLIBSYSFS\_LIBRARY=/new-home/biswajit/svn\_ant\_rfdc/art-ant-revi/ant-revi/buildsw/install/lib/libsysfs.so.2.0.1 -DCMAKE\_TOOLCHAIN\_FILE=…/cmake/platforms/toolchain.cmake

step 4 :  
make

Build Log:

[biswajit@build-server-lab2 build\_libm]$ export PATH=$PATH:/home/buildtools/xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin

[biswajit@build-server-lab2 build\_libm]$ cmake … -DLIBRT\_LIBRARIES=/new-home/biswajit/svn\_ant\_rfdc/art-os-ant-revi/os-ant-revi/buildos/root-fs/lib/librt-2.28.so -DLIBSYSFS\_INCLUDE\_DIR=/new-home/biswajit/svn\_ant\_rfdc/art-ant-revi/ant-revi/buildsw/install/include -DLIBSYSFS\_LIBRARY=/new-home/biswajit/svn\_ant\_rfdc/art-ant-revi/ant-revi/buildsw/install/lib/libsysfs.so.2.0.1 -DCMAKE\_TOOLCHAIN\_FILE=…/cmake/platforms/toolchain.cmake  
– The C compiler identification is GNU 8.2.0  
– Check for working C compiler: /home/buildtools/xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-gcc  
– Check for working C compiler: /home/buildtools/xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-gcc – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Build type: Debug  
– Host: Linux/x86\_64  
– Target: Linux/arm  
– Machine: Generic  
– Looking for include file xintc.h  
– Looking for include file xintc.h - not found  
– Could NOT find Doxygen (missing: DOXYGEN\_EXECUTABLE)  
– Looking for include file stdatomic.h  
– Looking for include file stdatomic.h - found  
– Looking for include file linux/futex.h  
– Looking for include file linux/futex.h - found  
– Looking for include file linux/dma-buf.h  
– Looking for include file linux/dma-buf.h - found  
– Could NOT find HUGETLBFS (missing: HUGETLBFS\_LIBRARY HUGETLBFS\_INCLUDE\_DIR)  
– Found LIBSYSFS: /new-home/biswajit/svn\_ant\_rfdc/art-ant-revi/ant-revi/buildsw/install/lib/libsysfs.so.2.0.1  
– Looking for include file pthread.h  
– Looking for include file pthread.h - found  
– Looking for pthread\_create  
– Looking for pthread\_create - found  
– Found Threads: TRUE  
– Found LibRt: /new-home/biswajit/svn\_ant\_rfdc/art-os-ant-revi/os-ant-revi/buildos/root-fs/lib/librt-2.28.so  
– Configuring done  
– Generating done  
– Build files have been written to: /new-home/biswajit/rfdc/RFDAC\_BUILD\_STANDALONE/libmetal\_v2\_0/src/libmetal/build\_libm  
[biswajit@build-server-lab2 build\_libm]$  
[biswajit@build-server-lab2 build\_libm]$  
[biswajit@build-server-lab2 build\_libm]$  
[biswajit@build-server-lab2 build\_libm]$ make

content of cmake/platforms/toolchain.cmake

set (CMAKE\_SYSTEM\_PROCESSOR “arm” CACHE STRING “”)  
#set (MACHINE “zynqmp\_a53”)  
set (CROSS\_PREFIX “aarch64-linux-gnu-” CACHE STRING “”)  
set (CMAKE\_SYSTEM\_NAME “Linux” CACHE STRING “”)  
set (CMAKE\_C\_FLAGS “-lpthread”)  
include (CMakeForceCompiler)  
set (CMAKE\_C\_COMPILER “${CROSS\_PREFIX}gcc” )  
set (CMAKE\_CXX\_COMPILER “${CROSS\_PREFIX}g++”)  
set (CMAKE\_FIND\_ROOT\_PATH\_MODE\_PROGRAM NEVER CACHE STRING “”)  
set (CMAKE\_FIND\_ROOT\_PATH\_MODE\_LIBRARY NEVER CACHE STRING “”)  
set (CMAKE\_FIND\_ROOT\_PATH\_MODE\_INCLUDE NEVER CACHE STRING “”)

Any input will be really helpful.

Regards,  
Biswajit

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 28, 2020, 8:33pm UTC](https://discourse.cmake.org/t/build-issue-with-libmetal-package/700/2 "2020-02-28T20:33:25Z")

</div>

It looks like a missing `#include`, but this is a question better suited to `libmetal` upstream rather than CMake itself (based on the provided information).
