Hi Chunyan,

Thanks - I hadn't spotted this.  I was building the release and testing that, assuming that the debug would be fine.

Looks like GCC is not correctly (at least as I understand it) compiling/linking the inline functions in debug build.
Doesn't error in GCC release build or any build of MSVC.

I'll see if I can figure out something that works in a "standard" way with all the compilers.

Mike

On 11 January 2017 at 13:27, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
Hi All,

Leo Yan (in cc list) is trying to use Perf+OpenCSD on Juno, I think if
we support cross compilation of OpenCSD, he will not need to clone all
source code on Juno, that might be easier for users who only want to
use OpenCSD.

Hi Mike,

When building OpenCSD with DEBUG=1, I got the errors like this:
https://pastebin.linaro.org/view/eea41728
Any options should I set before compiling?


Thanks,
Chunyan

On 11 January 2017 at 21:03, Chunyan Zhang <zhang.chunyan@linaro.org> wrote:
> In order to support cross compile the OpenCSD for arm/arm64, this patch
> added two environment variables, 'CROSS_COMPILE' and 'ARCH' which can
> be set by users before compiling the code.
>
> Like documented in Kernel Makefile, CROSS_COMPILE specifies the prefix
> used for all executables used during compilation. CROSS_COMPILE can be
> set on the command line, as is ARCH.
>
> For example, if you want to build the libraryies for Aarch64, you can set
> "ARCH=arm64", the the compiled libs will be located at
> lib/linux-arm64/<rel\dbg>.`
>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> ---
>  decoder/build/linux/makefile | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile
> index 3b6a623..dc1f32b 100644
> --- a/decoder/build/linux/makefile
> +++ b/decoder/build/linux/makefile
> @@ -47,7 +47,11 @@ export LIB_CAPI_NAME
>
>  # determine base architecture, heavily borrowed from the Linux kernel v4.4's
>  # tools/perf/config/Makefile.arch
> +# For example, to compile for arm64 on a X86 PC, you can issue the command:
> +# "export ARCH=arm64"
> +ifndef ARCH
>  ARCH := $(shell uname -m 2>/dev/null || echo not)
> +endif
>
>  # source root directories
>  export OCSD_LIB_ROOT=$(OCSD_ROOT)/lib
> @@ -58,10 +62,10 @@ export OCSD_SOURCE=$(OCSD_ROOT)/source
>  export OCSD_TESTS=$(OCSD_ROOT)/tests
>
>  # tools
> -export MASTER_CC=gcc
> -export MASTER_CPP=g++
> -export MASTER_LINKER=g++
> -export MASTER_LIB=ar
> +export MASTER_CC=$(CROSS_COMPILE)gcc
> +export MASTER_CPP=$(CROSS_COMPILE)g++
> +export MASTER_LINKER=$(CROSS_COMPILE)g++
> +export MASTER_LIB=$(CROSS_COMPILE)ar
>
>  # compile flags
>  MASTER_CC_FLAGS := -c -Wall -DLINUX
> @@ -87,6 +91,10 @@ ifeq ($(ARCH),x86)
>  else ifeq ($(ARCH),x86_64)
>     MFLAG:="-m64"
>     BIT_VARIANT=64
> +else ifeq ($(ARCH),arm)
> +   BIT_VARIANT=-arm
> +else ifeq ($(ARCH),arm64)
> +   BIT_VARIANT=-arm64
>  endif
>
>  MASTER_CC_FLAGS += $(MFLAG)
> --
> 2.7.4
>



--
Mike Leach
Principal Engineer, ARM Ltd.
Blackburn Design Centre. UK