Issue 123688 - ARMV7L - App build fails on cppu_detail_getUnoType(int*)
Summary: ARMV7L - App build fails on cppu_detail_getUnoType(int*)
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 4.1.0-dev
Hardware: PC Linux, all
: P3 Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-14 20:39 UTC by SET
Modified: 2013-11-14 20:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SET 2013-11-14 20:39:04 UTC
Hello,

First, I don't know if we can call this a bug, but only developpers can look in this.

On 32-bit Linux armv7l(hardware : ODROID-U2), an application code that compiles on x86_64, fails with the following errors :

.....
g++    -c -O2 -s -DCPPU_ENV=gcc3 -DGCC -DLINUX -DUNX -I../../../aoo410/fr/openoffice4/sdk/include -std=c++11 -MMD -MP -MF build/Release/GNU-Linux-armv7l/_ext/2055503500/OOTest.o.d -o build/Release/GNU-Linux-armv7l/_ext/2055503500/OOTest.o ../OOTools/OOTest.cpp
In file included from ../../../aoo410/fr/openoffice4/sdk/include/com/sun/star/uno/Any.h:29:0,
                 from ../../../aoo410/fr/openoffice4/sdk/include/com/sun/star/uno/XInterface.hdl:7,
                 from ../../../aoo410/fr/openoffice4/sdk/include/com/sun/star/uno/XComponentContext.hdl:6,
                 from ../../../aoo410/fr/openoffice4/sdk/include/com/sun/star/uno/XComponentContext.hpp:6,
                 from ../OOTools/TestCaller.h:15,
                 from ../OOTools/OOTest.h:14,
                 from ../OOTools/OOTest.cpp:11:
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx: In instantiation of ‘static const com::sun::star::uno::Type& cppu::UnoType< <template-parameter-1-1> >::get() [with T = int]’:
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:286:38:   required from ‘const com::sun::star::uno::Type& cppu::getTypeFavourUnsigned(const T*) [with T = int]’
../../../aoo410/fr/openoffice4/sdk/include/com/sun/star/uno/Any.hxx:52:2:   required from ‘com::sun::star::uno::Any::Any(const T&) [with T = int]’
../OOTools/OOTest.cpp:98:34:   required from here
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:265:60: erreur: call of overloaded ‘cppu_detail_getUnoType(int*)’ is ambiguous
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:265:60: note: candidates are:
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:152:1: note: const com::sun::star::uno::Type& cppu::detail::cppu_detail_getUnoType(const sal_Int32*) <near match>
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:152:1: note:   no known conversion for argument 1 from ‘int*’ to ‘const sal_Int32* {aka const long int*}’
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:157:1: note: const com::sun::star::uno::Type& cppu::detail::cppu_detail_getUnoType(const sal_uInt32*) <near match>
../../../aoo410/fr/openoffice4/sdk/include/cppu/unotype.hxx:157:1: note:   no known conversion for argument 1 from ‘int*’ to ‘const sal_uInt32* {aka const long unsigned int*}’
nbproject/Makefile-Release.mk:128: recipe for target 'build/Release/GNU-Linux-armv7l/_ext/2055503500/OOTest.o' failed
make[2]: *** [build/Release/GNU-Linux-armv7l/_ext/2055503500/OOTest.o] Error 1
make[2]: Leaving directory '/home/ddu/tmp/TestPrj'
nbproject/Makefile-Release.mk:106: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/home/ddu/tmp/TestPrj'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
.....

g++ seems to be unable to use an int* pointer in get() because there's no cppu_detail_getUnoType prototype that handles an int* . Next g++ gets confused while trying to approximate things, between sal_Int32* and sal_uInt32* data types.

The following patch, that adds a prototype of cppu_detail_getUnoType to handle an int* parameter cures the problem, and compilation succeeds :

*****************************************************************
--- sdk/include/cppu/unotype.hxx.ori	2013-11-03 22:06:32.000000000 +0100
+++ sdk/include/cppu/unotype.hxx	2013-11-14 19:31:40.720551801 +0100
@@ -153,6 +153,13 @@
     return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_LONG);
 }
 
+#ifdef ARM
+inline ::com::sun::star::uno::Type const &
+cppu_detail_getUnoType(int const *) {
+    return ::cppu::detail::getTypeFromTypeClass(::typelib_TypeClass_LONG);
+}
+#endif
+
 inline ::com::sun::star::uno::Type const &
 cppu_detail_getUnoType(::sal_uInt32 const *) {
     return ::cppu::detail::getTypeFromTypeClass(

*****************************************************************

Is it the only way to solve the problem ?
Are there other tweaks I can do without having to patch unotype.hxx ?
Is it that on x86_64 cppu_detail_getUnoType never gets an int* as parameter template ? Why , how ?

OpenOffice on arm has been configured with :
./configure --disable-debug --without-junit --with-lang=ALL --with-package-format=installed --with-epm=/usr/bin/epm --enable-category-b --enable-gstreamer --enable-opengl --enable-beanshell --enable-hyphen --enable-hunspell --enable-minimizer --enable-presenter-console --enable-pdfimport --enable-wiki-publisher --enable-graphite --with-arm-target=7 --with-jdk-home=/home/ddu/programs/j2sdk-image

OS info : Arch Linux ARM : 
$ uname -a
Linux ddu.nmset.info 3.8.13.10-2-ARCH #3 SMP PREEMPT Sun Oct 6 16:32:03 CDT 2013 armv7l GNU/Linux
$ g++ --version
g++ (GCC) 4.7.2
..
sizeof(int) = 4
sizeof(long) = 4
..
$ svn info
Path: .
Working Copy Root Path: /home/ddu/src/aoo
URL: https://svn.apache.org/repos/asf/openoffice/trunk
Relative URL: ^/openoffice/trunk
Repository Root: https://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 1538326
Node Kind: directory
Schedule: normal
Last Changed Author: jsc
Last Changed Rev: 1537973
Last Changed Date: 2013-11-01 17:18:51 +0100 (Fri, 01 Nov 2013)


Thanks.