Re: Trouble compiling with gcc 4.8 on 10.5 PowerPC

2018-03-21 Thread Kenneth F. Cunningham

On 2018-03-18, at 8:44 AM, Kenneth F. Cunningham wrote:


>> There's just one little problem remaining: I cannot use gcc-ar-mp-6 because
>> it reports the following error: "Cannot find plugin liblto_plugin.so".
> 

Looks like this is just broken on all MacPorts versions of gcc, for example on 
this Intel 10.7.5 box I have with me now:

$ /opt/local/bin/x86_64-apple-darwin11-gcc-ar-mp-7
/opt/local/bin/x86_64-apple-darwin11-gcc-ar-mp-7: Cannot find plugin 
'liblto_plugin.so'




Re: Trouble compiling with gcc 4.8 on 10.5 PowerPC

2018-03-19 Thread Ryan Schmidt

On Mar 18, 2018, at 08:32, Andreas Falkenhahn wrote:

> There's just one little problem remaining: I cannot use gcc-ar-mp-6 because
> it reports the following error: "Cannot find plugin liblto_plugin.so".
> So I just use the "ar" that came with Xcode and it worked fine but maybe
> gcc-ar-mp-6 should be fixed.

Looks like this ticket:

https://trac.macports.org/ticket/38551

> Another question: How can I make my program compatible with 10.4? I currently
> compile on my G5 system which has 10.5 installed. When I try to run the
> program on a G4 10.4 system I get a symbol import error from 
> /usr/lib/libstdc++.6.dylib.
> Do I have to install macports-gcc-6 on the 10.4 system in order to be able
> to run my program on 10.4 or is there anything else that needs to be taken 
> care
> of?

Setting MACOSX_DEPLOYMENT_TARGET=10.4 is all that you're supposed to have to do 
for that. But you do have to have that set at the time that you compile not 
just your program but also all of the libraries that you're using and 
distributing.

The default value of MACOSX_DEPLOYMENT_TARGET on Mac OS X 10.5 and later is the 
major OS version number, so e.g. on 10.5 the default MACOSX_DEPLOYMENT_TARGET 
is 10.5. On Mac OS X 10.1 through 10.4, the default value is 10.1.



Re: Trouble compiling with gcc 4.8 on 10.5 PowerPC

2018-03-18 Thread Kenneth F. Cunningham

On 2018-03-18, at 7:32 AM, Andreas Falkenhahn wrote:

> 
> Thanks, this indeed solved all my problems!

Great!


> There's just one little problem remaining: I cannot use gcc-ar-mp-6 because
> it reports the following error: "Cannot find plugin liblto_plugin.so".

Will see how this is on my PPC machines at home.


> 
> Another question: How can I make my program compatible with 10.4?

The symbols and linkage and construction are os version dependent. 

The easiest thing to do would be to install ibgcc on the 10.4 system using 
MacPorts, and see if that works to support your application when you build it 
on 10.5 and move it backwards. It might work just doing that. It might not.

If not, then it gets complicated. Cameron Kaiser builds TenFourFox for PPC 
machines, a Firefox clone. It's about as complicated a piece of software that 
exists for PPC these days, and he has all these issues. He has a lot of 
documentation regarding how he does this on his github repo, but in essence, 
builds against the 10.4u SDK on 10.5, and sets the deployment target to 10.4. 
Then moves the parts into the application bundle and rejigs the library links.

All rather complicated, but interesting in how it's done.

Far easier to just build your application on 10.4 PPC in the first place. 
That's what I do for most things.


>  I'm also running MorphOS on my PowerPC Macs. This
> is another PPC operating system inspired by AmigaOS.

I'll check that out. Thanks for the tip.

Best,

K





Re: Trouble compiling with gcc 4.8 on 10.5 PowerPC

2018-03-18 Thread Andreas Falkenhahn
Hi Kenneth,

On 17.03.2018 at 23:30 Kenneth F. Cunningham wrote:

> As a first step, if you don't specifically require gcc-4.8, try
> instead with gcc-6 (macports-gcc-6) which works quite a bit better in most 
> cases.

Thanks, this indeed solved all my problems! The malloc errors have disappeared
and the linker warning as well. Thanks a lot for the hint!

There's just one little problem remaining: I cannot use gcc-ar-mp-6 because
it reports the following error: "Cannot find plugin liblto_plugin.so".
So I just use the "ar" that came with Xcode and it worked fine but maybe
gcc-ar-mp-6 should be fixed.

Another question: How can I make my program compatible with 10.4? I currently
compile on my G5 system which has 10.5 installed. When I try to run the
program on a G4 10.4 system I get a symbol import error from 
/usr/lib/libstdc++.6.dylib.
Do I have to install macports-gcc-6 on the 10.4 system in order to be able
to run my program on 10.4 or is there anything else that needs to be taken care
of?

> After that, we slog through. It's a great system, PPC, but there
> are not so many of us using it any more. We need to stick together!

Definitely. PPC rules. I'm also running MorphOS on my PowerPC Macs. This
is another PPC operating system inspired by AmigaOS.

-- 
Best regards,
 Andreas Falkenhahnmailto:andr...@falkenhahn.com



Re: Trouble compiling with gcc 4.8 on 10.5 PowerPC

2018-03-17 Thread Kenneth F. Cunningham

On 2018-03-17, at 4:17 PM, Andreas Falkenhahn wrote:

> Hi,
> 
> I need to compile C++11 sources for PowerPC OS X so I installed gcc48 using 
> Mac Ports. Although the binary generated by gcc-mp-4.8 actually works, I do 
> get some warning messages which are worrying me.
> 
> When linking my project, I get this warning:
> 
>ld: warning: 32-bit absolute address out of range (0x100521C58 max is 
> 4GB): from _REQUIRED_TAGS + 0x0034 (0x00521C5C) to 0x100521C58
> 
> For reference, this is how I link my project:
> 
>gcc-mp-4.8 -fPIC -dynamiclib -exported_symbols_list exports.def -o 
> macppc48/plugin.dylib macppc48/plugin.o -Llibharu/macppc48 -Llibapng/macppc48 
> -Lpdfium/macppc48 -L../freetype-2.8/macppc48/objs/.libs -lharu -lapng 
> -lpdfjpeg -lfreetype -lcms -lopenjpeg -lagg -lpdfium -lfdrm -lfpdfdoc 
> -lfpdfapi -lfpdftext -lfxcodec -lopenjpeg -lfxcrt -lfxge -lpwl -lformfiller 
> -ljavascript -lpdfiumbase -lfdrm -lfreetype -lpdfjpeg -lagg -lcms -lm -lpwl 
> -lfpdfdoc -lz -lstdc++ -framework AppKit -framework CoreFoundation
> 
> When running my project, I get lots of these errors:
> 
>testprogram(151,0xa0b96820) malloc: *** error for object 0x41384d0: 
> Non-aligned pointer being freed (2)
>*** set a breakpoint in malloc_error_break to debug
> 
> My project is a cross-platform project which already runs fine on many other 
> platforms (x86/x64 Mac; Windows; x86/x64/ppc/arm Linux, etc.) so I'm pretty 
> certain that those issues are not related to bugs in my code but that either 
> something is wrong with gcc 4.8 or that I'm not using it correctly.
> 
> Anyone here who knows how to solve these issues? As I said, despite those 
> warnings the program seems to work correctly but of course these warnings are 
> worrying me and I want them to disappear.
> 
> Thanks!
> 

As a first step, if you don't specifically require gcc-4.8, try instead with 
gcc-6 (macports-gcc-6) which works quite a bit better in most cases.

Also, make sure you have cctools installed, which includes a number of updated 
basic toolchain pieces that help out a lot.

The specific error you're seeing "32-bit absolute address out of range" tends 
to happen when things are compiled with clang-3.4 on PPC, so if you see 
anything being compiled with clang-3.4, rebuild it with gcc-6 instead.

After that, we slog through. It's a great system, PPC, but there are not so 
many of us using it any more. We need to stick together!

Best,

Ken