3

I' ve tried to cross compile a simple C curl demo for RPI CM4. This is my C demo code:

#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    /* example.com is redirected, so we tell libcurl to follow redirection */
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

    /* 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);
  }
  return 0;
}

I' m using Eclipse Platform on OS Ubuntu 14.04.5 LTS.... and as compiler I ve used: arm-linux-gnueabi-gcc

On build console I ve got those errors:

Building target: DemoCurl1
Invoking: GCC C Linker
arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -o "DemoCurl1"  ./src/DemoCurl1.o   -lpthread -lcurl
/usr/arm-linux-gnueabi/lib/libcurl.so: undefined reference to `fcntl64@GLIBC_2.28'
/usr/arm-linux-gnueabi/lib/libgssapi_krb5.so.2: undefined reference to `glob@GLIBC_2.27'
/usr/arm-linux-gnueabi/lib/libkrb5.so.3: undefined reference to `fcntl@GLIBC_2.28'
/usr/arm-linux-gnueabi/lib/libgnutls.so.30: undefined reference to `getrandom@GLIBC_2.25'
/usr/arm-linux-gnueabi/lib/libp11-kit.so.0: undefined reference to `reallocarray@GLIBC_2.26'
/usr/arm-linux-gnueabi/lib/libgnutls.so.30: undefined reference to `__explicit_bzero_chk@GLIBC_2.25'
/usr/arm-linux-gnueabi/lib/libgnutls.so.30: undefined reference to `fmemopen@GLIBC_2.22'
collect2: error: ld returned 1 exit status
make: *** [DemoCurl1] Error 1

Do you have any suggestions on how to solve that?

My GLIBC version is:

ldd --version : 2.19

Should I make an GLIBC update on Ubuntu OS?

All shared library files (.so) I ve got from my RPI CM 4

root@rpi-cm4:/home/pi# uname -a
Linux rpi-cm4 5.15.65-v7l+ #1582 SMP Mon Sep 5 15:34:37 BST 2022 armv7l GNU/Linux

From follow path:

root@rpi-cm4:/usr/lib/arm-linux-gnueabihf# find / -name "libgssapi_krb5.so.2"
/usr/lib/arm-linux-gnueabihf/libgssapi_krb5.so.2
User
  • 67
  • 1
  • 1
  • 8

1 Answers1

0

I had similar error with 'glibc', but it was for 'MySQL Connector/C++' API. I installed 'glibc' version 2.28, I compiled with the new 'glibc' directory and it helped in my case.