7

I am getting an odd ICU related linking error in the now project when building on Ubuntu 22.04.

/usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
/home/bkey1/vcpkg/installed/x64-linux/debug/lib/libicuuc.a(udata.ao): in function `openCommonData(char const*, int, UErrorCode*)':
udata.cpp:(.text+0x23f7): undefined reference to `icudt71_dat'
/usr/bin/ld: udata.cpp:(.text+0x2458): undefined reference to `icudt71_dat'

The link command is as follows.

usr/bin/cmake -E cmake_link_script CMakeFiles/now.dir/link.txt --verbose=1
/usr/bin/c++  -std=c++2a -Wall -Wextra -Wfloat-equal -Wno-long-long -Wpedantic -funsigned-char -D_GNU_SOURCE=1 -rdynamic CMakeFiles/now.dir/GetStardate.cpp.o CMakeFiles/now.dir/GetTime.cpp.o CMakeFiles/now.dir/GetTimePlatformPOSIX.cpp.o CMakeFiles/now.dir/GetTimePlatformWin32.cpp.o CMakeFiles/now.dir/ISO8601_time.cpp.o CMakeFiles/now.dir/InitLocale.cpp.o CMakeFiles/now.dir/executable_path.cpp.o CMakeFiles/now.dir/now.cpp.o CMakeFiles/now.dir/nowStrings.cpp.o -o now  /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_chrono.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_filesystem.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_locale.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_log.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_program_options.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_regex.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_system.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_thread.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_date_time.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_log_setup.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libboost_atomic.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libicudata.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libicui18n.a /home/bkey1/vcpkg/installed/x64-linux/debug/lib/libicuuc.a 
Benilda Key
  • 2,836
  • 1
  • 22
  • 34

3 Answers3

2

First I would like to stress, that there is very little information provided, so the answers such as my own will most likely need to guess what is happening. On the other hand I understand your situation: you cannot include info, that you don't know is relevant to the topic.

Answer: I would like to draw your attention to the fact, that the symbol icudt71_dat does not appear anywhere in the code directly, but is generated using a macro. (Check .../source/common/unicode/utypes.h) So if the linker complains about not having found such a symbol it most probably means you are linking against a different version of the library than you have a header for. Now I don't know how specifically this could have happened, I would have to see your system, include path, link path etc. However I strongly suggest to revisit both include and link paths. You could perhaps recompile the library, verify, there is no other version recompile and start again. If the header corresponds to the source, it should work.

  • 2
    I have not figured out how to fix my problem but this answer did help me to figure out what the problem is. I am apparently using header files for one version of ICU (from the system include path) and linking with library files from another version of ICU (from VCPKG). I need to fix the problem in my CMake build process. – Benilda Key Jun 21 '22 at 16:52
  • I apologize for the vaguely worded question. When you have no idea why something is happening you have to describe the symptoms and hope for the best. – Benilda Key Jun 21 '22 at 16:53
  • 1
    @BenKey have you sorted out the build system issue? I have the same problem. – jhruby Nov 15 '22 at 23:33
  • 1
    @jhruby Yes. It took awhile for me to figure it out but I finally did. Believe it or not the order of ICU librarys is actually important. Previously I linked with the ICU libraries in the following order: data i18n uc. Now I link with the libraries in the following order: i18n uc data. The key is you have to link with the data library after you link with the others. – Benilda Key Nov 17 '22 at 03:27
  • 1
    @BenKey I have just returned from holidays and you saved me a lot of hours :D Thank you so much. – jhruby Nov 21 '22 at 12:50
1

if you link icu with static library, may be the linked order matters, try this:

  list(APPEND ICU_LINK_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../third_party/icu4c/lib/${TARGET_PLATFORM_NAME}/libicui18n.a)
  list(APPEND ICU_LINK_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../third_party/icu4c/lib/${TARGET_PLATFORM_NAME}/libicuuc.a)
  list(APPEND ICU_LINK_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../third_party/icu4c/lib/${TARGET_PLATFORM_NAME}/libicudata.a)
  list(APPEND ICU_LINK_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../third_party/icu4c/lib/${TARGET_PLATFORM_NAME}/libicuio.a)
  list(APPEND ICU_LINK_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../third_party/icu4c/lib/${TARGET_PLATFORM_NAME}/libicutu.a)
Damons
  • 153
  • 1
  • 1
  • 7
-1

Aparently you missing icu-devtools package. Install that with command

sudo apt get install icu-devtools
  • This is not relevant. I am using ICU obtained via VCPKG. I am not using ICU libraries installed using apt get. Besides, even if I was using ICU libraries installed using apt get telling me to install icu-devtools does not provide any information relevant to hte odd linking error I am getting. The libraries are available and being linked to. Yet I am still getting an error. – Benilda Key Jun 15 '22 at 23:12