|
Re: Porting to AmigaOS4 thread |
Posted on: 1/2 12:57
#281 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6817
|
@Raziel
If you call your file name as .c, then when you will try to compile with ppc-amigaos-gcc , you will fail, as a compiler will think it pure C and will not include CPP includes (if at the end of include there are no .h, then its cpp includes). So, you have 2 solutions : 1). rename the file so it will be .CPP, and then you can build it and with "gcc" and with "g++" binaries. Through when you will build it with "gcc" you must add at the end -lstdc++ 2). didn't rename it, keep as .C, but then build it with g++ binary. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/2 13:19
#282 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@kas1e
it is a .c file and i was already using g++ renaming it to .cpp did the trick, without any further hassle Thank you |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/9 15:01
#283 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
What is the difference between -O2 and -O3?
Most of the time i see -O2 used. I understand that it will optimize the binary hence reducing it in size. Is it safe to switch to -O3? Will ther be drawbacks, maybe inconsistencies on AmigaOS4? Thanks |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/9 15:53
#284 |
---|---|---|
Quite a regular
![]() ![]() Joined:
2007/2/27 10:47 From Gravity well
Posts: 727
|
I have used -O3 with at least (prebuilt) sdl (1). Eg. Simutrans build.
Before anyone asks, it stopped compiling "as before" since an update years ago. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/9 15:58
#285 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6817
|
@Raziel
Quote:
-O3 will bring you problems only if the code has bugs. Usual practice enables full optimization. Those who sort the bugs by switching to lower optimization level not fixing bugs, but hide them. I use -O3 all the time |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/9 16:31
#286 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@kas1e
@Thematic What kind of bugs? Or all kind of bugs? That would make hunting them difficult. I see from configure that some platforms use -O3 while others use -O2, not consistent either. Maybe i'll do a test build and see where the differences lie. Thanks for the answer |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/12 23:58
#287 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@all
Fundamental question about the difference of newlib and clib2. 1) If I wanted to compile for clib2, would the switch -mcrt=clib2 be sufficient or fo i have to introduce more changes? 2) Does clib2 also make use of libstdc++.so or does it use something else? 3) If I have used third party libs, like libsdl, libflac, libmpeg etc., with newlib, do I need to use a special clib2 build of those libs or can I simply recycle them for clib2? 4) Are shared builds possible with clib2? 5) is there something like clib2.library available? Just like newlib.library? Thank you |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 5:32
#288 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6817
|
@Raziel
Quote:
Just -mcrt=clib2 enough. By default we have -mcrt=newlib , you just didn't see it when run gcc, but if you do "ppc-amigaos-gcc -v test.c -o test", then you will see : Quote:
Quote:
It have its own libstdc++.so (and others), check in sdk/ppc-amigaos/lib/clib2/ directory Quote:
For clib2 programs, all the libs should be as clib2 ones. You can't mix newlib build with clib2 libs (i.e. you can, sometime it will even compile, but will cause all sort of issues). That another issue for big projects: some of our 3d party libs compiled only for newlib. Quote:
As i know clib2 do not support .so as expected, clib2 is not threadsafe, so how it all will works is unclear (i.e. bugs) Quote:
Dunno about. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 7:40
#289 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2902
|
@Raziel
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html -O3 takes longer time to compile, -O2 is faster. Time increases is a factor of around 1.45 to compile it. It might be really noticeable on larger project, with horrible makefiles, but on smaller project you should not notice any different. -O0 Is standard does no optimization, there also fastest to compile. -O3 used to be buggy in some conditions, it invokes more optimizing tricks, so if there is bug in the compiler it can result in buggy exe file. So, people removed -O3 if did not work, not sure if that’s true anymore. Anyway, if you like to find bugs you should compile with -Wall, code can be messy sometimes, often unused variables are left behind, or there some casting that is ignored, that can result in signs bugs, its better to have enabled to begin with, then having to clean up your code, after few 1000 lines of code. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 7:49
#290 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2902
|
@Raziel
Clib2 makes your exe file fat, its statically linked. While newlib is opened as Amiga library before your program starts, somewhere in the background. But I’m not sure everything is in the .library, lets say your exe file will be less fat with newlib. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 7:54
#291 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6817
|
@LiveForIt
Quote:
Compiling times only matter if you compile on a1200. What is the matter: bug-free app, and not how long and fast it compiles on developers' machines. My removing -O3 you hide bugs in the app. Quote:
No, if -O3 show you bugs, it means your code buggy. Quote:
They hide their own bugs by that, -O3 is very well tested by millions of ppls already for a years. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 8:41
#292 |
---|---|---|
Just popping in
![]() ![]() Joined:
2006/11/30 11:59 From Lund, Sweden
Posts: 129
|
@LiveForIt
Quote: -O3 used to be buggy in some conditions, it invokes more optimizing tricks, so if there is bug in the compiler it can result in buggy exe file. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 8:44
#293 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2009/5/1 18:57 From Czech Republic
Posts: 1241
|
@Raziel
Quote: I see from configure that some platforms use -O3 while others use -O2, not consistent either. As others have pointed out, -O3 will also trigger new warnings, which is a good thing. I always compile with -Wall -Wwrite-strings -Wextra -O3 to get enough feedback on my code from the compiler. |
|
_________________
The Rear Window blog AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 10:19
#294 |
---|---|---|
Just popping in
![]() ![]() Joined:
2006/11/30 11:59 From Lund, Sweden
Posts: 129
|
@trixie
Quote: As others have pointed out, -O3 will also trigger new warnings, which is a good thing. With gcc 10 you can also use the -fanalyzer option to find even more bugs, see: https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer Haven't tried it on OS4 though. |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 15:32
#295 |
---|---|---|
Home away from home
![]() ![]() Joined:
2007/9/11 12:31 From Russia
Posts: 6817
|
@sTix
Quote:
Wow, tried simple test case with wrong-double-free:
#include<stdio.h>
And -fanalyzer works, see:
user@DESKTOP-3NFAB0O /amiga
|
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 17:10
#296 |
---|---|---|
Just popping in
![]() ![]() Joined:
2006/11/30 11:59 From Lund, Sweden
Posts: 129
|
@kas1e
Without full memory protection we need all the help we can get :) |
|
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 21:29
#297 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@kas1e
If clib2 cant do shared then it's no alternative for me. Thank you for your always thorough feedback. |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 21:29
#298 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@LiveForIt
Thank you for your feedback |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 21:31
#299 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
@sTix
@trixie I'll definitely try -O3 when I have some free time from work. Thank you for your feedback I'll try -fanalyzer as well, who knows, maybe it will show something new in the shared crashes. |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||
|
Re: Porting to AmigaOS4 thread |
Posted on: 1/13 21:36
#300 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3970
|
I am nowhere near my amiga right now but I remember reading the readme from new GCC builds and always wanted to ask.
There is a snippet about shared obhects/builds in there that says to avoid shared builds due to some planned restructuring. What is needed for this restructuring? Has this restructuring already started and messed up shared builds...what may cause the many issues we are having? Would it be possible to revert these changes to get an outdated, but working, shared support back? Thank you |
|
_________________
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg |
||