Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16653 Discussions file not recognized: File format not recognized

Honored Contributor II

Hi there, 


I am getting an error when trying to build the host application for emulation. All the flow (under a Linux Mint 18, essentially Ubuntu 16.04) works fine and I am able to run the kernels in the board with no issue. Also, the emulation kernel is created without any issue, but when building the host application, linking fails. It seems the format of the file is not recognized ?¿ . I have tried to extract the file from the RTE package downloaded from the webpage (both for my quartus version and previous, including the update, and the version before the update in july, just in case it hadn't changed) and tried with it, but same error. It is very weird. Has anyone experienced something similar? 


/home/rusa/tools/intelFPGA/17.0/hld/board/s5_ref/linux64/lib/ file not recognized: File format not recognizedcollect2: error: ld returned 1 exit status Makefile:74: recipe for target 'bin/host' failed make: *** Error 1 


All the set-up is apparently fine. I am using OpenCL SDK version 17.0 and I am able to run the application on the DE1SoC board. 


Intel(R) FPGA SDK for OpenCL(TM), 64-Bit Offline CompilerVersion 17.0.2 Build 602 Copyright (C) 2017 Intel Corporation  


The init script I use for emulation is as follows. It is exactly the same as the one I use for building real kernels for the DE1SoC board but pointing to a non-SoC board (s5_ref as available per the standard SDK installation) as instructed by Intel in page 38 of, and as already tried in a tutorial I followed in a conference, targeting version 16.1 (if I remind correctly the version): 


export ALTERAOCLSDKROOT=/home/rusa/tools/intelFPGA/17.0/hldexport QSYS_ROOTDIR=/home/rusa/tools/intelFPGA/17.0/quartus/sopc_builder/bin export QUARTUS_ROOTDIR=/home/rusa/tools/intelFPGA/17.0/quartus # path to the installation directory of the Quartus Prime software that supports your device export QUARTUS_ROOTDIR_OVERRIDE=/home/rusa/tools/intelFPGA/17.0/quartus # set board dir -> SETS A STANDARD NON-SoC BOARD NEEDED FOR EMULATION export AOCL_BOARD_PACKAGE_ROOT=$ALTERAOCLSDKROOT/board/s5_ref # license config export LM_LICENSE_FILE=$HOME/tools/1-FW77S7_License.dat # # # ##### # update PATH variable # ##### # add the path to the cross-compiler for ARM devices export PATH=/home/rusa/tools/intelFPGA/17.0/embedded/ds-5/bin:/home/rusa/tools/intelFPGA/17.0/embedded/ds-5/sw/gcc/bin:$PATH # add the path to the SDK bin directory of the software installation export PATH=$ALTERAOCLSDKROOT/bin:$PATH # utility? (estaba en la version 16.0 del tutorial, revisar Terasic) export PATH=$ALTERAOCLSDKROOT/linux64/bin:$PATH # path to the directory with the quartus executable export PATH=$QUARTUS_ROOTDIR/bin:$PATH # # # ##### # update LD_LIBRARY_PATH # ##### # add the path to the SDK host runtime libraries (for emulation in PC in case of SoC-based boards) export LD_LIBRARY_PATH=$ALTERAOCLSDKROOT/host/linux64/lib:$LD_LIBRARY_PATH # add the path to the board libraries (for working with SoC-based boards, it is used to set the path to a non-SoC board, needed for emulation) export LD_LIBRARY_PATH=$AOCL_BOARD_PACKAGE_ROOT/linux64/lib:$LD_LIBRARY_PATH # ?¿ utility ?¿ PROBABLY OLD (estaba en la version 16.0 del tutorial, revisar Terasic) export LD_LIBRARY_PATH=$ALTERAOCLSDKROOT/linux64/lib:$LD_LIBRARY_PATH # ## # source the Altera OpenCL environment # ## source $ALTERAOCLSDKROOT/  


After sourcing, everything seems fine: 

rusa@emma ~/dev/IntelFPGA/OpenCL/examples/hello_world $ source /home/rusa/tools/intelFPGA/ ALTERAOCLSDKROOT is set to /home/rusa/tools/intelFPGA/17.0/hld. Using that. Will use $QUARTUS_ROOTDIR_OVERRIDE= /home/rusa/tools/intelFPGA/17.0/quartus to find Quartus AOCL_BOARD_PACKAGE_ROOT is set to /home/rusa/tools/intelFPGA/17.0/hld/board/s5_ref. Using that. Adding /home/rusa/tools/intelFPGA/17.0/hld/bin to PATH Adding /home/rusa/tools/intelFPGA/17.0/hld/host/linux64/lib to LD_LIBRARY_PATH Adding /home/rusa/tools/intelFPGA/17.0/hld/board/s5_ref/linux64/lib to LD_LIBRARY_PATH  


rusa@emma ~/dev/IntelFPGA/OpenCL/examples/hello_world $ aoc --list-boardsBoard list: s5_ref
2 Replies
Honored Contributor II
904 Views mistake, sorry for the mess. 


I am answering myself since I realized I made a terrible mistake. Maybe if you are going too fast as I was, you might make the same mistake: using the wrong Makefile. It is not only necessary to build the .aocx emulator for a given board but also using the right Makefile for emulation in a x86 based computer.  


So if you're developing for a SoC based device make sure when you go for emulation (besides the Intel instructions, like sourcing the required file to prepare the environment, how to build the .aocx and how to execute the host application), that you switch to an x86-based Makefile (available also in any of the Altera design examples): get one for x86, and either use two different Makefiles or modify one slightly to provide some command line options when you go emulation or real hardware. Please find mine below. I just got the ARM and x86 Makefiles and 'merge' them creating a specific directory for the emulation building process outputs; you can use make EMUL=1 for building the emulation host program or just make to build the AMR-based host application. The Makefile: 


ifeq ($(VERBOSE),1) ECHO := else ECHO := @ endif # Where is the Intel(R) FPGA SDK for OpenCL(TM) software? ifeq ($(wildcard $(ALTERAOCLSDKROOT)),) $(error Set ALTERAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation) endif ifeq ($(wildcard $(ALTERAOCLSDKROOT)/host/include/CL/opencl.h),) $(error Set ALTERAOCLSDKROOT to the root directory of the Intel(R) FPGA SDK for OpenCL(TM) software installation.) endif # OpenCL compile and link flags. ifeq ($(EMUL),1) AOCL_COMPILE_CONFIG := $(shell aocl compile-config ) AOCL_LINK_CONFIG := $(shell aocl link-config ) else AOCL_COMPILE_CONFIG := $(shell aocl compile-config --arm) AOCL_LINK_CONFIG := $(shell aocl link-config --arm) endif # Compilation flags ifeq ($(DEBUG),1) CXXFLAGS += -g else CXXFLAGS += -O2 endif ifeq ($(EMUL),1) # Compiler x86 CXX := g++ else # Compiler. ARM cross-compiler. CXX := arm-linux-gnueabihf-g++ endif # Target TARGET := host ifeq ($(EMUL),1) TARGET_DIR := bin/emul else TARGET_DIR := bin endif # Directories INC_DIRS := ../common/inc LIB_DIRS := # Files INCS := $(wildcard ) SRCS := $(wildcard host/src/*.cpp ../common/src/AOCLUtils/*.cpp) LIBS := rt pthread # Make it all! all : $(TARGET_DIR)/$(TARGET) # Host executable target. $(TARGET_DIR)/$(TARGET) : Makefile $(SRCS) $(INCS) $(TARGET_DIR) $(ECHO)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC $(foreach D,$(INC_DIRS),-I$D) $(AOCL_COMPILE_CONFIG) $(SRCS) $(AOCL_LINK_CONFIG) $(foreach D,$(LIB_DIRS),-L$D) $(foreach L,$(LIBS),-l$L) -o $(TARGET_DIR)/$(TARGET) $(TARGET_DIR) : $(ECHO)mkdir $(TARGET_DIR) # Standard make targets clean : $(ECHO)rm -f $(TARGET_DIR)/$(TARGET) .PHONY : all clean  


0 Kudos
Honored Contributor II

Hello Ruben, 

i'm facing the same problem i changed the make file as you specified in your solution but this didn't work also, i have the same problem again 

did you manage to solve this just by this modification or is there something else to do.  

thanks in Advance
0 Kudos