Trouble compiling with gcc 4.8 on 10.5 PowerPC

Kenneth F. Cunningham ken.cunningham.webuse at gmail.com
Sat Mar 17 22:30:51 UTC 2018


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 + 0x00000034 (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





More information about the macports-users mailing list