Skip to content

Configure script not picking the CPU type #1567

Open
@raks-dev

Description

I was setting up MQTT gateway on my Raspberry Pi 4 Model B Rev 1.1 running on Homebridge image 6.6.51+rpt-rpi-v8 which is a 64 Bit version.
Build would fail after configure as the flags -mfpu=neon-fp-armv8 and -mfloat-abi=hard get added to it.

I was able to root cause the issue to the below mentioned code:

if [ -z "${SOC}" ]; then
    printf "${SECTION} Detecting target machine.\n"
    info=($(detect_machine))
    SOC=${info[0]}
    TYPE=${info[1]}
    CPU=${info[2]}
    printf "  ${OK} machine detected: SoC=${SOC}, Type=${TYPE}, CPU=${CPU}.\n"
fi

if [ -z "${CPUFLAGS}" ]; then
    CPUFLAGS=$(gcc_cpu_flags "${SOC}" "${CPU}")
fi

https://github.com/mysensors/MySensors/blob/development/configure#L575-L586

The CPU variable is set only when SOC flag is unset but used in determining gcc_cpu_flags and results in following error

gcc: error: unrecognized command-line option ‘-mfpu=neon-fp-armv8’
gcc: error: unrecognized command-line option ‘-mfloat-abi=hard’

Proposed Fix:
Add the line CPU=$(eval "uname -m 2>/dev/null") before the if [ -z "${CPUFLAGS}" ]; then and deleting CPU=${info[2]} line.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions