Skip to content

Build Jerryscript for LLVM #1027

@ssultana

Description

@ssultana

Hi,
I want to build Jerryscript for LLVM in Contiki/Galileo board. Can you please point me to what Makefile/compiler options I should change? Previously I built Jerryscript for Contiki OS/Galileo board. Basically, I made a directory jerryscript/targets/contiki-x86, wrote a Makefile jerryscript/targets/contiki-x86/Makefile.contikix86 for Contiki/Galileo board and set the appropriate toolchain.

To build in LLVM, I've so far tried the following changes but haven't been successful to build JerryScript.

  1. Updated PATH variable with llvm/build/bin path and Modified compiler options in Makefile.contikix86 as

    jerry:
        ... ... 
     -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_external_clang.cmake \
     -DEXTERNAL_LIBC_INTERFACE=$(CONTIKI)/platform/galileo/bsp/libc/i586-elf/include \
     -DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=x86 \
     -DEXTERNAL_CMAKE_C_COMPILER=clang \
     -DEXTERNAL_CMAKE_CXX_COMPILER=clang++ \
     -DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS) $(CFLAGS)"
    
  2. Wrote build/configs/toolchain_external_clang.cmake as

      ... ... 
      CMAKE_FORCE_C_COMPILER(${EXTERNAL_CMAKE_C_COMPILER} Clang)
      CMAKE_FORCE_CXX_COMPILER(${EXTERNAL_CMAKE_CXX_COMPILER} Clang)
    
  3. Changed Imported Library Options in JerryScript/CMakeLists.txt as

elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
  add_library(${PREFIX_IMPORTED_LIB}libclang STATIC IMPORTED)
  execute_process(COMMAND ${CMAKE_C_COMPILER} ${FLAGS_COMMON_ARCH} -print-file-name=
                  OUTPUT_VARIABLE IMPORTED_LIBCLANG_RT_LOCATION
                  OUTPUT_STRIP_TRAILING_WHITESPACE)
  set(IMPORTED_LIBCLANG_RT_LOCATION "/home/llvm-git/build/lib/libclang.so")
  set_property(TARGET ${PREFIX_IMPORTED_LIB}libclang
               PROPERTY IMPORTED_LOCATION ${IMPORTED_LIBCLANG_RT_LOCATION})

@seanshpark

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions