noloader / cryptopp-cmake

CMake files for Crypto++ project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails on i.MX6 (error: inlining failed)

D-r-P-3-p-p-3-r opened this issue · comments

Build fails with errors like this one (cross-compile on an x86_64 Linux for a Linux running on an i.MX6 with g++ 9.2.1):

error: inlining failed in call to always_inline 'void vst1q_u8(uint8_t*, uint8x16_t)': target specific option mismatch

Cause: The platform is not detected correctly. Thus incorrect compiler options are inferred:

-- Platform: x86_64

Changing the else branch of

function(DumpMachine output pattern)

  if (MSVC)

    # CMake does not provide a generic shell/terminal mechanism
    #  and Microsoft environments don't know what 'sh' is.
    set(${output} 0 PARENT_SCOPE)

  else ()
      if(CMAKE_SYSTEM_PROCESSOR MATCHES ${pattern})
          set(${output} TRUE PARENT_SCOPE)
      endif()
  endif()

endfunction(DumpMachine)

back to the old version from 8.2.0

function(DumpMachine output pattern)

  if (MSVC)

    # CMake does not provide a generic shell/terminal mechanism
    #  and Microsoft environments don't know what 'sh' is.
    set(${output} 0 PARENT_SCOPE)

  else ()
    execute_process(
      COMMAND sh -c "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
      COMMAND ${GREP_CMD} -i -c -E "${pattern}"
      OUTPUT_VARIABLE ${output}
      OUTPUT_STRIP_TRAILING_WHITESPACE)
    set(${output} "${${output}}" PARENT_SCOPE)
  endif()

endfunction(DumpMachine)

in CMakeLists.txt fixes the problem.

Done. I never liked that change. But I did not understand it, either.

Also see Commit c57ba8f63495.