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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDK libcurl.a - undefined reference to 'Curl_xxx' #29

Closed
InfiniteStates opened this issue Nov 15, 2016 · 9 comments
Closed

NDK libcurl.a - undefined reference to 'Curl_xxx' #29

InfiniteStates opened this issue Nov 15, 2016 · 9 comments

Comments

@InfiniteStates
Copy link

I'm trying to link against the pre-built static libraries for both iOS and Android.

The iOS side is working well (thanks 馃憤 ) but the Android side is failing no matter what I do.

(Note - the Android sample app in the repo also fails the build with the same errors)

libcurl.a(url.o):function Curl_disconnect: error: undefined reference to 'Curl_http_ntlm_cleanup' libcurl.a(http.o):function output_auth_headers: error: undefined reference to 'Curl_output_ntlm' libcurl.a(http.o):function Curl_http_input_auth: error: undefined reference to 'Curl_auth_is_ntlm_supported' libcurl.a(http.o):function Curl_http_input_auth: error: undefined reference to 'Curl_input_ntlm' libcurl.a(http.o):function Curl_http_input_auth: error: undefined reference to 'Curl_auth_is_digest_supported' libcurl.a(http_digest.o):function Curl_input_digest: error: undefined reference to 'Curl_auth_decode_digest_http_message' libcurl.a(http_digest.o):function Curl_output_digest: error: undefined reference to 'Curl_auth_create_digest_http_message' libcurl.a(http_digest.o):function Curl_digest_cleanup: error: undefined reference to 'Curl_auth_digest_cleanup' libcurl.a(http_digest.o):function Curl_digest_cleanup: error: undefined reference to 'Curl_auth_digest_cleanup' libcurl.a(curl_sasl.o):function Curl_sasl_cleanup: error: undefined reference to 'Curl_auth_ntlm_cleanup' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_is_digest_supported' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_is_ntlm_supported' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_ntlm_type1_message' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_external_message' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_oauth_bearer_message' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_oauth_bearer_message' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_plain_message' libcurl.a(curl_sasl.o):function Curl_sasl_start: error: undefined reference to 'Curl_auth_create_login_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_plain_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_login_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_login_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_external_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_decode_cram_md5_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_cram_md5_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_digest_md5_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_ntlm_type1_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_decode_ntlm_type2_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_ntlm_type3_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_oauth_bearer_message' libcurl.a(curl_sasl.o):function Curl_sasl_continue: error: undefined reference to 'Curl_auth_create_oauth_bearer_message'

Is there an additional library I need to be linking against?

I'm using Android Studio 2.2.1 and have tried building against NDKs r10e and r13...

@jsuppe
Copy link

jsuppe commented Nov 15, 2016

I am having the same issue, using ndk-r10e

@YjyJeff
Copy link

YjyJeff commented Nov 16, 2016

I am having the same issue when I execute the android test, the ndk version is 13.0.3315539 , and the android studio version is 2.2.
I tried to use this lib in Cmake, here is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1) add_library( native-lib SHARED src/main/cpp/native-lib.cpp ) find_library( log-lib log ) include_directories(/home/yjy/tools/curl-android-ios/curl/include/) target_link_libraries( native-lib ${log-lib} /home/yjy/tools/curl-android-ios/prebuilt-with-ssl/android/mips64/libcurl.a)
However, I got the same issues.
How can I solve it ? Thanks in advance !

@MarcelKlammer
Copy link

Same here. No luck whatever I try.

@MarcelKlammer
Copy link

The changes in the pull request helped with this problem.

@InfiniteStates
Copy link
Author

Did you manage to link against the library successfully then?

@MarcelKlammer
Copy link

I applied the provided patch (only 4 lines to change) to the curl.mk file.

My goal was to create library that uses curl internally.

So before building my lib I put (only need x86 and armeabi-v7a for my Adobe AIR native extension):

###############################

#libcurl.a

include $(CLEAR_VARS)

LOCAL_MODULE := curl_static

ifeq ($(TARGET_ARCH_ABI), $(filter $(TARGET_ARCH_ABI), x86))
LOCAL_SRC_FILES := path/to/curl-android-ios/prebuilt-with-ssl/android/x86/libcurl.a
endif

ifeq ($(TARGET_ARCH_ABI), $(filter $(TARGET_ARCH_ABI), armeabi-v7a))
LOCAL_SRC_FILES := path/to/curl-android-ios/prebuilt-with-ssl/android/armeabi-v7a/libcurl.a
endif

ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_SRC_FILES := path/to/curl-android-ios/prebuilt-with-ssl/android/armeabi/libcurl.a
endif

LOCAL_EXPORT_C_INCLUDES := path/to/curl-android-ios/prebuilt-with-ssl/android/include
LOCAL_C_INCLUDES := path/to/curl-android-ios/prebuilt-with-ssl/android/include

include $(PREBUILT_STATIC_LIBRARY)

###############################

Then for my lib I set:

LOCAL_STATIC_LIBRARIES := curl_static

Cheers
Marcel

@jsuppe
Copy link

jsuppe commented Nov 16, 2016

I was able to apply the changes from pull request #27 and was able to compile and then link libcurl.a to my project for armeabi-v7a and arm64-v8a successfully.

For my purposes I had used android-ndk-r10e and had changed the TARGET variable in the script to use android-21.

@InfiniteStates
Copy link
Author

Awesome, thanks guys - yep, until PR 27 gets merged in, this will get you up and running again on the Android side :)

git pull origin pull/27/head

@winster
Copy link

winster commented Feb 6, 2017

Great! Pull 27 worked! Wondering why is it not merged to master!!

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