-1

I've been working with a teensy for a multithreaded project using openmp compiling with gcc, however I'm joining a project that uses avr-gcc which doesn't seem to want to compile or recognize omp.h . I get the error "avr-gcc: error: unrecognized command line option '-pthread' " when I attempt to compile and am having trouble finding more information. I found this question about gcc-avr having slower updates AVR gcc version < gcc release versions -- why? but am wondering if avr-gcc hasn't yet added openmp support or doesn't for one reason or another and if there's a work around without requiring the team to switch compilers.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
john8839
  • 11
  • 1
  • It sounds like you are using a version of avr-gcc that indeed does not have pthreads support, and a C library that does not provide omp.h. The current docs for GCC generally and for avr-gcc specifically seem to indicate that avr-gcc supports pthreads and OpenMP, so my first guess would be that you are using an outdated version. In that event, you probably would indeed need to switch compilers to use OpenMP and / or Pthreads, if only to a more recent version. – John Bollinger Mar 09 '21 at 14:34
  • I'm on linux and updated my avr toolchain gcc-avr binutils-avr gdb-avr avr-libc avrdude but am having the same issue, this answer https://stackoverflow.com/questions/60877241/can-avr-gcc-use-sys-socket-h seems to disagree which I'm hoping is wrong, they link to docs which don't list support for pthreads. I'm wondering if anyone might have some insight specifically on gcc-avr, my current versions of the avr toolchain are: avr-libc n (1:2.0.0+Atmel3.6.1-2). binutils-avr (2.26.20160125+Atmel3.6.1-4). gcc-avr (1:5.4.0+Atmel3.6.1-2). gdb-avr (7.7-4). avrdude (6.3-20171130+svn1429-2+rpt1). – john8839 Mar 09 '21 at 18:15
  • The Q&A to which you linked does cannot disagree, as it's about an entirely different issue. With that said, if I were confident that I was reading the docs correctly then I would have written an answer, not a comment. It is possible that even the latest of GCC's AVR compilers does not support OpenMP or (a separate question) pthreads. – John Bollinger Mar 09 '21 at 20:26

1 Answers1

1

thanks for the direction it appears that avr-gcc doesn't provide headers that interact with operating systems which apparently pthreads does.

"Since sockets are a feature provided by the operating system, and you are compiling code that runs bare-metal on an Arduino microcontroller, which has no operating system running on top, the whole purpose of the sys/socket.h header is nullified.

This applies to any other kind of header or library function that interacts with the operating system, such as unistd.h, fcntl.h, pthread.h etc. In fact, avr-libc, the Standard C library for AVR-GCC, does not provide such headers.

You will need to look at the avr-libc documentation to find out more about the headers and functions that are provided and their usage."

john8839
  • 11
  • 1