Compilation errors with stl map in uclibc++

Karthik Vadambacheri Manian karthikvm.uc at gmail.com
Sat May 22 21:33:24 CEST 2010


Hi All,

I tried to run a small c++ application which uses stl map on top of fiasco.
The application compiles and runs perfectly when compiled using standard c++
libraries. But when I try to create a package with this appilcation source
code in tudos/l4/pkg (where compilation is done with uclibc++ instead of
standard c++) I get few compilation errors. It would be great if someone
gives some pointers on the error.

Source code: mymap.cc

#include<iostream>
#include<string>
#include<map>

using namespace std;

int
main()
{
        map<string, int> grade_list;
        map<string, int>::iterator mapIterator;
        grade_list["John"] = 100;
        grade_list["Alice"] = 100;
        mapIterator = grade_list.begin();
        cout<<mapIterator->first<<endl;
        cout<<mapIterator->second<<endl;
        mapIterator++;
        cout<<mapIterator->first<<endl;
        cout<<mapIterator->second<<endl;
        return(0);
}

Output:

$ ./mymap
Alice
100
John
100

Compilation log:

  ... Building
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/.general.d
install -d /home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/
echo '# automatically created -- modifications will be lost' >
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo 'SRC :=
/home/karthik/Research/tudos/l4/pkg/testmap/server/src'
>> /home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo 'OBJ :=
/home/karthik/Research/tudos/ubuild'                                   >>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo '.PHONY: x $(MAKECMDGOALS)'                           >>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo 'x:'                                                   >>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo '  PWD=$(SRC) $(MAKE) -C $(SRC) O=$(OBJ)'    >>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo '$(MAKECMDGOALS):'                                    >>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
echo '  PWD=$(SRC) $(MAKE) -C $(SRC) O=$(OBJ) $@'>>
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/Makefile
PWD=/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/OBJ-amd64_686-l4v2
make  -C
/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/OBJ-amd64_686-l4v2
-f Makefile
make[1]: Entering directory
`/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/OBJ-amd64_686-l4v2'
  ... Building .general.d
  ... Building Makefile.inc
make[1]: Leaving directory
`/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/OBJ-amd64_686-l4v2'
make[1]: Entering directory
`/home/karthik/Research/tudos/ubuild/pkg/testmap/server/src/OBJ-amd64_686-l4v2'
  ... Compiling mymap.o
LD_PRELOAD=/home/karthik/Research/tudos/ubuild/tool/gendep/libgendep.so
GENDEP_TARGET=mymap.o GENDEP_BINARY=cc1plus   g++ -m64 -c     -DUSE_UCLIBC=y
-DRAM_BASE=0x0    -DSYSTEM_amd64_686_l4v2 -DARCH_amd64 -DCPUTYPE_686
-DL4API_l4v2 -DCONFIG_L4_CALL_SYSCALLS -DCONFIG_L4_ABS_SYSCALLS
-I/home/karthik/Research/tudos/ubuild/pkg/testmap/idl/OBJ-amd64-l4v2
-I/home/karthik/Research/tudos/ubuild/include/amd64/l4v2
-I/home/karthik/Research/tudos/ubuild/include/l4v2
-I/home/karthik/Research/tudos/ubuild/include/amd64
-I/home/karthik/Research/tudos/ubuild/include
-I/home/karthik/Research/tudos/l4/../dice/include
-I/home/drops/include/amd64/l4v2 -I/home/drops/include/l4v2
-I/home/drops/include/amd64 -I/home/drops/include -nostdinc
-I/home/karthik/Research/tudos/ubuild/include/amd64/uclibc
-I/home/karthik/Research/tudos/ubuild/include/uclibc
-I/home/karthik/Research/tudos/ubuild/include/uclibc++
-I/home/drops/include/amd64/uclibc -I/home/drops/include/uclibc
-I/home/drops/include/uclibc++ -I/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include
-I/usr/lib/gcc/x86_64-linux-gnu/4.4.1/include-fixed -gstabs+
-DHAVE_CONFIG_H -I/home/karthik/Research/warped_dir/warped/src
-I/home/karthik/Research/warped_dir/warped/src/warped
-I/home/karthik/Research/warped_dir/clutils_build/include
-I/usr/include/pccts -g -O2 -fno-strict-aliasing -mno-red-zone  -Wall
-fno-common -fno-stack-protector
/home/karthik/Research/tudos/l4/pkg/testmap/server/src/mymap.cc -o mymap.o
/home/karthik/Research/tudos/ubuild/include/uclibc++/map: In constructor
‘std::map<Key, T, Compare, Allocator>::map(const Compare&, const Allocator&)
[with Key = std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, T = int, Compare = std::less<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, Allocator =
std::allocator<int>]’:
/home/karthik/Research/tudos/l4/pkg/testmap/server/src/mymap.cc:10:
instantiated from here
/home/karthik/Research/tudos/ubuild/include/uclibc++/map:108: error: invalid
conversion from ‘const std::basic_string<char, std::char_traits<char>,
std::allocator<char> > (*)(std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int>)’ to
‘std::basic_string<char, std::char_traits<char>, std::allocator<char> >
(*)(std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>)’
/home/karthik/Research/tudos/ubuild/include/uclibc++/map:108: error:
initializing argument 3 of ‘std::__single_associative<Key, ValueType,
Compare, Allocator>::__single_associative(const Compare&, const Allocator&,
typename std::__base_associative<Key, ValueType, Compare,
Allocator>::key_type (*)(typename std::__base_associative<Key, ValueType,
Compare, Allocator>::value_type)) [with Key = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, ValueType =
std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>, Compare = std::less<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, Allocator =
std::allocator<int>]’
/home/karthik/Research/tudos/ubuild/include/uclibc++/associative_base: In
constructor ‘std::__base_associative<Key, ValueType, Compare,
Allocator>::__base_associative(const Compare&, const Allocator&, Key
(*)(ValueType)) [with Key = std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, ValueType = std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int>, Compare =
std::less<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, Allocator = std::allocator<int>]’:
/home/karthik/Research/tudos/ubuild/include/uclibc++/associative_base:502:
instantiated from ‘std::__single_associative<Key, ValueType, Compare,
Allocator>::__single_associative(const Compare&, const Allocator&, typename
std::__base_associative<Key, ValueType, Compare, Allocator>::key_type
(*)(typename std::__base_associative<Key, ValueType, Compare,
Allocator>::value_type)) [with Key = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, ValueType =
std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>, Compare = std::less<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, Allocator =
std::allocator<int>]’
/home/karthik/Research/tudos/ubuild/include/uclibc++/map:108:   instantiated
from ‘std::map<Key, T, Compare, Allocator>::map(const Compare&, const
Allocator&) [with Key = std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, T = int, Compare = std::less<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, Allocator =
std::allocator<int>]’
/home/karthik/Research/tudos/l4/pkg/testmap/server/src/mymap.cc:10:
instantiated from here
/home/karthik/Research/tudos/ubuild/include/uclibc++/associative_base:78:
error: invalid conversion from ‘std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
(*)(std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>)’ to ‘const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
(*)(std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>)’
Makefile.inc:14: *** [mymap.o] Error 1

Thanks for your time,
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20100522/27cf2744/attachment.html>


More information about the l4-hackers mailing list