retdec: Build is failing on macOS (FLEX_INCLUDE_DIR is set to NOTFOUND)

Hey, when I try to bo build retdec, it fails during the compilation of yaramod

build/external/src/yaramod-project-stamp/yaramod-project-configure-err.log:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/Users/thau/tmp/retdec/build/external/src/yaramod-project/src/FLEX_INCLUDE_DIR
   used as include directory in directory /Users/thau/tmp/retdec/build/external/src/yaramod-project/src

build/external/src/yaramod-project-stamp/yaramod-project-configure-out.log

-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found FLEX: /Users/thau/.local/opt/flex/bin/flex (found version "2.6.4")
-- Found BISON: /Users/thau/.local/opt/bison/bin/bison (found version "3.0.4")
-- Configuring incomplete, errors occurred!
See also "/Users/thau/tmp/retdec/build/external/src/yaramod-project-build/CMakeFiles/CMakeOutput.log".

Console output:

Scanning dependencies of target yaramod-project
[  8%] Creating directories for 'yaramod-project'
[  8%] Performing download step (download, verify and extract) for 'yaramod-project'
-- yaramod-project download command succeeded.  See also /Users/thau/tmp/retdec/build/external/src/yaramod-project-stamp/yaramod-project-download-*.log
[  8%] No patch step for 'yaramod-project'
[  8%] No update step for 'yaramod-project'
[  8%] Performing configure step for 'yaramod-project'
CMake Error at /Users/thau/tmp/retdec/build/external/src/yaramod-project-stamp/yaramod-project-configure-Release.cmake:16 (message):
  Command failed: 1

   '/Users/thau/.local/Cellar/cmake/3.10.1/bin/cmake' '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc' '-DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++' '-GUnix Makefiles' '/Users/kmadel/tmp/retdec/build/external/src/yaramod-project'

  See also

    /Users/thau/tmp/retdec/build/external/src/yaramod-project-stamp/yaramod-project-configure-*.log


make[2]: *** [external/src/yaramod-project-stamp/yaramod-project-configure] Error 1
make[1]: *** [deps/yaramod/CMakeFiles/yaramod-project.dir/all] Error 2
make: *** [all] Error 2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

Had a similar issue here, think i had flex and bison not installed from brew before so it used system versions. So i installed them using brew, wiped the build directory again, made sure those variables were set:

# Apple ships old Flex & Bison, so Homebrew versions should be used.
export CMAKE_INCLUDE_PATH="/usr/local/opt/flex/include"
export CMAKE_LIBRARY_PATH="/usr/local/opt/flex/lib;/usr/local/opt/bison/lib"
export PATH="/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH"

Then used the steps to build it again:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/opt/retdec
make -j8
make install

No more errors, everything looks good.

@bdemick Thank you for the report.

I was getting the same “FLEX_INCLUDE_DIR is set to NOTFOUND” error (but that ended up to be user error)

Could you please share with us how you solved it? Maybe it might help other people as well.

but I’m now getting this error: parser/yy/parser.y:7.1-5: invalid directive: `%code’

I believe this might be caused by an old version of Bison. Have you installed newer versions of Flex and Bison from Homebrew and run the following commands before build (see the instructions in our README)?

# Apple ships old Flex & Bison, so Homebrew versions should be used.
export CMAKE_INCLUDE_PATH="/usr/local/opt/flex/include"
export CMAKE_LIBRARY_PATH="/usr/local/opt/flex/lib;/usr/local/opt/bison/lib"
export PATH="/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH"