Current builds can't link natively.
Hi.
I've tried compiling natively a small C++ example and it fails with many missing references to calls such as __gthread_getspecific , __gthread_setspecific and __gthread_active_p . The references are from unwind_sjlj and others in the C++ library (include/ext/atomicity.h) .
If I forcefully supply the gthr_amigaos_native.o on the command line, then link is successfull and the program run.
You should use the -athread=native (or --athread=native) option if your program requires threading. Let me know if this works (it should link against gthr_amigaos_native.o). I'm reluctant to make this the default option for now, because the hides the fact that program requires some form of threading support (other choices are single and posix). If the implementation is proven to be stable enough, I will think about a default value.
Unfortunately, the thread model has to be decided at compile time of gcc/gthread but this is not so great on AmigaOS (native would be preferred because it doesn't depend on any other library but some ported application may depend on pthread/posix). So I decided to use a custom thread model that allows the user to specify at link time which implementation should be taken.
On 2018-06-30 21:00, Sebastian Bauer wrote:
You should use the -athread=native (or --athread=native) option if your program requires threading.
Well, but it doesn't! It's a 5 line test that initializes a std::vector of ints and then prints them out! My guess is that other components in libstdc++ require it. See the first post, references to gthr_amigaos* come from unwind_sjlj , which I believe to be related to exceptions.
Unfortunately, the thread model has to be decided at compile time of gcc/gthread but this is not so great on AmigaOS (native would be preferred because it doesn't depend on any other library but some ported application may depend on pthread/posix). So I decided to use a custom thread model that allows the user to specify at link time which implementation should be taken.
That is fine, having working threads is wonderful, but it seems it got caught as a dependency for stdlibc++ . Do you need the full list of linker errors ?
Basically every program that uses libstdc++ requires threading and thus a threading implementation.
On 2018-07-01 11:41, Sebastian Bauer wrote:
Basically every that uses libstdc++ requires threading and thus a threading implementation.
So, should the SPEC file be changed to always include one of those threading flags ? Or should it be solved at Makefile level and have anything being compiled with the new GCC have one of the threading flags ?
Thanks.
Am 2018-07-02 08:52, schrieb AV00:
On 2018-07-01 11:41, Sebastian Bauer wrote:
Basically every that uses libstdc++ requires threading and thus a threading implementation. So, should the SPEC file be changed to always include one of those threading flags ? Or should it be solved at Makefile level and have anything being compiled with the new GCC have one of the threading flags ?
For now the latter, but later, if the resulting binaries are stable, we can make the native mode the default. This was at least my plan.
On lunedì 2 luglio 2018 00:53:35 CEST Sebastian Bauer wrote:
Or should it be solved at Makefile level and have anything being compiled with the new GCC have one of the threading flags ?
For now the latter, but later, if the resulting binaries are stable, we can make the native mode the default. This was at least my plan.
Understood.
I'd keep this ticket open till you consider it stable, if you don't mind. So we keep track of the progress.
-- Bye, A.
Slightly off-topic, but would it be possible to document the available threading options? http://www.amigans.net/modules/xforum/viewtopic.php?post_id=111276#forumpost111276
By the way, -athread=pthread doesn't work for me (latest native GCC8), apparently gthr_amigaos_pthread.o is missing.
Also "--athread=native" is not recognized here.
@capehill
Good call regarding the documentation.
It should be "-athread=native" (mind the double "-" in front of your line) and should reside in LDFLAGS (but you probably knew that already(?) - Thanks to MickJT for that hint...
Am 2018-08-19 18:12, schrieb capehill:
Slightly off-topic, but would it be possible to document the available threading options? http://www.amigans.net/modules/xforum/viewtopic.php?post_id=111276#forumpost111276
You find some tiny documentation in the doc folder.
The patch itself is here:
https://github.com/sba1/adtools/blob/master/gcc/8/patches/0025-Add-amigaos-thread-model.patch