micro-ROS / micro_ros_arduino

micro-ROS library for Arduino
Apache License 2.0
450 stars 117 forks source link

Compilation error for Teensy3.6 #667

Closed BenjaminDeHeisenberg closed 2 years ago

BenjaminDeHeisenberg commented 2 years ago

Issue template

Steps to reproduce the issue

Followed the instructions mentioned on the Readme file to compile on platformIO and tried to compile the micro_ros_publisher code from the example folder. I have followed all the changes that needs to be done on the platform.ini file according to my folder structure. During compilation, the error that is occurring is:

 Compiling .pio\build\teensy36\libc62\NativeEthernet\NativeMdns.cpp.o
C:\Users\sample\.platformio\packages\framework-arduinoteensy\libraries\NativeEthernet\src\NativeEthernet.cpp: In static member function 'static int EthernetClass::begin(uint8_t*, long unsigned int, long unsigned int)':
C:\Users\sample\.platformio\packages\framework-arduinoteensy\libraries\NativeEthernet\src\NativeEthernet.cpp:126:30: error: 'FNET_CPU_ETH0_IF' was not declared in this scope
           if(fnet_netif_init(FNET_CPU_ETH0_IF, mac, 6) != FNET_ERR){
                                    ^
C:\Users\sample\.platformio\packages\framework-arduinoteensy\libraries\NativeEthernet\src\NativeEthernet.cpp: In static member function 'static void EthernetClass::begin(uint8_t*, IPAddress, IPAddress, IPAddress, IPAddress)':
C:\Users\sample\.platformio\packages\framework-arduinoteensy\libraries\NativeEthernet\src\NativeEthernet.cpp:258:30: error: 'FNET_CPU_ETH0_IF' was not declared in this scope
           if(fnet_netif_init(FNET_CPU_ETH0_IF, mac, 6) != FNET_ERR){
                                    ^
*** [.pio\build\teensy36\libc62\NativeEthernet\NativeEthernet.cpp.o] Error 1
Compiling .pio\build\teensy36\libc62\NativeEthernet\Nativesocket.cpp.o

This error does not happen while I change the target board to teensy4.1 but while compiling for teensy3.6 this error is happening

Expected behavior

it should compile

Actual behavior

it isnt compiling

Additional information

BenjaminDeHeisenberg commented 2 years ago

Cause of the issue is in: micro_ros_arduino/src/default_transport.cpp the default transport for teensy6.6 is yet to be fixed and built. Currently only a few boards are supported like teensy 4.1 and a few others

It would be great if someone gets the default transport function for teensy3.6

Acuadros95 commented 2 years ago

Hi @BenjaminDeHeisenberg,

I think the problem is that plaformIO is trying to build the NativeEthernet library, which is intended for teensy 4.1 boards.

I'm not familiar with platformIO, so I am not sure why this is happening. ARDUINO_TEENSY41 should not be defined, leaving the library out here: https://github.com/micro-ROS/micro_ros_arduino/blob/galactic/src/native_ethernet_transport.cpp#L9

Maybe @DominikN could give some insight as he included the platformIO example, or @grassjelly which got an example working on a teensy 3.6 here: https://github.com/linorobot/micro_ros_platformio

Also, @carmiac may be able to help, as he included the native ethernet trasport for teensy 4.1.

grassjelly commented 2 years ago

Just figured out how to fix this. You can use lib_ignore on your .ini file to make PlatformIO ignore building NativeEthernet library unnecessarily. https://github.com/linorobot/linorobot2_hardware/commit/09a905787ab645cedbfea9c404ed95d281877700

BenjaminDeHeisenberg commented 2 years ago

Thanks a lot for your support! It means a lot to me. I was able to compile it properly after a patch for teensy3.6 board was added on the github repo, and the code executed properly! Regards, Benjamin Varughese.

On Sun, 16 Jan 2022 at 05:26, Juan Miguel Jimeno @.***> wrote:

Just figured out how to fix this. You can use lib_ignore on your .ini file to make PlatformIO ignore building NativeEthernet library unnecessarily. @.*** https://github.com/linorobot/linorobot2_hardware/commit/09a905787ab645cedbfea9c404ed95d281877700

— Reply to this email directly, view it on GitHub https://github.com/micro-ROS/micro_ros_arduino/issues/667#issuecomment-1013789206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJSU3CEOWTZOZK2IS72WTFLUWINDPANCNFSM5LOM24FA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>