Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
62 user(s) are online (40 user(s) are browsing Forums)

Members: 0
Guests: 62

more...

Support us!

Headlines




« 1 ... 12 13 14 (15) 16 17 18 »


Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 12:31
From Russia
Posts: 7037
@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.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
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
   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/2/27 10:47
From Gravity well
Posts: 731
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.

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 12:31
From Russia
Posts: 7037
@Raziel
Quote:

Is it safe to switch to -O3?
Will ther be drawbacks, maybe inconsistencies on AmigaOS4?


-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

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 12:31
From Russia
Posts: 7037
@Raziel

Quote:

1) If I wanted to compile for clib2, would the switch -mcrt=clib2 be sufficient or fo i have to introduce more changes?


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:

/usr/local/amiga/libexec/gcc/ppc-amigaos/8.2.0/cc1plus.exe -quiet -v -mcrt=newlib -idirafter /usr/local/amiga/ppc-amigaos/SDK/newlib/include -idirafter /usr/local/amiga/ppc-amigaos/SDK/local/newlib/include -idirafter /usr/local/amiga/ppc-amigaos/SDK/include/include_h -idirafter /usr/local/amiga/ppc-amigaos/SDK/include/netinclude -idirafter /usr/local/amiga/ppc-amigaos/SDK/local/common/include rename.cpp -quiet -dumpbase rename.cpp -auxbase rename -version -o /tmp/ccjfomzD.s



Quote:

2) Does clib2 also make use of libstdc++.so or does it use something else?


It have its own libstdc++.so (and others), check in sdk/ppc-amigaos/lib/clib2/ directory


Quote:

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?


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:

4) Are shared builds possible with clib2?


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:

5) is there something like clib2.library available? Just like newlib.library?


Dunno about.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2959
@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.
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2959
@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.
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 12:31
From Russia
Posts: 7037
@LiveForIt
Quote:

-O3 takes longer time to compile, -O2 is faster.


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:

-O3 used to be buggy in some conditions, it invokes more optimizing tricks, so if there is a bug in the compiler it can result in a buggy exe file.



No, if -O3 show you bugs, it means your code buggy.

Quote:

So, people removed -O3 if did not work, not sure if that’s true anymore.


They hide their own bugs by that, -O3 is very well tested by millions of ppls already for a years.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Just popping in
Joined:
2006/11/30 11:59
From Lund, Sweden
Posts: 154
@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.
I wouldn't call it tricks. The main difference between O2 and O3 is that O3 sacrifices a bit of memory to run faster. This might not always succeed due to decreases in code density (resulting in cache misses). To find out how it affects your code you need to do some benchmarking. It could be that projects used O2 for performance reasons, not because the compiler is buggy.

   Report Go to top

Re: Porting to AmigaOS4 thread
Just can't stay away
Joined:
2009/5/1 18:57
From Czech Republic
Posts: 1299
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Just popping in
Joined:
2006/11/30 11:59
From Lund, Sweden
Posts: 154
@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.

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 12:31
From Russia
Posts: 7037
@sTix
Quote:

With gcc 10 you can also use the -fanalyzer option to find even more bugs


Wow, tried simple test case with wrong-double-free:

#include<stdio.h>
#include <stdlib.h>

int main()
{
        
int *ptr_one;

        
ptr_one = (int *)malloc(sizeof(int));

        if (
ptr_one == 0)
        {
                
printf("ERROR: Out of memoryn");
                return 
1;
        }

        *
ptr_one 25;
        
printf("%dn", *ptr_one);

        
free(ptr_one);
        
free(ptr_one);

        return 
0;
}


And -fanalyzer works, see:

user@DESKTOP-3NFAB0O /amiga
ppc-amigaos-gcc -fanalyzer 1.c -o 1
1.c
In function ‘main’:
1.c:20:9warningdouble-‘free’ of ‘ptr_one’ [CWE-415] [-Wanalyzer-double-free]
   
20 |         free(ptr_one);
      |         ^~~~~~~~~~~~~
  
‘main’events 1-6
    
|
    |    
|         ptr_one = (int *)malloc(sizeof(int));
    |      |                          ^~~~~~~~~~~~~~~~~~~
    |      |                          |
    |      |                          (
1allocated here
    
|    |
    |   
10 |         if (ptr_one == 0)
    |      |            ~
    |      |            |
    |      |            (
2assuming ‘ptr_one’ is non-NULL
    
|      |            (3following ‘false’ branch (when ‘ptr_one’ is non-NULL)...
    |......
    |   
16 |         *ptr_one 25;
    |      |         ~~~~~~~~~~~~~
    |      |                  |
    |      |                  (
4) ...to here
    
|      |                  (5first ‘free’ here
    
|......
    |   
20 |         free(ptr_one);
    |      |         ~~~~~~~~~~~~~
    |      |         |
    |      |         (
6second ‘free’ herefirst ‘free’ was at (5)
    |

user@DESKTOP-3NFAB0O /amiga

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Just popping in
Joined:
2006/11/30 11:59
From Lund, Sweden
Posts: 154
@kas1e

Without full memory protection we need all the help we can get :)

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
@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
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4162
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
   Report Go to top


« 1 ... 12 13 14 (15) 16 17 18 »



[Advanced Search]



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project