Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openthread: does not build on current Arch #10809

Closed
miri64 opened this issue Jan 17, 2019 · 14 comments
Closed

openthread: does not build on current Arch #10809

miri64 opened this issue Jan 17, 2019 · 14 comments
Assignees
Labels
Area: network Area: Networking Area: pkg Area: External package ports Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@miri64
Copy link
Member

miri64 commented Jan 17, 2019

Description

When trying to build examples/openthread for #10599 I wasn't able to do so on my current Arch-based laptop

Steps to reproduce the issue

Have a setup Arch distribution and try to compile examples/openthread

Expected results

The application will build successfully.

Actual results

The build errors

meshcop/dataset.cpp: In member function 'otError ot::MeshCoP::Dataset::AppendMleDatasetTlv(ot::Message&) const':
meshcop/dataset.cpp:487:56: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class ot::MeshCoP::DelayTimerTlv' from an array of 'const class ot::MeshCoP::Tlv' [-Werror=class-memaccess]
             memcpy(&delayTimer, cur, sizeof(delayTimer));
                                                        ^
In file included from meshcop/dataset.hpp:40,
                 from meshcop/dataset.cpp:37:
./meshcop/meshcop_tlvs.hpp:1141:7: note: 'class ot::MeshCoP::DelayTimerTlv' declared here
 class DelayTimerTlv: public Tlv
       ^~~~~~~~~~~~~
  CXX      meshcop/libopenthread_mtd_a-dtls.o
  CXX      meshcop/libopenthread_mtd_a-energy_scan_client.o
cc1plus: all warnings being treated as errors
make[5]: *** [Makefile:3909: meshcop/libopenthread_mtd_a-dataset.o] Fehler 1
make[5]: *** Es wird auf noch nicht beendete Prozesse gewartet....
meshcop/dataset_manager.cpp: In member function 'void ot::MeshCoP::DatasetManager::SendGetResponse(const ot::Coap::Header&, const ot::Ip6::MessageInfo&, uint8_t*, uint8_t) const':
meshcop/dataset_manager.cpp:907:78: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
             if ((tlv = mNetwork.Get(static_cast<const Tlv::Type>(aTlvs[index]))) != NULL)
                                                                              ^
cc1plus: all warnings being treated as errors

Versions

Quite recent Arch while writing this issue (I might not have updated for 1 or 2 days or so ;-))


Operating System Environment
-----------------------------
       Operating System: "Arch Linux" 
                 Kernel: Linux 4.20.1-arch1-1-ARCH x86_64 unknown

Installed compiler toolchains
-----------------------------
             native gcc: gcc (GCC) 8.2.1 20181127
      arm-none-eabi-gcc: arm-none-eabi-gcc (Arch Repository) 8.2.0
                avr-gcc: avr-gcc (GCC) 8.2.0
       mips-mti-elf-gcc: missing
             msp430-gcc: missing
   riscv-none-embed-gcc: missing
   xtensa-esp32-elf-gcc: missing
   xtensa-lx106-elf-gcc: missing
                  clang: clang version 7.0.1 (tags/RELEASE_701/final)

Installed compiler libs
-----------------------
   arm-none-eabi-newlib: "3.0.0"
    mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
               avr-libc: "2.0.0" ("20150208")

Installed development tools
---------------------------
                  cmake: cmake version 3.13.2
               cppcheck: missing
                doxygen: 1.8.15
                 flake8: 3.6.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.7.2 on Linux
                    git: git version 2.20.1
                   make: GNU Make 4.2.1
                openocd: missing
                 python: Python 3.7.2
                python2: Python 2.7.15
                python3: Python 3.7.2
             coccinelle: missing
@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Area: pkg Area: External package ports labels Jan 17, 2019
@miri64 miri64 added this to the Release 2019.01 milestone Jan 17, 2019
@jcarrano
Copy link
Contributor

jcarrano commented Feb 8, 2019

This is caused by new warnings in GCC 8.1. This upstream PR may have fixed it: openthread/openthread#2944

@aabadie
Copy link
Contributor

aabadie commented Jul 2, 2020

Is this still the case ? Using arm gcc 9.2.1 it builds just fine.

@miri64
Copy link
Member Author

miri64 commented Jul 2, 2020

I did not get that error, but now I get

In file included from ./coap/coap.hpp:37,
                 from ./common/instance.hpp:50,
                 from api/channel_monitor_api.cpp:37:
./common/debug.hpp:83: error: "assert" redefined [-Werror]
   83 | #define assert(cond)  \
      | 
In file included from /usr/arm-none-eabi/include/sys/reent.h:503,
                 from /usr/arm-none-eabi/include/stdlib.h:18,
                 from /usr/arm-none-eabi/include/c++/10.1.0/cstdlib:75,
                 from /usr/arm-none-eabi/include/c++/10.1.0/stdlib.h:36,
                 from ../../include/openthread/instance.h:38,
                 from ../../include/openthread/channel_monitor.h:38,
                 from api/channel_monitor_api.cpp:35:
/home/mlenders/Repositories/RIOT-OS/RIOT/core/include/assert.h:107: note: this is the location of the previous definition
  107 | #define assert(cond) ((cond) ? (void)0 : core_panic(PANIC_ASSERT_FAIL, \
      | 

Current setup (but same system, just 1.5 years later):

Operating System Environment
----------------------------
         Operating System: "Arch Linux" 
                   Kernel: Linux 5.7.5-arch1-1 x86_64 unknown
             System shell: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
             make's shell: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

Installed compiler toolchains
-----------------------------
               native gcc: gcc (GCC) 10.1.0
        arm-none-eabi-gcc: arm-none-eabi-gcc (Arch Repository) 10.1.0
                  avr-gcc: missing
         mips-mti-elf-gcc: missing
               msp430-gcc: missing
     riscv-none-embed-gcc: missing
     xtensa-esp32-elf-gcc: xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0
   xtensa-esp8266-elf-gcc: missing
                    clang: missing

Installed compiler libs
-----------------------
     arm-none-eabi-newlib: "3.3.0"
      mips-mti-elf-newlib: missing
  riscv-none-embed-newlib: missing
  xtensa-esp32-elf-newlib: "2.2.0"
xtensa-esp8266-elf-newlib: missing
                 avr-libc: missing (missing)

Installed development tools
---------------------------
                   ccache: missing
                    cmake: cmake version 3.17.3
                 cppcheck: missing
                  doxygen: 1.8.18
                      git: git version 2.27.0
                     make: GNU Make 4.3
                  openocd: Open On-Chip Debugger 0.10.0+dev-01157-gd6541a811-dirty (2020-04-04-00:05)
                   python: Python 3.8.3
                  python2: Python 2.7.18
                  python3: Python 3.8.3
                   flake8: error: /usr/bin/python3: No module named flake8
               coccinelle: missing

The upstream bug might have been fixed with 4f83dfd

@miri64 miri64 added this to the Release 2020.07 milestone Jul 4, 2020
@goldroom
Copy link

goldroom commented Nov 19, 2020

I got the same building error as mentioned in the latest comment by @miri64 .

I tried compiling examples/openthread on:

  • Up2date Debian 10 (Buster)
  • Up2date Manjaro (which is based on Arch Linux)
  • Up2date Ubuntu 18.04.5 LTS (bionic)

Update (tested on Ubuntu):

  • It doesn't compile when using gcc-arm-none-eabi-9-2020-q2-update => gcc version 9.3.1 20200408 (release) (GNU Arm Embedded Toolchain 9-2020-q2-update)
  • It does compile when using gcc-arm-none-eabi-7-2018-q2-update => gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

I'm just updating my arch. I will see how it goes

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

I cannot reproduce the issue.
@goldroom which RIOT commit are you using?

@goldroom
Copy link

@jia200x sorry, I updated my comment shortly after posting:

  • It doesn't compile when using gcc-arm-none-eabi-9-2020-q2-update => gcc version 9.3.1 20200408 (release) (GNU Arm Embedded Toolchain 9-2020-q2-update)
  • It does compile when using gcc-arm-none-eabi-7-2018-q2-update => gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)

I'm using the latest master commit, i.e. 6b573b9.

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

I suspect this is caused by mixing OpenThread and RIOT includes when building the OpenThread pkg. I will see if I can find a workaround

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

@goldroom does it stop building during the compile phase of the pkg? (./configure + make)
Does it get to build RIOT files?

@goldroom
Copy link

@jia200x

  • "does it stop building during the compile phase of the pkg?" => yes
  • "Does it get to build RIOT files?" => no
[...]
  AR       libmbedcrypto.a
ar: `u' modifier ignored since `D' is the default (see `U')
 /usr/bin/mkdir -p '.../myRIOT/examples/openthread/bin/samr21-xpro/pkg/openthread/output//lib'
 /usr/bin/install -c -m 644  libmbedcrypto.a '.../myRIOT/examples/openthread/bin/samr21-xpro/pkg/openthread/output//lib'
 ( cd '.../myRIOT/examples/openthread/bin/samr21-xpro/pkg/openthread/output//lib' && arm-none-eabi-ranlib libmbedcrypto.a )
make[6]: Nothing to be done for 'install-data-am'.
make[6]: Nothing to be done for 'install-exec-am'.
make[6]: Nothing to be done for 'install-data-am'.
Making install in src
Making install in core
  CXX      api/libopenthread_ftd_a-border_router_api.o
  CXX      api/libopenthread_ftd_a-channel_manager_api.o
In file included from ./coap/coap.hpp:37,
                 from ./common/instance.hpp:50,
                 from api/channel_manager_api.cpp:37:
./common/debug.hpp:83: error: "assert" redefined [-Werror]
   83 | #define assert(cond)  \
      | 
In file included from .../gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/include/sys/reent.h:503,
                 from .../gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/include/stdlib.h:18,
                 from .../gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/include/c++/9.3.1/cstdlib:75,
                 from .../gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/include/c++/9.3.1/stdlib.h:36,
                 from ../../include/openthread/instance.h:38,
                 from ../../include/openthread/channel_manager.h:38,
                 from api/channel_manager_api.cpp:35:
.../myRIOT/core/include/assert.h:107: note: this is the location of the previous definition
  107 | #define assert(cond) ((cond) ? (void)0 : core_panic(PANIC_ASSERT_FAIL, \
      | 
cc1plus: all warnings being treated as errors
make[5]: *** [Makefile:2391: api/libopenthread_ftd_a-channel_manager_api.o] Error 1
make[4]: *** [Makefile:486: install-recursive] Error 1
make[3]: *** [Makefile:649: install-recursive] Error 1
make[2]: *** [Makefile:952: install] Error 2
make[1]: *** [Makefile:51: .../myRIOT/examples/openthread/bin/samr21-xpro/pkg/openthread/output/lib/libopenthread-ftd.a] Error 2
make: *** [.../myRIOT/examples/openthread/../../Makefile.include:660: pkg-build-openthread] Error 2

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

@goldroom could you try the following patch in your RIOT repo? https://gist.github.com/jia200x/485b0f7264aa13b328b7a504b9f452de

@goldroom
Copy link

@jia200x this patch fixed it. Now it's also building successfully with gcc version 9.3.1 20200408 (release) (GNU Arm Embedded Toolchain 9-2020-q2-update). Thanks!

@jia200x
Copy link
Member

jia200x commented Nov 19, 2020

great!
That patch it's not the final solution, but would mitigate the effect until we bump to a newer OpenThread version. I will open a PR with that.

@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@maribu
Copy link
Member

maribu commented Sep 19, 2022

Builds fine on Alpine. Arch typically is on par with Alpine on the toolchain versions, so I think this should also work on Arch. Please re-open, if this is not correct.

@maribu maribu closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: pkg Area: External package ports Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

8 participants