Pages

Tuesday, October 18, 2011

Fix console font on NetBSD 5.1/macppc

One of annoying things about booting NetBSD 5.1 on PowerMAC G4 after install is console font which is too big to fit in screen. Today I found solution on port-macppc mailing list. You can see it here http://mail-index.netbsd.org/port-macppc/2011/10/18/msg001479.html.

Edit your kernel config file to look like this:

#options    FONT_GALLANT12x22
options       FONT_VT8x8
then recompile and reboot.

Saturday, October 15, 2011

Webkit-gtk on NetBSD 5.1/macppc additional notes (solved)

I've got response from bug report on webkit-gtk (pkg/45429) and here is solution for fixing compiling process on NetBSD/macppc. Create a file named hacks.mk in pkgsrc/www/webkit-gtk. Copy/paste the following and then do make clean; make.

# $NetBSD: hacks.mk,v 1.4 2010/11/02 07:54:31 wiz Exp $

.include "../../mk/compiler.mk"

### [Sun Nov 14 02:35:50 EST 2004 : jlam]
### On PowerPC, building with optimisation with GCC causes an "attempt
### to free unreference scalar".  Remove optimisation flags as a
### workaround until GCC is fixed.
###
.if !empty(CC_VERSION:Mgcc*) && !empty(MACHINE_PLATFORM:MNetBSD-*-powerpc)
PKG_HACKS+=             powerpc-codegen
BUILDLINK_TRANSFORM+=   rename:-O2:-O0
.endif

Wednesday, October 5, 2011

NetBSD 5.1 pkgsrc webkit-gtk compiling problem on PowerMAC G4

After successful installation I've got working NetBSD 5.1/macppc and I tried to add some pkgs to use the MAC for workstation. Here what I've got:
NetBSD 5.1 (G4) #5: Sat Nov 19 19:39:08 EET 2011
root@macppc:/usr/src/sys/arch/macppc/compile/G4
total memory = 1152 MB
avail memory = 1102 MB
timecounter: Timecounters tick every 10.000 msec
found openpic PIC at 80040000
OpenPIC Version 1.2: Supports 4 CPUs and 64 interrupt sources.
bootpath: /pci@f2000000/mac-io@17/ata-4@1f000/disk@0:3,/netbsd
mainbus0 (root)
cpu0 at mainbus0: 7455 (Revision 3.3), ID 0 (primary)
cpu0: HID0 8450c0bc, powersave: 1
cpu0: 1000.00 MHz, 256KB L2 cache no parity parity enabled, 1MB no-parity L3 cache (DDR SRAM) at 4:1 ratio
Trying to compile some meta-pkgs like gnome or kde I ran into some problems.

webkit-gtk - Compilation fails on some file FastMalloc.cpp but all errors are redirected to /dev/null so I couldn't find how to fix this. There is also bug report from 2009 about this problem you can see it here http://mail-index.netbsd.org/pkgsrc-bugs/2009/02/01/msg030663.html. Here is the error I've got:
zsh 6 # make install
=> Bootstrap dependency digest>=20010302: found digest-20080510
===> Skipping vulnerability checks.
WARNING: No /var/db/pkg/pkg-vulnerabilities file found.
WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.
===> Building for webkit-gtk-1.4.1nb1
/usr/pkg/bin/gmake all-am
gmake[1]: Entering directory `/usr/src/pkgsrc/www/webkit-gtk/work/webkit-1.4.1'
CXX Source/JavaScriptCore/wtf/libJavaScriptCore_la-FastMalloc.lo
Source/JavaScriptCore/wtf/FastMalloc.cpp:1299: warning: converting to 'size_t' from 'float'
Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'void WTF::TCMalloc_PageHeap::scavenge()':
Source/JavaScriptCore/wtf/FastMalloc.cpp:1637: warning: converting to 'size_t' from 'float'
Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'void WTF::TCMalloc_Central_FreeList::Populate()':
Source/JavaScriptCore/wtf/FastMalloc.cpp:2833: warning: cast from 'char*' to 'void**' increases required alignment of target type
Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'T* WTF::PageHeapAllocator::New() [with T = WTF::Span]':
Source/JavaScriptCore/wtf/FastMalloc.cpp:1142: instantiated from here
Source/JavaScriptCore/wtf/FastMalloc.cpp:1039: warning: cast from 'char*' to 'void**' increases required alignment of target type
Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'T* WTF::PageHeapAllocator::New() [with T = WTF::TCMalloc_ThreadCache]':
Source/JavaScriptCore/wtf/FastMalloc.cpp:3045: instantiated from here
Source/JavaScriptCore/wtf/FastMalloc.cpp:1039: warning: cast from 'char*' to 'void**' increases required alignment of target type
gmake[1]: *** [Source/JavaScriptCore/wtf/libJavaScriptCore_la-FastMalloc.lo] Error 1
gmake[1]: Leaving directory `/usr/src/pkgsrc/www/webkit-gtk/work/webkit-1.4.1'
gmake: *** [all] Error 2
*** Error code 2

Stop.
make: stopped in /usr/src/pkgsrc/www/webkit-gtk
*** Error code 1

Stop.
make: stopped in /usr/src/pkgsrc/www/webkit-gtk
Still no solution which means that kde web browser and epiphany web browser will not be build. After 1-2 days searching on the net for solution I decided to solve the problem myself. After some tweaking of the GNUmakefile I finally got the error message that fails the compile process
# c++ -DHAVE_CONFIG_H -I. -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -DENABLE_GLIB_SUPPORT=1 -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DXP_UNIX -DWTF_USE_ICU_UNICODE=1 -DWTF_USE_GSTREAMER=1 -DGTK_API_VERSION_2=1 -DNDEBUG -I./Source -I./Source/JavaScriptCore -I./Source/JavaScriptCore/API -I./Source/JavaScriptCore/assembler -I./Source/JavaScriptCore/bytecode -I./Source/JavaScriptCore/bytecompiler -I./Source/JavaScriptCore/collector/handles -I./Source/JavaScriptCore/debugger -I./Source/JavaScriptCore/ForwardingHeaders -I./Source/JavaScriptCore/interpreter -I./Source/JavaScriptCore/jit -I./Source/JavaScriptCore/parser -I./Source/JavaScriptCore/profiler -I./Source/JavaScriptCore/runtime -I./Source/JavaScriptCore/wtf -I./Source/JavaScriptCore/wtf/gobject -I./Source/JavaScriptCore/wtf/gtk -I./Source/JavaScriptCore/wtf/text -I./Source/JavaScriptCore/wtf/unicode -I./Source/JavaScriptCore/yarr -DPNG_NO_ASSEMBLER_CODE -I/usr/src/pkgsrc-current/www/webkit-gtk/work/.buildlink/include -I/usr/src/pkgsrc-current/www/webkit-gtk/work/.x11-buildlink/include/freetype2 -I/usr/src/pkgsrc-current/www/webkit-gtk/work/.x11-buildlink/include -fno-rtti -fstrict-aliasing -O3 -I/usr/src/pkgsrc-current/www/webkit-gtk/work/.buildlink/include/glib/glib-2.0 -I/usr/src/pkgsrc-current/www/webkit-gtk/work/.buildlink/lib/glib-2.0/include -D_REENTRANT -O2 -O2 -MT Source/JavaScriptCore/wtf/libJavaScriptCore_la-FastMalloc.lo -MD -MP -MF Source/JavaScriptCore/wtf/.deps/libJavaScriptCore_la-FastMalloc.Tpo -c ./Source/JavaScriptCore/wtf/FastMalloc.cpp -o Source/JavaScriptCore/wtf/libJavaScriptCore_la-FastMalloc.o
./Source/JavaScriptCore/wtf/FastMalloc.cpp:1299: warning: converting to 'size_t' from 'float'
./Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'void WTF::TCMalloc_PageHeap::scavenge()':
./Source/JavaScriptCore/wtf/FastMalloc.cpp:1637: warning: converting to 'size_t' from 'float'
./Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'void WTF::TCMalloc_Central_FreeList::Populate()':
./Source/JavaScriptCore/wtf/FastMalloc.cpp:2833: warning: cast from 'char*' to 'void**' increases required alignment of target type
./Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'T* WTF::PageHeapAllocator::New() [with T = WTF::Span]':
./Source/JavaScriptCore/wtf/FastMalloc.cpp:1142: instantiated from here
./Source/JavaScriptCore/wtf/FastMalloc.cpp:1039: warning: cast from 'char*' to 'void**' increases required alignment of target type
./Source/JavaScriptCore/wtf/FastMalloc.cpp: In member function 'T* WTF::PageHeapAllocator::New() [with T = WTF::TCMalloc_ThreadCache]':
./Source/JavaScriptCore/wtf/FastMalloc.cpp:3045: instantiated from here
./Source/JavaScriptCore/wtf/FastMalloc.cpp:1039: warning: cast from 'char*' to 'void**' increases required alignment of target type
./Source/JavaScriptCore/wtf/TCSpinLock.h: In member function 'void WTF::TCMalloc_ThreadCache::PickNextSample(size_t)':
./Source/JavaScriptCore/wtf/TCSpinLock.h:113: error: 'asm' operand requires impossible reload
Quick search over google and I found that there was such problem with compilation of webkit-gtk on other OS's on PowerPC arch. It seems that this is gcc compiler bug on macppc arch. Simple solution is to compile with -O0 (do not optimize) instead of -O2 option.

Just for now here is quick and dirty solution to this:
start building process and when GNUmakefile is generated stop the process with ctrl+c.
Now open generated GNUmakefile (usually in webkit-gtk/work/webkit-gtk-1.4.x/GNUmakefile) with some editor and replace all -O2 with -O0 then save and exit and continue the compilation process by entering the dir and typing: gmake


Here are some links for the solutions Í found:
debian solution - http://blog.gmane.org/gmane.linux.debian.ports.powerpc/month=20070801/page=8
webkit-gtk bug report - https://bugs.webkit.org/show_bug.cgi?id=14521
bug report to gcc - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10396

Unfortunately these solutions dont work on NetBSD and I'm not good enough with assembler to make myself a patch.

When this was fixed I ran into another error.
gmake[1]: Entering directory `/usr/src/pkgsrc-current/www/webkit-gtk/work/webkit-1.4.3'
test -d Source/WebKit/gtk/po/ || mkdir -p Source/WebKit/gtk/po/
/usr/bin/msgfmt -c -o Source/WebKit/gtk/po/id.mo Source/WebKit/gtk/po/id.po
test -d Source/WebKit/gtk/po/ || mkdir -p Source/WebKit/gtk/po/
/usr/bin/msgfmt -c -o Source/WebKit/gtk/po/it.mo Source/WebKit/gtk/po/it.po
Source/WebKit/gtk/po/it.po:1324: keyword "msgctxt" unknown
Source/WebKit/gtk/po/it.po:1324:8: parse error
/usr/bin/msgfmt: found 2 fatal errors
gmake[1]: *** [Source/WebKit/gtk/po/it.mo] Error 1
gmake[1]: Leaving directory `/usr/src/pkgsrc-current/www/webkit-gtk/work/webkit-1.4.3'
gmake: *** [all] Error 2
This can be fixed easy by upgrading your gettext package. cd pkgsrc/devel/gettext; make install