Xilinx / merlin-compiler

Other
56 stars 17 forks source link

Build error #4

Open vquyen-study opened 2 years ago

vquyen-study commented 2 years ago

Hi Merlin compiler Team,

I have succeeded to build merlincc. Then I tried to build some code but I got failures as below. Can someone support to figure out what I have wrong in configurations? administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ make mcc_estimate merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vec_add_kernel -I. -I../../include -I /home/administrator/xlnx/Vitis/2021.2/./lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include --platform=zcu102 Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk//mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1096] Host - 'linux' with linux x86_64-linux-gnu-thread-multi INFO: [MERCC-1097] User - administrator INFO: [MERCC-1098] Time - Sun Mar 20 12:32:43 EDT 2022 INFO: [MERCC-1099] Directory - /home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo

INFO: [MERCC-1041] Setting platform to zcu102. INFO: [MERCC-1008] Checking Xilinx xocc ... INFO: [MERCC-1009] Found Xilinx xocc : /home/administrator/xlnx/SDx/2019.1/bin/xocc Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1033] Syntax checking... Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1034] Synthesizability checking... Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1035] Interface synthesis... Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392. Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

ERROR: [MERCC-3058] Frontend compilation failed, please see the details in merlin.logERROR: [MERCC-3044] Merlin compilation failed. See above for each details. ../../../common/mcc_common.mk:143: recipe for target 'vec_add_kernel.mco' failed make: *** [vec_add_kernel.mco] Error 1

mangomingao commented 2 years ago

Could you open up merlin.log and see what's inside? Usually the log contains error messages that mention why it wont work.

vquyen-study commented 2 years ago

Hi,

The merlin.log file shows same information as in terminal. Below is the content of merlin.log. By the way: I have tried to run docker but it also does not work. If you have built & work docker file. can you share this file?

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ cat merlin.log

INFO: [MERCC-1096] Host - 'linux' with linux x86_64-linux-gnu-thread-multi
INFO: [MERCC-1097] User - administrator
INFO: [MERCC-1098] Time - Sun Mar 20 12:37:32 EDT 2022
INFO: [MERCC-1099] Directory - /home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo

INFO: [MERCC-1041] Setting platform to zcu102.
INFO: [MERCC-1008] Checking Xilinx xocc ...
INFO: [MERCC-1009] Found Xilinx xocc : /home/administrator/xlnx/SDx/2019.1/bin/xocc
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1033] Syntax checking...
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1034] Synthesizability checking...
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

INFO: [MERCC-1035] Interface synthesis...
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.
Smartmatch is experimental at /home/administrator/github/merlin-compiler/trunk/mars-gen/scripts/lib/message.pm line 392.

 Failure 2 ---------------- There is no file in src_file_dir/rose_succeed...

ERROR: [MERCC-3058] Frontend compilation failed, please see the details in merlin.logERROR: [MERCC-3044] Merlin compilation failed. See above for each details.
administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$

Below is the location that printed the 'Failure 2' File : trunk/mars-gen/scripts/merlin_flow/frontend_pass.pl

##############################################
# check if rose pass succceed
if (not -e "$src_file_dir/rose_succeed") {
    if ($xml_debug_mode eq "debug-level3") {
        my $pwd = `cd $src_file_dir; pwd`;
        print("\n\n Failure ---------------- There is no file in src_file_dir/rose_succeed...");
        if ("none" eq $pass_name) { run_command "cat $log_file"; }
        MSG_E_3061($mars_opt_cmd, $pwd);
        print_error_msg($MSG_E_3058);
    } else {
        if ($pass_name eq "none") {
            run_command "cat $log_file | grep -v 'Warning: Unrecognized attribute name = __leaf__'";
            print_error_msg($MSG_E_3059);
        } else {
            my $info = `cat $src_file_dir/frontend.log`;
            if ($info =~ "Errors in Processing Input File: throwing an instance of \"frontend_failed\"") {
                print("\n\n Failure 2 ---------------- There is no file in src_file_dir/rose_succeed...");
                print_error_msg($MSG_E_3058);
            }
        }
    }
    print_error_msg($MSG_E_3060);
    die("\n");
}

if ($pass_name eq "kernel_wrapper") {
  run_command("cd $src_file_dir; mars_perl $MERLIN_COMPILER_HOME/mars-gen/scripts/frontend/copy_head.pl");
}
##############################################

Thanks!

seanxilinx commented 2 years ago

@vquyen-study what is your perl version? Besides, please do not include the gcc header files because internally, merlin compiler will use gcc4.9.4 header files which is redistributed with merlin compiler.

seanxilinx commented 2 years ago

Perl 5.16 should have no such warnings. Besides, you can check the intermediate log .Mer/.source-opt/compile_step_xxx.log to see what is wrong. Thanks

vquyen-study commented 2 years ago

Hi, My perl version is 5.26. Let me install 5.16 and try to build. I will update the result soon. By the way, It is possible if I want to build with Intel platform?

Thanks for your kindly support.

vquyen-study commented 2 years ago

Hi @seanxilinx,

I have tried with perl 5.16, and it is a bit better. But it still get errors. It is getting failure to fetch "/usr/include/string.h" but I have included string.h according to gcc-4.9.4 (-I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp)

Log build from terminal

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ perl --version

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ make mcc_estimate
merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vec_add_kernel  -I. -I../../include -I /home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include -I /home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp --platform=zcu102

INFO: [MERCC-1096] Host - 'linux' with linux x86_64-linux
INFO: [MERCC-1097] User - administrator
INFO: [MERCC-1098] Time - Tue Mar 22 23:33:09 EDT 2022
INFO: [MERCC-1099] Directory - /home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo

INFO: [MERCC-1041] Setting platform to zcu102.
INFO: [MERCC-1008] Checking Xilinx xocc ...
INFO: [MERCC-1009] Found Xilinx xocc : /home/administrator/xlnx/SDx/2019.1/bin/xocc

INFO: [MERCC-1033] Syntax checking...
INFO: [MERCC-1034] Synthesizability checking...
INFO: [MERCC-1035] Interface synthesis...

 Falure 2 ---------------- There is no file in src_file_dir/rose_succeed...

ERROR: [MERCC-3058] Frontend compilation failed, please see the details in merlin.logERROR: [MERCC-3044] Merlin compilation failed. See above for each details.

below is log in file .Mer/.source-opt/compile_step_9.log

debug mode
"/usr/include/string.h", line 26: catastrophic error: cannot open source file
          "bits/libc-header-start.h"
  #include <bits/libc-header-start.h>
                                     ^

Errors in Processing Input File: throwing an instance of "frontend_failed" exception due to syntax errors detected in the input code
mars_opt  __merlinwrapper_vec_add_kernel.cpp __merlinkernel_vec_add_kernel.cpp  -e c -p midend_preprocess -a cstd=c99 -a cxxstd=c++11 -a auto_fgpar_opt -a auto_fgpip_opt  -a impl_tool=sdaccel -a tool_version= -a effort=standard -a generate_l2_api=on -a debug_mode=debug   -I /home/administrator/github/merlin-compiler/trunk/source-opt/include/apint_include -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/../../src/ -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/. -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/../../include -I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include -I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp -I/home/administrator/github/merlin-compiler/trunk//mars-gen/lib/merlin -I /home/administrator/github/merlin-compiler/trunk/mars-gen/lib/merlin -a cflags="-D XILINX -D__SYNTHESIS__  -D_MARS_COMPILER_FLOW_ "

Thank you very much!

seanxilinx commented 2 years ago

Please try NOT to add gcc header include path into include path, merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vec_add_kernel -I. -I../../include --platform=zcu102

seanxilinx commented 2 years ago

Hi, My perl version is 5.26. Let me install 5.16 and try to build. I will update the result soon. By the way, It is possible if I want to build with Intel platform?

Thanks for your kindly support.

Since it is open source, we cannot prevent you from trying the AMD competitor's platform (Intel). But as AMD's employee, I will not give you any support if you met any issue due to Intel platform. Besides, current flow will not support Intel platform well

vquyen-study commented 2 years ago

Hi @seanxilinx ,

Please try NOT to add gcc header include path into include path, merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vec_add_kernel -I. -I../../include --platform=zcu102

If I try not to include gcc header, then it will show the error like below, it seems merlincc does not find the stddef.h header. Besides, there is no log file in .Mer/.open_opt

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$  merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vector_add_kernel -I. -I../../include --platform=xilinx:adm-pcie-7v3:1ddr:3.0

INFO: [MERCC-1096] Host - 'linux' with linux x86_64-linux
INFO: [MERCC-1097] User - administrator
INFO: [MERCC-1098] Time - Wed Mar 23 23:05:19 EDT 2022
INFO: [MERCC-1099] Directory - /home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo

INFO: [MERCC-1041] Setting platform to xilinx:adm-pcie-7v3:1ddr:3.0.
INFO: [MERCC-1008] Checking Xilinx xocc ...
INFO: [MERCC-1009] Found Xilinx xocc : /home/administrator/xlnx/SDx/SDx/2017.1/bin/xocc

INFO: [MERCC-1033] Syntax checking...
In file included from <built-in>:363:
/usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
vec_add_kernel.cpp.

ERROR: [MERCC-3056] Synthesizability check failed.
Hint: only c++03 is supported now.
ERROR: [MERCC-3044] Merlin compilation failed. See above for each details.

Since it is open source, we cannot prevent you from trying the AMD competitor's platform (Intel). But as AMD's employee, I will not give you any support if you met any issue due to Intel platform. Besides, current flow will not support Intel platform well You are right and thanks for your confirmation. We are evaluating the tool with Xilinx platform first, and want to see the features of Merlincc. Origially, I saw Merlin is founded by Falcon computing solution and it enables to support Xilinx/Intel platforms. Now it is accquired by Xilinx, so it is truely to not enable Intel feature.

Thank you for your kindly support.

seanxilinx commented 2 years ago

@vquyen-study what is the OS you are working? It should be fine on CentOS 6/7. Sorry but we did not test on other platforms. Besides, could you please try this solution in https://stackoverflow.com/questions/31600600/compilation-error-stddef-h-no-such-file-or-directory? Or please put the gcc binary path (path/to/merlin_compiler/trunk/source-opt/lib/gcc4.9.4/bin) at the beginning of your PATH so that gcc4.9.4 will be used instead of your local gcc. -Sean

fireceW commented 1 year ago

when I make mcc_estimate ,I can not see the directory .merlin_prg, and the .Mer is existing.

fireceW commented 1 year ago

when I make mcc_estimate ,I can not see the directory .merlin_prg, and the .Mer is existing.

when make mcc_estimate is running,I can see the directory.merlin_prg, But when merlin.rpt is generated, it disappears.

seanxilinx commented 1 year ago

when I make mcc_estimate ,I can not see the directory .merlin_prg, and the .Mer is existing.

when make mcc_estimate is running,I can see the directory.merlin_prg, But when merlin.rpt is generated, it disappears.

why do you need .merlin_prj since merlin.rpt is generated?

suijifeixiang commented 1 year ago

@vquyen-study Can I ask you some questions about the installation via WeChat? I've been trying for a long time but it didn't install successfully

seanxilinx commented 1 year ago

Hi @suijifeixiang please post your error message so that I may give you some help.

suijifeixiang commented 1 year ago

@seanxilinx Thank you. I will sort out the error message and send it out during the working day.

suijifeixiang commented 1 year ago

@seanxilinx
docker: centos7.4 ; cmake:3.10.0; llvm: 6.0.0; clang:6.0.0; gcc:4.9.4 some errors happen during exec "make -j4":

Scanning dependencies of target DsMark [ 16%] Building CXX object mars-gen/tools/mcheck/CMakeFiles/mcheck.dir/mcheck.cpp.o make[2]: No rule to make target ../source-opt/lib/llvm6.0.0/lib/libclangTooling.a', needed bybin/mrefactor'. Stop. make[2]: Waiting for unfinished jobs.... make[2]: No rule to make target ../source-opt/lib/llvm6.0.0/lib/libclangTooling.a', needed bybin/mcheck'. Stop. make[2]: Waiting for unfinished jobs.... [ 17%] Building CXX object mars-gen/tools/mrefactor/CMakeFiles/mrefactor.dir/mrefactor.cpp.o [ 18%] Building CXX object mars-gen/tools/mcheck/CMakeFiles/mcheck.dir/mdiag.cpp.o ........... [ 70%] Linking CXX static library liblegacy_parsers.a [ 70%] Built target legacy_parsers make[1]: [mars-gen/tools/mrefactor/CMakeFiles/mrefactor.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... make[1]: [mars-gen/tools/mcheck/CMakeFiles/mcheck.dir/all] Error 2 [ 70%] Linking CXX static library libAddPragmaKernel.a [ 70%] Linking CXX static library libSimpleDCE.a ................... [ 91%] Built target FinalCodeGen [ 91%] Linking CXX static library libmars_rose.a [ 91%] Built target mars_rose make: [all] Error 2 [root@501aada153f7 build]# merlincc -h

Usage: merlincc .< c|cpp|mco >

Options: -v, --version Display compiler version

2212221352 commented 7 months ago

Hi @seanxilinx,

I have tried with perl 5.16, and it is a bit better. But it still get errors. It is getting failure to fetch "/usr/include/string.h" but I have included string.h according to gcc-4.9.4 (-I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp)

Log build from terminal

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ perl --version

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

administrator@linux:~/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo$ make mcc_estimate
merlincc -c ../../src/vec_add_kernel.cpp -D XILINX -o vec_add_kernel  -I. -I../../include -I /home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include -I /home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp --platform=zcu102

INFO: [MERCC-1096] Host - 'linux' with linux x86_64-linux
INFO: [MERCC-1097] User - administrator
INFO: [MERCC-1098] Time - Tue Mar 22 23:33:09 EDT 2022
INFO: [MERCC-1099] Directory - /home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo

INFO: [MERCC-1041] Setting platform to zcu102.
INFO: [MERCC-1008] Checking Xilinx xocc ...
INFO: [MERCC-1009] Found Xilinx xocc : /home/administrator/xlnx/SDx/2019.1/bin/xocc

INFO: [MERCC-1033] Syntax checking...
INFO: [MERCC-1034] Synthesizability checking...
INFO: [MERCC-1035] Interface synthesis...

 Falure 2 ---------------- There is no file in src_file_dir/rose_succeed...

ERROR: [MERCC-3058] Frontend compilation failed, please see the details in merlin.logERROR: [MERCC-3044] Merlin compilation failed. See above for each details.

below is log in file .Mer/.source-opt/compile_step_9.log

debug mode
"/usr/include/string.h", line 26: catastrophic error: cannot open source file
          "bits/libc-header-start.h"
  #include <bits/libc-header-start.h>
                                     ^

Errors in Processing Input File: throwing an instance of "frontend_failed" exception due to syntax errors detected in the input code
mars_opt  __merlinwrapper_vec_add_kernel.cpp __merlinkernel_vec_add_kernel.cpp  -e c -p midend_preprocess -a cstd=c99 -a cxxstd=c++11 -a auto_fgpar_opt -a auto_fgpip_opt  -a impl_tool=sdaccel -a tool_version= -a effort=standard -a generate_l2_api=on -a debug_mode=debug   -I /home/administrator/github/merlin-compiler/trunk/source-opt/include/apint_include -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/../../src/ -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/. -I/home/administrator/github/falconcomputing/merlin-compiler/Examples/vectoradd/build/xilinx_mo/../../include -I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include -I/home/administrator/merlin_env/opt/lib/gcc/x86_64-unknown-linux-gnu/4.9.4/include/ssp -I/home/administrator/github/merlin-compiler/trunk//mars-gen/lib/merlin -I /home/administrator/github/merlin-compiler/trunk/mars-gen/lib/merlin -a cflags="-D XILINX -D__SYNTHESIS__  -D_MARS_COMPILER_FLOW_ "

Thank you very much!

Hello, I also encountered the same issue as you. Do you have any solutions?