Build failure for iconv/iconvconfig

Carlos O'Donell carlos@redhat.com
Sat Apr 4 16:19:33 GMT 2020


On 4/4/20 10:34 AM, William Tambe via Libc-help wrote:
> On Fri, Apr 3, 2020 at 4:58 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * William Tambe:
>>
>>> On Fri, Apr 3, 2020 at 3:42 PM Florian Weimer <fweimer@redhat.com> wrote:
>>>>
>>>> * William Tambe:
>>>>
>>>>> On Fri, Apr 3, 2020 at 11:34 AM Florian Weimer <fweimer@redhat.com> wrote:
>>>>>>
>>>>>> * William Tambe via Libc-help:
>>>>>>
>>>>>>> We are porting GLIBC and we are getting the following linking error;
>>>>>>> from the logs below, any idea what object is missing ?
>>>>>>>
>>>>>>> arch-elf/bin/ld: /glibc-build/iconv/iconvconfig.o: in function `print_version':
>>>>>>> iconvconfig.c:(.text+0x36): undefined reference to `dcgettext'
>>>>>>> arch-elf/bin/ld: iconvconfig.c:(.text+0x36): warning: internal error:
>>>>>>> unsupported relocation
>>>>>>
>>>>>> You need to fix that first, the rest may be fallout from that.
>>>>>
>>>>> We fixed "internal error: unsupported relocation" and are no longer
>>>>> seeing that error, but we are still seeing the undefined references as
>>>>> shown below; any idea what is the missing object file we need to add,
>>>>> and where in the makefile to add it ?
>>>>
>>>> It looks like you are completely missing libc.
>>>
>>> I see following in iconv/Makefile:
>>> iconvconfig-modules = strtab xmalloc hash-string
>>>
>>> Would it be where to append missing module to build iconvconfig.o ? if
>>> yes, what would be the name of the module ?
>>
>> You need to check if libc.so.6 is on the linker command line.  It should
>> be.  Here is what I see:
>>
>> gcc -Wl,-rpath-link=…/build:…/build/math:…/build/elf:…/build/dlfcn:…/build/nss:…/build/nis:…/build/rt:…/build/resolv:…/build/mathvec:…/build/support:…/build/crypt:…/build/nptl
>>   -nostdlib -nostartfiles -o …/build/iconv/iconvconfig -Wl,-z,combreloc
>>   -Wl,-z,relro -Wl,--hash-style=both …/build/csu/crt1.o …/build/csu/crti.o
>>   `gcc --print-file-name=crtbegin.o` …/build/iconv/iconvconfig.o
>>   …/build/iconv/strtab.o …/build/iconv/xmalloc.o
>>   …/build/iconv/hash-string.o
>>   -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2 …/build/libc.so.6
>>   …/build/libc_nonshared.a -Wl,--as-needed …/build/elf/ld.so
>>   -Wl,--no-as-needed -lgcc `gcc --print-file-name=crtend.o`
>>   …/build/csu/crtn.o
>>
>> If libc.so.6 is there, you need to check if it has the expected
>> contents.  Based on the error messages you quoted, it's not clear to me
>> if the linker can find any symbols at all.
> 
> libc.so.6 is there as shown below:
> 
> arch-elf-gcc -Wl,-rpath-link=/glibc-build:/glibc-build/math:/glibc-build/elf:/glibc-build/dlfcn:/glibc-build/nss:/glibc-build/nis:/glibc-build/rt:/glibc-build/resolv:/glibc-build/mathvec:/glibc-build/support:/glibc-build/crypt
> -nostdlib -nostartfiles
> -o /glibc-build/iconv/iconvconfig
> -Wl,-z,combreloc -Wl,-z,relro
> -Wl,--hash-style=both
> /glibc-build/csu/crt1.o
> /arch-elf/9.2.0/crti.o
> /arch-elf/9.2.0/crtbegin.o
> /glibc-build/iconv/iconvconfig.o
> /glibc-build/iconv/strtab.o
> /glibc-build/iconv/xmalloc.o
> /glibc-build/iconv/hash-string.o
> -Wl,-dynamic-linker=/opt/arch-toolchain/lib/ld.so.1
> /glibc-build/libc.so.6
> /glibc-build/libc_nonshared.a
> -Wl,--as-needed /glibc-build/elf/ld.so
> -Wl,--no-as-needed -lgcc
> /arch-elf/9.2.0/crtend.o
> /arch-elf/9.2.0/crtn.o
> 
> The symbols reported as undefined reference appear to be in libc.so.6
> as shown below:
> 
> $ arch-elf-readelf -s libc.so.6 | fgrep dcgettext
>    412: 0002599c    26 FUNC    GLOBAL DEFAULT    8 __dcgettext@@GLIBC_2.0
>    261: 00000000     0 FILE    LOCAL  DEFAULT  ABS dcgettext.c
>   3160: 0002599c    26 FUNC    LOCAL  DEFAULT    8 __GI___dcgettext
>   7392: 0002599c    26 FUNC    WEAK   DEFAULT    8 dcgettext
>   7619: 0002599c    26 FUNC    GLOBAL DEFAULT    8 __dcgettext
> 
> $ arch-elf-readelf -s libc.so.6 | fgrep calloc
>    521: 00091a56   658 FUNC    GLOBAL DEFAULT    8 __libc_calloc@@GLIBC_2.0
>   3435: 00091a56   658 FUNC    LOCAL  DEFAULT    8 __calloc
>   6151: 00091a56   658 FUNC    GLOBAL DEFAULT    8 __libc_calloc
>   7177: 00091a56   658 FUNC    WEAK   DEFAULT    8 calloc
> 
> Please, any more ideas on what we might be missing ?

At this point you have to carefully debug the link, generate a link map,
run the linker in verbose mode, look at each undefined symbol and carefully
line it up with definitions in each object added to the link. If you can
show it's a bug in the linker then you have to look at your linker port
and make sure there isn't a bug there.

-- 
Cheers,
Carlos.



More information about the Libc-help mailing list