Skip to content

Missing I2C library on the arduino.py builder of platform-native #65

@cocus

Description

@cocus

Hi, I'm trying to build the "example", on x86_64 Ubuntu 24.04, but hitting the following issue:

Indexing .pio/build/native/libFrameworkArduino.a
Linking .pio/build/native/program
/usr/bin/ld: .pio/build/native/libFrameworkArduino.a(LinuxHardwareI2C.cpp.o): in function `arduino::LinuxHardwareI2C::writeQuick(unsigned char)':
/home/cocus/.platformio/packages/framework-portduino/cores/portduino/linux/LinuxHardwareI2C.cpp:66:(.text+0x18f): undefined reference to `i2c_smbus_write_quick'
collect2: error: ld returned 1 exit status
*** [.pio/build/native/program] Error 1

I do have libi2c-dev installed. I figured that there must be a -li2c missing on the build, so I took a look at the sources of the arduino framework builder at here, and the I2C library is missing on the LIBS=[. I just added i2c to that list, and now the example builds.

Is this something related to my machine or setup, or is this a bug?

I'm planning to add mbed tls for the WiFiClientSecure.

EDIT: I think the fix here is to do:

-build_flags = ${env.build_flags} -O0
+build_flags =
+  ${env.build_flags}
+  -O0
+  -li2c

on example/platformio.ini. I'll use this for my mbedtls work as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions