Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to 'iconv_open' #702

Closed
xclaesse opened this issue May 19, 2018 · 10 comments
Closed

undefined reference to 'iconv_open' #702

xclaesse opened this issue May 19, 2018 · 10 comments
Assignees
Milestone

Comments

@xclaesse
Copy link

xclaesse commented May 19, 2018

Android NDK r17 has iconv.h that declares iconv_open() if __ANDROID_API__ >= 28, but when I use that symbol it fails to link. If I add -liconv the linker cannot find that library. I think they should be defined in libc, right?

grep iconv_open ./platforms/android-28/arch-arm64/usr/lib/libc.so gives nothing
grep iconv_open ./platforms/android-28/arch-arm64/usr/lib/libc.a match

@DanAlbert DanAlbert self-assigned this May 21, 2018
@DanAlbert DanAlbert added this to the r17b milestone May 21, 2018
@DanAlbert
Copy link
Member

It looks like there's something that got broken in the branch we've been taking P API blobs from. Could be as simple as a bad merge. AOSP master is generating the right things.

@DanAlbert
Copy link
Member

Scratch that, the P branch is actually fine. It wasn't when we pulled the prebuilts for r17, but is now. Will update for r17b.

@DanAlbert
Copy link
Member

@epicstar
Copy link

Interesting... Does this mean that iconv is available in devices starting API 28?

@enh
Copy link
Contributor

enh commented May 22, 2018

yes: https://android-review.googlesource.com/c/platform/bionic/+/464455

@xclaesse
Copy link
Author

I tried with r17b and it works. Thanks.

@JaeHoLee1811

This comment has been minimized.

mehulagg pushed a commit to mehulagg/superproject that referenced this issue Dec 21, 2019
* Update ndk from branch 'master'
  to 3a21fd712122f16879ce937f0041c7b34a966c17
  - Merge "Test emutls pthread key deletion"
  - Test emutls pthread key deletion
    
    The key should be deleted when an solib is dlclose'd, but __thread
    variables should continue working during cleanup functions.
    
    Bug: b/80453944
    Test: manual
    Change-Id: Ie5719f6228911d4e9f8f58b86f994765a713691f
    

* Update prebuilts/ndk from branch 'dev'
  to f0908f8e2856919868742937450d197b08d37073
  - Merge "Update prebuilt GCC to build 4886780." into dev
  - Update prebuilt GCC to build 4886780.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: android/ndk#505
    Bug: http://b/80453944
    Change-Id: I1bd7fe862704a10f24806de23bc67ec3f15e4cb4
    
  - Merge "Update prebuilt GCC to build 4856068." into dev
  - Update prebuilt GCC to build 4856068.
    
    Update libgcc.a with a change to defer per-thread emutls cleanup by one
    round.
    
    Bug: android/ndk#687
    Bug: b/78022094
    Test: ./checkbuild.py && ./run_tests.py --filter=emutls-dealloc
    Change-Id: I413b4bd926472bb50865d4b91431302f803a49e6
    
  - Merge "Update NDK platform prebuilts to build 4828202." into dev
  - Update NDK platform prebuilts to build 4828202.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: Ib963ec9d8afe1ff84dc9586eb774aad6c9d1236b
    
  - Merge "Update NDK platform prebuilts to build 4811751." into dev
  - Update NDK platform prebuilts to build 4811751.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: If2aaaf6fe05ea63c8e340908f8f00d218219ddfb
    
  - Merge "Update NDK platform prebuilts to build 4794421." into dev
  - Update NDK platform prebuilts to build 4794421.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: android/ndk#702
    Change-Id: I84362b1b3f1bec6236866cdae617a811abfd5f52
    
  - Merge "Update prebuilt Clang to build r328903." into dev
  - Merge "Adapt to the new Clang naming scheme." into dev
  - Adapt to the new Clang naming scheme.
    
    Clang prebuilts are now named as clang-r${REVISION}${PATCH} rather
    than as clang-${BUILD_NUMBER}.
    
    Test: ./symlink-clang.py
    Bug: None
    Change-Id: I758feecb05ad568560333f63d3e0e9cdc25f9bcd
    
  - Update prebuilt Clang to build r328903.
    
    Change-Id: I07c5832446733f09aa48ff8a0c13d89516e69370
    
  - Merge "Update NDK platform prebuilts to build 4753280." into dev
  - Update NDK platform prebuilts to build 4753280.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: Ic062d17cf3a7de3c82ea1d9a875c6cb3dc141b23
    
  - Merge "Update prebuilt binutils to build 4724899." into dev
  - Merge "Don't fetch the repo.prop for platform prebuilts." into dev
  - Don't fetch the repo.prop for platform prebuilts.
    
    Not necessary.
    
    Test: ./update_platform.py ...
    Bug: None
    Change-Id: I079c65caedaf5c1a3f270af721133051aee00c0b
    
  - Update prebuilt binutils to build 4724899.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: I951f53a8bfc258eb4501df8d84e255bd1e1cc1f1
    
  - Merge "Update prebuilt Clang to build 4691093." into dev
  - Update prebuilt Clang to build 4691093.
    
    Change-Id: Ibe8c95936a0bbb46a172f8efcd4a00386dfa5e8c
    
  - Merge "Update Validation layer binaries" into dev
  - Merge "Update prebuilt Clang to build 4639204." into dev
  - Update Validation layer binaries
    
    Build: 4634174
    
    https://android-build.googleplex.com/builds/branch-dashboard/aosp-master-ndk-vulkan-validation-layers?build_id=4634174
    
    Change-Id: I55d4ca67aa390d288c6c0f04bbafb21dee31aab8
    
  - Merge "Update NDK platform prebuilts to build 4634113." into dev
  - Update prebuilt Clang to build 4639204.
    
    Change-Id: I456b400bc534de579078665a48ae5235869fb3f3
    
  - Update NDK platform prebuilts to build 4634113.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: I9e7aa333073c61ba2724a6cd39f7b7e30ff2fef6
    
  - Merge "Update prebuilt Clang to build 4630689." into dev
  - Merge "Update NDK platform prebuilts to build 4634436." into dev
  - Update NDK platform prebuilts to build 4634436.
    
    Test: ndk/checkbuild.py && ndk/run_tests.py
    Bug: None
    Change-Id: Idd13dfe5dc9b928b81b48a0e72dc8ae669739275
    
  - Update prebuilt Clang to build 4630689.
    
    Change-Id: I852722d2bdfb4aeaa42fe943677d7adbf679d61b
msatranjr pushed a commit to msft-mirror-aosp/platform.prebuilts.ndk that referenced this issue Aug 27, 2022
Test: ndk/checkbuild.py && ndk/run_tests.py
Bug: android/ndk#702
Change-Id: I84362b1b3f1bec6236866cdae617a811abfd5f52
(cherry picked from commit ca3d771)
@anusha-bylla
Copy link

Facing android build issue:

11:08:02: Initializing deployment to Android device/simulator
11:08:02: Deploying to
11:08:02: Running steps for project QGroundControl...
11:08:02: Starting: "C:\Program Files\CMake\bin\cmake.exe" --build "D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug" --target all
[1/1010 2.7/sec] Building CXX object src/Comms/AirLink/CMakeFiles/AirLink.dir/AirLink_autogen/mocs_compilation.cpp.o
[2/1010 4.9/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/GPSDrivers_autogen/mocs_compilation.cpp.o
[3/1010 6.7/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir///_deps/px4-gpsdrivers-src/src/crc.cpp.o
[4/1010 7.6/sec] Building CXX object src/Utilities/Compression/CMakeFiles/xz.dir/xz_autogen/mocs_compilation.cpp.o
[5/1010 8.9/sec] Automatic MOC and UIC for target exiv2lib
[6/1009 9.8/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir///_deps/px4-gpsdrivers-src/src/rtcm.cpp.o
[7/1009 9.1/sec] Building C object src/Utilities/Compression/CMakeFiles/xz.dir////_deps/xz-embedded-src/linux/lib/xz/xz_crc32.c.o
[8/1009 9.8/sec] Building C object src/Utilities/Compression/CMakeFiles/xz.dir/
///_deps/xz-embedded-src/linux/lib/xz/xz_crc64.c.o
[9/1009 10.4/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir///_deps/px4-gpsdrivers-src/src/unicore.cpp.o
[10/1009 10.9/sec] Building C object src/Utilities/Compression/CMakeFiles/xz.dir////_deps/xz-embedded-src/linux/lib/xz/xz_dec_lzma2.c.o
[11/1009 4.1/sec] Building CXX object deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/convert.cpp.o
FAILED: deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/convert.cpp.o
D:\SDK\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android23 --sysroot=D:/SDK/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DDAILY_BUILD -DQGC_APP_NAME="QGroundControl" -DQGC_APP_VERSION_STR="latest-111-g99a7c6fcb" -DQGC_ORG_DOMAIN="org.qgroundcontrol" -DQGC_ORG_NAME="QGroundControl.org" -DQGC_VIEWER3D -DQT_DISABLE_DEPRECATED_UP_TO=0x060600 -DUNITTEST_BUILD -D__mobile
-I"D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-build/src/exiv2lib_autogen/include" -I"D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug" -I"D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-build/src" -I"D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-src/include/exiv2" -I"D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-src/include" -isystem "D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-src/xmpsdk/include" -DQT_QML_DEBUG -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -g3 -gstrict-dwarf -O0 -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fansi-escape-codes -fcolor-diagnostics -fstack-clash-protection -fcf-protection -fstack-protector-strong -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -Wno-error=format-nonliteral -MD -MT _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/convert.cpp.o -MF _deps\exiv2-build\src\CMakeFiles\exiv2lib.dir\convert.cpp.o.d -o _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/convert.cpp.o -c "D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-src/src/convert.cpp"
D:/qgc android/qgroundcontrol/build/Android_Qt_6_6_3_Clang_x86_64-Debug/_deps/exiv2-src/src/convert.cpp:1417:13: error: use of undeclared identifier 'iconv_open'
auto cd = iconv_open(to, from);
^
1 error generated.
[12/1009 4.5/sec] Building CXX object _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/futils.cpp.o
[13/1009 4.8/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/gps_helper.cpp.o
[14/1009 5.1/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/emlid_reach.cpp.o
[15/1009 5.4/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/ashtech.cpp.o
[16/1009 5.6/sec] Building CXX object _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/gifimage.cpp.o
[17/1009 5.9/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/femtomes.cpp.o
[18/1009 6.2/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/mtk.cpp.o
[19/1009 6.5/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/nmea.cpp.o
[20/1009 6.8/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
//_deps/px4-gpsdrivers-src/src/sbf.cpp.o
[21/1009 6.9/sec] Building CXX object src/GPS/CMakeFiles/GPSDrivers.dir/
/__/_deps/px4-gpsdrivers-src/src/ubx.cpp.o
[22/1009 7.2/sec] Building CXX object _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/iptc.cpp.o
[23/1009 7.0/sec] Building CXX object _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/image.cpp.o
[24/1009 7.0/sec] Building CXX object _deps/exiv2-build/src/CMakeFiles/exiv2lib.dir/exif.cpp.o
ninja: build stopped: subcommand failed.
11:08:06: The process "C:\Program Files\CMake\bin\cmake.exe" exited with code 1.
11:08:06: Error while building/deploying project QGroundControl (kit: Android Qt 6.6.3 Clang x86_64)
11:08:06: When executing step "Build"
11:08:06: Elapsed time: 00:04.

Screenshot (1)
Screenshot (2)
Screenshot (3)
Screenshot (4)
Screenshot (5)

@anusha-bylla
Copy link

How to figure out this issue

@enh-google
Copy link
Collaborator

enh-google commented Dec 6, 2024

iconv_open() wasn't added to Android until API level 28...

iconv_t _Nonnull iconv_open(const char* _Nonnull __dst_encoding, const char* _Nonnull __src_encoding) \
    __INTRODUCED_IN(28);

...but you're building for API level 23.

@android android locked as resolved and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants