Opened 15 years ago

Last modified 9 years ago

#4681 reopened bug

linkcatkeys fails when building on PPC

Reported by: titer Owned by: pulkomandy
Priority: normal Milestone: Unscheduled
Component: Kits/Locale Kit Version: R1/Development
Keywords: Cc: mati@…
Blocked By: Blocking:
Platform: All

Description

Building hrev33356 from Mac OS X (10.5) PPC fails with the error below. I was building from PPC for PPC, but it looks like a problem related to the host, so I suspect it would happen as well if building from PPC for x86 (I can take the time to confirm that if that's helpful).

LinkApplicationCatalog1 generated/objects/haiku/ppc/common/preferences/appearance/fr.catalog 

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:generated/objects/darwin/lib
generated/objects/darwin/ppc/release/tools/locale/linkcatkeys "src/preferences/appearance/fr.catkeys" -l fr -v -s x-vnd.Haiku-Appearance -o "generated/objects/haiku/ppc/common/preferences/appearance/fr.catalog"

LocaleKit Plaintext: found catalog at src/preferences/appearance/fr.catkeys
plaintext-catalog(sig=x-vnd.Haiku-Appearance, lang=french) has wrong fingerprint after load (83773525 instead of 3933776D). The catalog data may be corrupted, so this catalog is skipped.
couldn't load source-catalog src/preferences/appearance/fr.catkeys - error: Unknown error: -2147483632
...failed LinkApplicationCatalog1 generated/objects/haiku/ppc/common/preferences/appearance/fr.catalog ...
...removing generated/objects/haiku/ppc/common/preferences/appearance/fr.catalog

This change happens to fix it for me:

Index: src/tools/locale/HashMapCatalog.cpp
===================================================================
--- src/tools/locale/HashMapCatalog.cpp (revision 33356)
+++ src/tools/locale/HashMapCatalog.cpp (working copy)
@@ -245,7 +245,7 @@
        while (iter.HasNext())
        {
                entry = iter.Next();
-               hash = B_HOST_TO_LENDIAN_INT32(entry.key.fHashVal);
+               hash = entry.key.fHashVal;
                checksum += hash;
        }
        return checksum;

but I haven't read enough of the surrounding code to know whether this is a proper fix, or I am just adding a bug to hide another - hopefully someone will know better.

Change History (10)

comment:1 by pulkomandy, 15 years ago

Status: newassigned

Actually, it should be changed in the reverse way : keep this byteswapping in place and add one when reloading the key from a file (should be in src/tools/locale/plaintextcatalog.cpp/ReadFromFile()) This is important so the catkeys files are the same for ppc and x86.

comment:2 by pulkomandy, 15 years ago

Can you tell me if, with your fix applied, the fingerprint in generated/objects/haiku/common/preferences/*/en.catkeys matches the associated one in src/preferences/*/fr.catkeys ? If they are the same, then the fix is right. If not, I'll have to find a proper way...

comment:3 by titer, 15 years ago

% head -1 src/preferences/*/fr.catkeys
==> src/preferences/appearance/fr.catkeys <==
1	french	x-vnd.Haiku-Appearance	959674221
==> src/preferences/bluetooth/fr.catkeys <==
1	french	x-vnd.Haiku-BluetoothPrefs	2566651844
==> src/preferences/cpufrequency/fr.catkeys <==
1	french	x-vnd.Haiku-CPUFrequencyPref	2623066734
==> src/preferences/locale/fr.catkeys <==
1	french	x-vnd.Haiku-Locale	3822351296

without the change to HashMapCatalog.cpp:

% head -1 generated/objects/haiku/common/preferences/*/en.catkeys
==> generated/objects/haiku/common/preferences/appearance/en.catkeys <==
1	english	x-vnd.Haiku-Appearance	2205627685
==> generated/objects/haiku/common/preferences/bluetooth/en.catkeys <==
1	english	x-vnd.Haiku-BluetoothPrefs	2566651844
==> generated/objects/haiku/common/preferences/cpufrequency/en.catkeys <==
1	english	x-vnd.Haiku-CPUFrequencyPref	2623066734
==> generated/objects/haiku/common/preferences/locale/en.catkeys <==
1	english	x-vnd.Haiku-Locale	3822351296

with the change to HashMapCatalog.cpp:

% head -1 generated/objects/haiku/common/preferences/*/en.catkeys
==> generated/objects/haiku/common/preferences/appearance/en.catkeys <==
1	english	x-vnd.Haiku-Appearance	959674221
==> generated/objects/haiku/common/preferences/bluetooth/en.catkeys <==
1	english	x-vnd.Haiku-BluetoothPrefs	2566651844
==> generated/objects/haiku/common/preferences/cpufrequency/en.catkeys <==
1	english	x-vnd.Haiku-CPUFrequencyPref	2623066734
==> generated/objects/haiku/common/preferences/locale/en.catkeys <==
1	english	x-vnd.Haiku-Locale	3822351296

So they do match with the change, now isn't that a little weird that "appearance" is the only preference for which there is a mismatch?

comment:4 by titer, 15 years ago

Oh, nevermind, appearance/en.catkeys is the only mismatch because the build failed right afterwards, and the three others are leftovers from an earlier with-the-fix build.

comment:5 by pulkomandy, 15 years ago

Resolution: fixed
Status: assignedclosed

Patch applied in hrev33374 . Its the right thing to do. The swapping may be needed, but if so, it would be elsewhere.

comment:6 by Wizard, 13 years ago

Resolution: fixed
Status: closedreopened

comment:7 by Wizard, 13 years ago

Happens to me while building for ppc, revision 41553, on linux/ppc. Does not happen while building for ppc on linux/x86. Probably fingerprint checking/generating is arch dependent.

LinkApplicationCatalog1 generated/objects/catalogs/kits/locale/ru.catalog 
plaintext-catalog(sig=system, lang=russian) has wrong fingerprint after load (2171040283 instead of 180647795). The catalog data may be corrupted, so this catalog is skipped.
couldn't load source-catalog data/catalogs/kits/locale/ru.catkeys - error: Unknown error 2147483664

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:generated/objects/linux/lib
generated/objects/linux/ppc/release/tools/locale/linkcatkeys "data/catalogs/kits/locale/ru.catkeys" -l ru \
-s system -o "generated/objects/catalogs/kits/locale/ru.catalog"

...failed LinkApplicationCatalog1 generated/objects/catalogs/kits/locale/ru.catalog ...

BUILD FAILURE:

Also other catfiles cause same failure

comment:8 by Wizard, 13 years ago

Cc: mati@… added

comment:9 by pulkomandy, 13 years ago

As I said above, the linkcatkeys tool does various amounts of bitshifting for computing the fingerprint. This would be no problem as such, but there are some casts that may make it different on little endian targets.

comment:10 by pulkomandy, 9 years ago

Milestone: R1Unscheduled
Note: See TracTickets for help on using tickets.