Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. cURL error in Qt for iOS Platform
QtWS25 Last Chance

cURL error in Qt for iOS Platform

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
4 Posts 2 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sh.lord
    wrote on last edited by
    #1

    Hi guys,
    I want to use cURL for iOS platform but I have problem with compiling this library, of course I have no any problem with macOS Desktop, problem is just for iOS platform. and I have no problem with xCode! this is my problem just in Qt Creator, So I think that maybe I have mistake in my configuration .pro or suitable config for Qt.

    So according to this flags :

    ARCHS=(armv7 armv7s arm64 i386 x86_64)
    HOSTS=(armv7 armv7s arm i386 x86_64)
    PLATFORMS=(iPhoneOS iPhoneOS iPhoneOS iPhoneSimulator iPhoneSimulator)
    

    I compiled both i386 and armv7 with below configs:

    ./configure --with-darwinssl --disable-shared --enable-static --disable-dependency-tracking --host=i386-apple-darwin --target=i386-apple-darwin
    

    and

    ./configure --with-darwinssl --disable-shared --enable-static --disable-dependency-tracking --host=armv7-apple-darwin --target=armv7-apple-darwin
    

    This is my error that I got in compile time for i386

    ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
    Undefined symbols for architecture x86_64:
      "_curl_easy_init", referenced from:
          _main in main.o
      "_curl_easy_setopt", referenced from:
          _main in main.o
      "_curl_easy_perform", referenced from:
          _main in main.o
      "_curl_easy_strerror", referenced from:
          _main in main.o
      "_curl_easy_cleanup", referenced from:
          _main in main.o
      "_curl_global_init", referenced from:
          _main in main.o
      "_curl_global_cleanup", referenced from:
          _main in main.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ** BUILD FAILED **
    
    The following build commands failed:
    	Ld Debug-iphonesimulator/untitled2.app/untitled2 normal x86_64
    (1 failure)
    make: *** [xcodebuild-debug-simulator] Error 65
    
    21:02:35: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project untitled2 (kit: iphonesimulator-clang Qt 5.8.0 (ios))
    When executing step "Make"
    21:02:35: Elapsed time: 00:11.
    

    and this error is for Real Device

    ** BUILD FAILED **
    
    
    The following build commands failed:
    	CompileC untitled2.build/Debug-iphoneos/untitled2.build/Objects-normal/armv7/test.o /Users/Gamer/Documents/Projects/untitled2/test.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    	CompileC untitled2.build/Debug-iphoneos/untitled2.build/Objects-normal/armv7/main.o /Users/Gamer/Documents/Projects/untitled2/main.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    (2 failures)
    make: *** [xcodebuild-debug-device] Error 65
    21:13:53: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project untitled2 (kit: iphoneos-clang Qt 5.8.0 (ios))
    When executing step "Make"
    21:13:53: Elapsed time: 00:10.
    

    This is my main.cpp code for example :

    #include <stdio.h>
    #include <curl/curl.h>
    
    int main(void)
    {
      CURL *curl;
      CURLcode res;
    
      /* In windows, this will init the winsock stuff */
      curl_global_init(CURL_GLOBAL_ALL);
    
      /* get a curl handle */
      curl = curl_easy_init();
      if(curl) {
        /* First set the URL that is about to receive our POST. This URL can
           just as well be a https:// URL if that is what should receive the
           data. */
        curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi");
        /* Now specify the POST data */
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
    
        /* Perform the request, res will get the return code */
        res = curl_easy_perform(curl);
        /* Check for errors */
        if(res != CURLE_OK)
          fprintf(stderr, "curl_easy_perform() failed: %s\n",
                  curl_easy_strerror(res));
    
        /* always cleanup */
        curl_easy_cleanup(curl);
      }
      curl_global_cleanup();
      return 0;
    }
    
    

    and this is my ,pro setting :

    TEMPLATE = app
    SOURCES += main.cpp \
        test.cpp
    CONFIG += c++14
    DEFINES += UNTITLED2_LIBRARY
    CONFIG += debug
    
    
    macx: LIBS += -L$$PWD/libs/ -lcurl
    
    INCLUDEPATH += $$PWD/include
    DEPENDPATH += $$PWD/include
    
    macx: PRE_TARGETDEPS += $$PWD/libs/libcurl.a
    
    HEADERS += \
        test.h
    
    

    Please help me, How I can use libcurl in Qt for iOS platform.
    Thanks for your answer :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From what you posted and AFAIK, you are missing both 64bit architectures in your libcurl build. You should build one archive which contains all 4.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        From what you posted and AFAIK, you are missing both 64bit architectures in your libcurl build. You should build one archive which contains all 4.

        Hope it helps

        S Offline
        S Offline
        sh.lord
        wrote on last edited by
        #3

        @SGaist Hi again.
        Yes, you are right, I have missed lib ssl and lib http2 64 version inside libcurl. problem has been solved :) Thank you @SGaist

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Since you have it working now please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved