AIX link problema

Fórumok

Sziasztok,

Adott egy c++ modul, amit tobb platformra is leforditunk (x64 linux, z/linux, aix). A modul linkelese sajnos nem fut le, a statikusan szeretnem linkelni ICU es boost locale libekkel. A folyamat eredmenye egy uj statikus lib lenne, ami mar tartalmazza a mi kis modulunkat es statikusan a korabban felsorolt libeket is.
Minden platformon gond nelkul lemegy a forditas/linkeles, de AIX-en meggyult vele a bajom.

A linkeles kimenete:

/opt/IBM/xlC/16.1.0/bin/xlclang++ -G -q64 -bernotok -blibpath:. -bnoquiet -bsymbolic -bshared -licudata -Lexternal/icu_libs_a64/lib -licui18n -Lexternal/icu_libs_a64/lib -licuuc -Lexternal/icu_libs_a64/lib -lboost_locale -Lexternal/boost_libs_a64/stage/lib -o target/libunicode.a  target/obj/unicode/src/unicode_capi.o target/obj/unicode/src/unicode_character.o target/obj/unicode/src/unicode_codepoint.o target/obj/unicode/src/unicode_convert.o target/obj/unicode/src/unicode_util.o   -Llib  -ldl
(ld): setopt 64
(ld): halt 4
(ld): setopt noautoexp 
(ld): setopt rtl
(ld): setopt nortllib
(ld): setopt symbolic:1
(ld): setfflag 4
(ld): cdtors 1 all 0 s
(ld): savename target/libunicode.a
(ld): filelist 20 2
(ld): setopt noprogram
(ld): noentry
NOENTRY: There is no entry point.
(ld): i /lib/crti_64.o
(ld): setopt autoimp
(ld): lib external/icu_libs_a64/lib/libicudata.a
(ld): lib external/icu_libs_a64/lib/libicui18n.a
(ld): lib external/icu_libs_a64/lib/libicuuc.a
(ld): lib external/boost_libs_a64/stage/lib/libboost_locale.a
(ld): i target/obj/unicode/src/unicode_capi.o
(ld): i target/obj/unicode/src/unicode_character.o
(ld): i target/obj/unicode/src/unicode_codepoint.o
(ld): i target/obj/unicode/src/unicode_convert.o
(ld): i target/obj/unicode/src/unicode_util.o
(ld): lib /usr/lib/libdl.a
(ld): lib /opt/IBM/xlc/16.1.0/lib/libxlopt.a
(ld): lib /opt/IBM/xlc/16.1.0/lib/libxlipa.a
(ld): lib /opt/IBM/xlc/16.1.0/lib/libxl.a
(ld): lib /usr/lib/libc++.a
(ld): lib /opt/IBM/xlC/16.1.0/lib/libCcore.a
(ld): lib /usr/lib/libpthreads.a
(ld): lib /usr/lib/libm.a
(ld): lib /usr/lib/libatomic.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libdl.a[shr_64.o]: 4 symbols imported.
LIBRARY: Symbols imported from import file /usr/lib/libc++.a[shr.imp]: 0
LIBRARY: Symbols imported from import file /usr/lib/libc++.a[shr_64.imp]: 1844
LIBRARY: Symbols imported from import file /usr/lib/libc++.a[cxxabi.imp]: 0
LIBRARY: Symbols imported from import file /usr/lib/libc++.a[cxxabi_64.imp]: 354
LIBRARY: Symbols imported from import file /opt/IBM/xlC/16.1.0/lib/libCcore.a[shrcore_32.imp]: 0
LIBRARY: Symbols imported from import file /opt/IBM/xlC/16.1.0/lib/libCcore.a[ansicore_32.imp]: 0
LIBRARY: Symbols imported from import file /opt/IBM/xlC/16.1.0/lib/libCcore.a[shrcore_64.imp]: 132
LIBRARY: Symbols imported from import file /opt/IBM/xlC/16.1.0/lib/libCcore.a[ansicore_64.imp]: 81
LIBRARY: Shared object libpthreads.a[shr_xpg5_64.o]: 346 symbols imported.
LIBRARY: Shared object libatomic.a[libatomic.so.1]: 40 symbols imported.
LIBRARY: Shared object libc.a[shr_64.o]: 3108 symbols imported.
LIBRARY: Shared object libc.a[posix_aio_64.o]: 20 symbols imported.
LIBRARY: Shared object libc.a[aio_64.o]: 18 symbols imported.
LIBRARY: Shared object libc.a[pse_64.o]: 8 symbols imported.
LIBRARY: Shared object libc.a[dl_64.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty_64.o]: 1 symbols imported.
LIBRARY: Shared object libc.a[cthread_64.o]: 25 symbols imported.
FILELIST: Number of previously inserted files processed: 20
(ld): exports /tmp/xlcSEH3iMae 
EXPORTS: Symbols exported: 503
(ld): resolve
RESOLVE: 2251 of 20116 symbols were kept.
(ld): addgl /usr/lib/glink64.o
ADDGL: Glink code added for 78 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
	The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing Symbol
 ----------------------------------------------------------------------------------------------
 vtable for icu_70::ByteSink    [10334] ER UA unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000144e0 .data    R_POS    [10336] <vtable for icu_70::ByteSink>
 typeinfo for icu_70::ByteSink    [10370] ER UA unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000177e0 .data    R_POS    [10366] typeinfo for icu_70::StringByteSink<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >
                                   00014ff0 .data    R_POS    [10372] <typeinfo for icu_70::ByteSink>
 icu_70::ByteSink::GetAppendBuffer(int, int, char*, int, int*) [10350] ER DS unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000175c8 .data    R_POS    [10342] vtable for icu_70::StringByteSink<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >
                                   00014f88 .data    R_POS    [10352] <icu_70::ByteSink::GetAppendBuffer(int, int, char*, int, int*)>
 icu_70::ByteSink::Flush() [10346] ER DS unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000175d0 .data    R_POS    [10342] vtable for icu_70::StringByteSink<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >
                                   00014f80 .data    R_POS    [10348] <icu_70::ByteSink::Flush()>
 .icu_70::ByteSink::~ByteSink()  [11174] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000032d4 .text    R_RBR    [2891]  <>
                                   00006568 .text    R_RBR    [2891]  <>
                                   00011928 .text    R_RBR    [2891]  <>
 .boost::locale::util::get_system_locale(bool) [11176] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00003418 .text    R_RBR    [2891]  <>
 .icu_70::Locale::createCanonical(char const*) [11180] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   0000368c .text    R_RBR    [2891]  <>
 .icu_70::Collator::createInstance(icu_70::Locale const&, UErrorCode&) [11188] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00003e20 .text    R_RBR    [2891]  <>
 .icu_70::BreakIterator::createCharacterInstance(icu_70::Locale const&, UErrorCode&) [11202] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00005138 .text    R_RBR    [2891]  <>
 .utext_openUTF8_70        [11210] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00007478 .text    R_RBR    [2891]  <>
 .utext_close_70           [11212] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000074ec .text    R_RBR    [2891]  <>
 .icu_70::CaseMap::utf8ToUpper(char const*, unsigned int, icu_70::StringPiece, icu_70::ByteSink&, icu_70::Edits*, UErrorCode&) [11224] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   0000ba60 .text    R_RBR    [2891]  <>
 .icu_70::CaseMap::utf8ToLower(char const*, unsigned int, icu_70::StringPiece, icu_70::ByteSink&, icu_70::Edits*, UErrorCode&) [11226] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   0000c060 .text    R_RBR    [2891]  <>
 .icu_70::UMemory::operator delete(void*)  [11234] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00011934 .text    R_RBR    [2891]  <>
 .icu_70::Locale::~Locale()    [11236] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   00011c9c .text    R_RBR    [2891]  <>
 .u_hasBinaryProperty_70   [11248] ER PR unicode/src/unicode_character.cpp(target/obj/unicode/src/unicode_character.o)
                                   000130c8 .text    R_RBR    [2891]  <>
                                   000130e4 .text    R_RBR    [2891]  <>
                                   00013748 .text    R_RBR    [2891]  <>
                                   00013764 .text    R_RBR    [2891]  <>
 .u_errorName_70           [1049]  ER PR unicode/src/unicode_util.cpp(target/obj/unicode/src/unicode_util.o)
                                   00001200 .text    R_RBR    [562]   .automic::unicode::impl::ensure_icu_success(UErrorCode, char const*)
 .ucnv_close_70            [10619] ER PR unicode/src/unicode_convert.cpp(target/obj/unicode/src/unicode_convert.o)
                                   00009390 .text    R_RBR    [3608]  <>
 .ucnv_convertEx_70        [10627] ER PR unicode/src/unicode_convert.cpp(target/obj/unicode/src/unicode_convert.o)
                                   0000a600 .text    R_RBR    [3608]  <>
 .ucnv_open_70             [10631] ER PR unicode/src/unicode_convert.cpp(target/obj/unicode/src/unicode_convert.o)
                                   0000ba10 .text    R_RBR    [3608]  <>
 .ucnv_setSubstChars_70    [10633] ER PR unicode/src/unicode_convert.cpp(target/obj/unicode/src/unicode_convert.o)
                                   0000bc9c .text    R_RBR    [3608]  <>
ER: The return code is 8.
ld: 0711-317 ERROR: Undefined symbol: vtable for icu_70::ByteSink
ld: 0711-317 ERROR: Undefined symbol: typeinfo for icu_70::ByteSink
ld: 0711-317 ERROR: Undefined symbol: icu_70::ByteSink::GetAppendBuffer(int, int, char*, int, int*)
ld: 0711-317 ERROR: Undefined symbol: icu_70::ByteSink::Flush()
ld: 0711-317 ERROR: Undefined symbol: .icu_70::ByteSink::~ByteSink()
ld: 0711-317 ERROR: Undefined symbol: .boost::locale::util::get_system_locale(bool)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::Locale::createCanonical(char const*)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::Collator::createInstance(icu_70::Locale const&, UErrorCode&)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::BreakIterator::createCharacterInstance(icu_70::Locale const&, UErrorCode&)
ld: 0711-317 ERROR: Undefined symbol: .utext_openUTF8_70
ld: 0711-317 ERROR: Undefined symbol: .utext_close_70
ld: 0711-317 ERROR: Undefined symbol: .icu_70::CaseMap::utf8ToUpper(char const*, unsigned int, icu_70::StringPiece, icu_70::ByteSink&, icu_70::Edits*, UErrorCode&)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::CaseMap::utf8ToLower(char const*, unsigned int, icu_70::StringPiece, icu_70::ByteSink&, icu_70::Edits*, UErrorCode&)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::UMemory::operator delete(void*)
ld: 0711-317 ERROR: Undefined symbol: .icu_70::Locale::~Locale()
ld: 0711-317 ERROR: Undefined symbol: .u_hasBinaryProperty_70
ld: 0711-317 ERROR: Undefined symbol: .u_errorName_70
ld: 0711-317 ERROR: Undefined symbol: .ucnv_close_70
ld: 0711-317 ERROR: Undefined symbol: .ucnv_convertEx_70
ld: 0711-317 ERROR: Undefined symbol: .ucnv_open_70
ld: 0711-317 ERROR: Undefined symbol: .ucnv_setSubstChars_70
make: *** [/home/uc4build/workspace/ae_runid_0371356951/a64_new/shared-c/make/shared/build.mk:54: target/libunicode.a] Error 8



Dump parancs kimenete az egyik hianyzo methodusra szurve:

uc4build@vwgaix08:/home/uc4build/workspace/ae_runid_0371356951/a64_new # dump -Tv external/icu_libs_a64/lib/libicuuc.a | grep utf8ToUpper
[3078]  0x200496e8    .data      EXP     DS SECdef        [noIMid] ucasemap_utf8ToUpper_70
[3081]  0x2004970c    .data      EXP     DS SECdef        [noIMid] _ZN6icu_707CaseMap11utf8ToUpperEPKcjNS_11StringPieceERNS_8ByteSinkEPNS_5EditsER10UErrorCode
[3084]  0x20049730    .data      EXP     DS SECdef        [noIMid] _ZN6icu_707CaseMap11utf8ToUpperEPKcjS2_iPciPNS_5EditsER10UErrorCode

Latszolag a statikus lib tartalmazza ezt a fuggvenyt.
Van valakinek ottlete mit rontok el?

Koszi a segitseget!

Hozzászólások

A demangle / c++filt mire oldja fel ezeket a szimbólumokat?

Ezzel kezdtem én is, a demangle eredménye ugyan az, mint amit az ld adott:

icu_70::CaseMap::utf8ToUpper(char const*, unsigned int, icu_70::StringPiece, icu_70::ByteSink&, icu_70::Edits*, UErrorCode&)

Ez persze nem jelenti azt, hogy az ld-ben látható symbol mangled eredménye egyezik :)

// Happy debugging, suckers
#define true (rand() > 10)

> Az ibm doku nem igazan bobeszedu es nem tudom mit jelent a dump outputban a [noIMid] attrumutum.

Csak annyit jelent, hogy nem értelmezhető az 'import helye', mivel nem import, hanem export. Pl. itt a 495-ös importált, az 512-es exportált szimbóleum:


[Index]      Value      Scn     IMEX Sclass   Type                    IMPid  Name
[495]   0x00000000    undef      IMP     DS EXTref /usr/lib/libc.a(shr_64.o) _Errno
[512]   0x2000f468    .data      EXP     DS   Ldef                  [noIMid] SSL_free

Nem nagyon értem, de van három random kérdésem:
* Ugye még véletlenül sincs közte semmilyen gcc/g++-szal fordított komponens? (Különböző C++ fordítók garantáltan nem működnek együtt.)
* Ugye minden komponens azonos compiler-opciókkal van fordítva (pl.: -D_THREAD_SAFE)?
* Tudnál egy minimális példát készíteni, ami mutatja a problémát?

1) minden komponenst xlc-vel forditottunk

2) sajnos ezt nem tudom teljes bizonyossaggal megmondani, de ezt a compiler opciot biztosan nem hasznaljuk. A libek (boost, icu) forditasanal sem hasznaljuk explicit.

3) milyen peldara gondolsz? ha valamilyen outputra van szukseged, megprobalom eloallitani.

Sajnos nekem nincs ilyen xlC-m, ezért nem tudom kipróbálni a programod linkelését. No meg az is gond, hogy nekem nincs meg a te programod. Ha mondjuk csapnál egy két fájlból álló mintát, ami mutatja ugyanezt a hibát, ést azt feltöltenéd valahova (github, pl.), akkor legalább ki tudnám próbálni g++ -szal (Aix 6.1 vagy 7.1-en).

Szerkesztve: 2023. 02. 08., sze – 16:59

Mondjuk azt a részt nem értem, hogy amikor 'statikus lib'-et mondasz, de shared object-et készítesz (igaz, hogy *.a fájlba csomagolva), akkor melyik az igazi?

(`man ld`-ben a `-G` és `-bshared` opciókat tessék megnézni, hogy mit csinálnak.)

Igen, igazad van. Az eredeti makefile (ami egyebek mellett mindenfele script-ekkel generalt) nem tolem szarmazik, nekem csak valahogy gatyaba kellene razni. De elvileg ez nem kellene ilyen jellegu hibat dobjon, nem?

Ha kicserelem -bshared -re akkor minden hivatkozott std c fuggveny is hianyzik neki, nem csak a boost_locale es ICU fuggvenyei.

Van valami ottleted mi lehet a [noIMid] attributum a dump listazasban?

bash-4.3$ for i in 32 64; do echo "=== $i ==="; ar -X$i tv external/icu_libs_a64/lib/libicuuc.a; done
=== 32 ===
rwxr-xr-x  1087/917   5180649 Jan 26 11:47 2023 libicuuc.so
=== 64 ===

32bit-es lenne a lib??? Ha ez igy van (es ugy nezem igy van), akkor rettento bena vagyok... :)

Szia,

a kovetkezo opciokkal sikeresen leforditottam az ICU-t es a projektem is linkelni tud vele:

export CFLAGS="-fPIC -m64"
export CXXFLAGS="-std=c++14 -fPIC -m64"
export OBJECT_MODE=64

Az egyetlen hianyzo fuggveny ami nem linkel az a boost_locale-bol jon es idokozben kiderult, hogy az viszont gcc-vel forditjuk. Szoval minden tipped bejott! :)

Halas koszonet a segitsegert. Amennyiben sikerul az utolso hibat is elharitani, akkor jelzek.