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 'frexpl' #502

Closed
Klayflash opened this issue Sep 1, 2017 · 7 comments
Closed

undefined reference to 'frexpl' #502

Klayflash opened this issue Sep 1, 2017 · 7 comments
Assignees

Comments

@Klayflash
Copy link

Klayflash commented Sep 1, 2017

Description

I've switched from android-ndk-r15-windows-x86_64 to android-ndk-r16-beta1-windows-x86_64.
Linker error:
C:\lib\android\2\android-ndk-r16-beta1-windows-x86_64\android-ndk-r16-beta1\build\tools\stoolchain_x86\bin..\lib\gcc\i686-linux-android\4.9.x........\include\c++\4.9.x/math.h:902: error: undefined reference to 'frexpl'

Environment Details

Standalone toolchain was created by cmd file:

@echo off
set API_LEVEL=19
set STL=libc++
set COMMON_PARAMS=-v
set NDK_ROOT=%~dp0\..\..
set PYTHON=%NDK_ROOT%\prebuilt\windows-x86_64\bin\python.exe

"%PYTHON%" make_standalone_toolchain.py --arch x86 --api %API_LEVEL% --stl %STL% --install-dir stoolchain_x86 %COMMON_PARAMS%
if ERRORLEVEL 1 goto error

"%PYTHON%" make_standalone_toolchain.py --arch arm --api %API_LEVEL% --stl %STL% --install-dir stoolchain_arm %COMMON_PARAMS%
if ERRORLEVEL 1 goto error

:success
echo SUCCESS!!!
goto exit
:error
echo ERROR!!!
goto exit
:exit
pause

Linker flags:
-shared -Wl,-soname,symbols.so -Wl,--version-script=libcode.version -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--icf=safe -llog -lm -landroid -landroid_support -lEGL -lGLESv3 -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now OBJECTS_FILES_HERE C:\\lib\\android\\2\\android-ndk-r16-beta1-windows-x86_64\\android-ndk-r16-beta1\\build\\tools\\stoolchain_x86\\i686-linux-android\\lib\\libstdc++.a -o libmy.so

  • 16.0.4293906-beta1
  • standalone toolchain + custom build system
  • Host OS: Windows
  • Compiler: Clang
  • ABI: x86
  • STL:
  • NDK API level: 19
@Klayflash
Copy link
Author

By using
nm --demangle --defined-only --line-numbers %FROM% > TO.txt
I've found that file
android-ndk-r15-windows-x86_64\android-ndk-r15\build\tools\stoolchain_x86\i686-linux-android\lib\libandroid_support.a
contains frexpl and file
android-ndk-r16-beta1-windows-x86_64\android-ndk-r16-beta1\build\tools\stoolchain_x86\i686-linux-android\lib\libandroid_support.a
does not contain frexpl

@enh
Copy link
Contributor

enh commented Sep 7, 2017

yeah, looks like 8127c9619e2a497a58e6db62df9916e4c4864608 regressed this.

new in r16's libandroid_support.a:

+acos
+acosh
+asin
+asinh
+atan
+atan2
+atanh
+c32rtomb
+cbrt
+copysignl
+cos
+cosh
+erf
+erfc
+exp
+exp2
+expm1
+fmaxl
+fminl
+hypot
+ilogbl
+__ldexp_cexp
+__ldexp_exp
+ldexpl
+lgamma
+llroundl
+log
+log10
+log1p
+logb
+logf
+lroundl
+mbrtoc32
+nearbyint
+nearbyintf
+nextafter
+nextafterl
+posix_memalign
+remainder
+remquo
+rint
+roundl
+scalbn
+setlocale
+sin
+sinh
+sqrt
+tan
+tanh

removed in r16's libandroid_support.a:

-frexp
-frexpf
-frexpl
-imaxabs
-imaxdiv
-iswalnum
-iswalpha
-iswcntrl
-iswctype
-iswdigit
-iswgraph
-iswlower
-iswprint
-iswpunct
-iswspace
-iswupper
-iswxdigit
-log2f
-lrintl
-mblen
-mbrlen
-mbstowcs
-nan
-nanf
-nanl
-printf
-snprintf
-snprintf_l
-sprintf
-sprintf_l
-sscanf_l
-strtod
-strtold_l
-strtol_l
-strtoll_l
-strtoul_l
-strtoull_l
-towctrans
-towlower
-towupper
-vasprintf_l
-vfprintf
-vfwprintf
-vprintf
-vsnprintf
-vsnprintf_l
-vsprintf
-vsprintf_l
-vsscanf_l
-vwprintf
-wcpcpy
-wcpncpy
-wcscasecmp
-wcslcat
-wcslcpy
-wcsncasecmp
-wcsncat
-wcsnlen
-wcstombs
-wcswidth
-wctob
-wctomb
-wctrans
-wctype
-wcwidth
-wprintf

ignoring the wchar_t and locale_t nonsense, and the removal of the alternative printf which is probably the most useful feature of the new libandroid_support, that's:

-frexp
-frexpf
-frexpl
-imaxabs
-imaxdiv
-log2f

these all seem to just have been an oversight. b04b1a2e39477518e963daaec34fffcb69852c04 claimed we don't need imaxabs/imaxdiv, but we still declare them in the support headers, so i'm not sure that's true.

-lrintl

this is missing from x86 because we have assembler implementations for x86 that come from a different source file than the arm stuff. not sure whether it makes more sense to just -DNDK_SUPPORT_LIBRARY and add an extra #if to the bionic source for this?

-nan
-nanf
-nanl

these were probably dropped on purpose because they're all before 14, which is the current minimum supported API level.

@enh
Copy link
Contributor

enh commented Sep 8, 2017

suggested fix: https://android-review.googlesource.com/479202

hubot pushed a commit to aosp-mirror/platform_bionic that referenced this issue Sep 8, 2017
Because I want something to copy & paste into the NDK support library test
that's slightly better than taking the address of the function...

Bug: android/ndk#502
Test: ran tests
Change-Id: If43089d16691d6a4dcf5d972450b14ed85bbca81
@chri7325
Copy link

👍 I'm also seeing linker errors on r16 beta from math when targeting platform 16

android-16_arm/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/math.h:1302: error: undefined reference to 'log2f'

@enh
Copy link
Contributor

enh commented Sep 18, 2017

yeah, log2f was accidentally dropped from libandroid_support.a, which had previously been papering over that crack (log2f wasn't in API 16): https://android-review.googlesource.com/#/c/platform/ndk/+/479202/

@edkimmel
Copy link

edkimmel commented Oct 3, 2017

Dan, I'm still seeing this problem with the ndk 16 beta. Are there steps I should take on my end, or just wait for a future r16 version?

sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/math.h
Error:(1302) undefined reference to 'log2f'

@enh
Copy link
Contributor

enh commented Oct 3, 2017

you could try a nightly build until r16beta2: https://android.googlesource.com/platform/ndk/+/master/docs/ContinuousBuilds.md

miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
frexp/frexpf/frexpl were reported, but imaxabs/imaxdiv were missing too,
as was log2f. The nan/nanf/nanl family are also missing, but since they're
all available in API level 14 that seems fine.

lrintl for x86 remains unresolved by this change.

Bug: android/ndk#502
Test: built new tests
Change-Id: Id7a9a249e4c7a998fc0570902331d9123bcda7bd
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
Because I want something to copy & paste into the NDK support library test
that's slightly better than taking the address of the function...

Bug: android/ndk#502
Test: ran tests
Change-Id: If43089d16691d6a4dcf5d972450b14ed85bbca81
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
Because I want something to copy & paste into the NDK support library test
that's slightly better than taking the address of the function...

Bug: android/ndk#502
Test: ran tests
Change-Id: If43089d16691d6a4dcf5d972450b14ed85bbca81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants