Test program uses standard compiler, and not the cross compiler

This topic contains 4 replies, has 2 voices, and was last updated by  jrbeaumont 4 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31436

    jrbeaumont
    Member

    After exporting CROSS_COMPILE

    export CROSS_COMPILE=`pwd`/output/host/usr/bin/metag-linux-

    And then trying to compile the file in the code_test directory with a makefile like this

    SIMPLE_TEST = code_test
    CC = $(CROSS_COMPILE)gcc
    SIMPLE_TEST_SRC = test_prog.c sum.c
    $(SIMPLE_TEST): $(SIMPLE_TEST_SRC)
    $(CC) $(TARGET_LDFLAGS) -g -o $@ $^

    The terminal returns:

    gcc -g -o code_test test_prog.c sum.c

    Which is not what the getting started guide suggests will be returned

    Codescape also says :”Error: Error: Cannot open Program File” when trying to run it.

    I believe that the file is not compiling correctly as it is using the standard linux compiler instead of the one so it will compile for the board.

    Please could you help me work out where I have gone wrong and how I can correct it.

    #37884

    Sean
    Moderator

    Have you built the toolchain successfully?

    Please let me know the output of the following commands
    echo $CROSS_COMPILE
    ls $CROSS_COMPILE

    Sean.

    #37885

    jrbeaumont
    Member

    Sean,
    Thank you for getting back to me quickly.

    ‘echo’ returns an empty line.

    ‘ls’ returns just the list of files and folders in the folder.

    #37886

    Sean
    Moderator

    That suggests the CROSS_COMPILE variable is not currently setup. You can check all your shell environment variables using the command “env”; CROSS_COMPILE should be in there and set correctly.

    It needs to display something like this when you run echo:
    # export CROSS_COMPILE=/home/sean/minimorphSDK/GPL/buildroot/output/host/usr/bin/metag-linux-
    # echo $CROSS_COMPILE
    /home/sean/minimorphSDK/GPL/buildroot/output/host/usr/bin/metag-linux-

    #37887

    jrbeaumont
    Member

    Sean,

    I have fixed it.

    I’m not sure if it’s Ubuntu or just me.

    I followed the instructions to create CROSS_COMPILE from the get started guide, which suggests you can create it from buildroot.

    I had to create it using the full file path.

    It now compiles correctly.

    Thank you for your help

    Jonny

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.