Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
663 Discussions

Compile Intel HLS project with CMake

messn036
Novice
1,138 Views

Hello Intel Community,

I am having troubles with CMake using MVSC compiler directives when trying to compile with i++. I am compiling on Windows with Visual Studios 17 installed.

I am using the following command to build and compile.

HLS> cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=i++ ..
-- The CXX compiler identification is IntelLLVM 2021.1.0 with GNU-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build

HLS> cmake --build . --config Release
Scanning dependencies of target tensors
[ 25%] Building CXX object src/CMakeFiles/tensors.dir/tensors.cpp.obj
aocl-clang: error: no such file or directory: '/nologo'
aocl-clang: error: no such file or directory: '/TP'
aocl-clang: error: no such file or directory: '/FdCMakeFiles/tensors.dir/tensors.pdb'
HLS x86-64 compile FAILED.
make.exe[2]: *** [src/CMakeFiles/tensors.dir/tensors.cpp.obj] Error 1
make.exe[1]: *** [src/CMakeFiles/tensors.dir/all] Error 2
make.exe: *** [all] Error 2

I use Unix Makefiles as when I compile with Visual Studios as my generator, I get this output:

HLS> cmake -G "Visual Studio 15 2017 Win64" -D CMAKE_CXX_COMPILER=D:/Applications/intel_quartus/21.1/hls/bin/i++.exe ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19042.
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build

HLS> cmake --build . --config Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Checking Build System
Building Custom Rule C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/src/CMakeLists.txt
cl : Command line warning D9002: ignoring unknown option '-march=x86-64' [C:\Users\hunto_efxy22i\jupyterProjects\HUBERT
\build\src\tensors.vcxproj]

Which suggests that the CMake build system isnt using i++ at all. Since it fails to detect the compiler, I would rather stick with Unix makefiles.

I have attached the outermost CMakeLists.txt. I have skipped the compiler check as it fails for the same reason that it fails now, a bunch of unknown options are passed as it seems. I have also done by best to get rid of the irrelevant MSVC compiler options by setting the flags manually, however that only seems to get rid of a few.

Finally, my Cmake error file output.

Detecting CXX compiler ABI info failed to compile with the following output:
Change Dir: C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/PROGRA~2/GnuWin32/bin/make.exe -f Makefile cmTC_784a2/fast && C:/PROGRA~2/GnuWin32/bin/make.exe  -f CMakeFiles/cmTC_784a2.dir/build.make CMakeFiles/cmTC_784a2.dir/build

make.exe[1]: Entering directory `C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build/CMakeFiles/CMakeTmp'

Building CXX object CMakeFiles/cmTC_784a2.dir/CMakeCXXCompilerABI.cpp.obj

D:/Applications/intel_quartus/21.1/hls/bin/i++.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc  /MDd /Zi /Ob0 /Od /RTC1 /FoCMakeFiles/cmTC_784a2.dir/CMakeCXXCompilerABI.cpp.obj /FdCMakeFiles/cmTC_784a2.dir/ -c D:/Applications/cmake/share/cmake-3.20/Modules/CMakeCXXCompilerABI.cpp

aocl-clang: error: no such file or directory: '/nologo'

aocl-clang: error: no such file or directory: '/TP'

aocl-clang: error: no such file or directory: '/DWIN32'

aocl-clang: error: no such file or directory: '/D_WINDOWS'

aocl-clang: error: no such file or directory: '/W3'

aocl-clang: error: no such file or directory: '/GR'

aocl-clang: error: no such file or directory: '/EHsc'

aocl-clang: error: no such file or directory: '/MDd'

aocl-clang: error: no such file or directory: '/Zi'

aocl-clang: error: no such file or directory: '/Ob0'

aocl-clang: error: no such file or directory: '/Od'

aocl-clang: error: no such file or directory: '/RTC1'

aocl-clang: error: no such file or directory: '/FdCMakeFiles/cmTC_784a2.dir/'

HLS x86-64 compile FAILED.

I am hoping someone can help

1. Get rid of the MSVC compiler flags

2. Fix CMake not detecting the ABI so that it actually passes the correct flags by default.

 

Thanks,

Messn036

0 Kudos
3 Replies
BoonBengT_Intel
Moderator
1,103 Views

Hi @messn036,

 

Thank you for posting in Intel community forum, hope all is well and apologies for the delayed in response.
Clarification on the following, quick check which HLS design example are you trying to compile?
Unfortunately I did not try this before and are not sure if it is possible to compile HLS code with cmake, and user guides that we have on interchange compiler here does not have cmake included.

 

However, upon some research I do found some example here which is integrating cmake with Intel HLS tools which can be try on.
Please do let me know if that helps to clarify.

 

Best Wishes
BB

0 Kudos
messn036
Novice
1,069 Views

I ended up copying the .bat file format for windows and the Makefile format for linux. I was not trying to compile an example, but my own code.

Thanks,

Messn036

0 Kudos
BoonBengT_Intel
Moderator
1,051 Views

Hi @messn036,

 

Good to know that and I assume it is working now, and appreciate your sharing on the findings.
Hence for threads will be moved to community support hereby.
Pleasure having you here.

 

Best Wishes
BB

0 Kudos
Reply