All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anssi Kolehmainen <anssi@aketzu.net>
To: linux-gpio@vger.kernel.org
Subject: [libgpiod] AC_FUNC_MALLOC cross-compile failure
Date: Tue, 5 Jan 2021 16:09:10 +0200	[thread overview]
Message-ID: <X/RzBqyV4hCdmrBy@kelvin.aketzu.net> (raw)

When libgpiod is cross-compiled it will use rpl_malloc instead malloc which then 
causes linking failure at later stage.

This happens because AC_FUNC_MALLOC wants to execute malloc() in a live system 
and thus cannot be run at cross-compilation time. libgpiod should just do 
AC_CHECK_FUNC instead.

diff --git a/configure.ac b/configure.ac
index ddb9dc2..5f41c4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ AC_DEFUN([HEADER_NOT_FOUND_CXX],
  
  # This is always checked (library needs this)
  AC_HEADER_STDC
-AC_FUNC_MALLOC
+AC_CHECK_FUNC([malloc], [], [FUNC_NOT_FOUND_LIB([malloc])])
  AC_CHECK_FUNC([ioctl], [], [FUNC_NOT_FOUND_LIB([ioctl])])
  AC_CHECK_FUNC([asprintf], [], [FUNC_NOT_FOUND_LIB([asprintf])])
  AC_CHECK_FUNC([scandir], [], [FUNC_NOT_FOUND_LIB([scandir])])

             reply	other threads:[~2021-01-05 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 14:09 Anssi Kolehmainen [this message]
2021-01-05 17:24 ` [libgpiod] AC_FUNC_MALLOC cross-compile failure Andy Shevchenko
2021-01-05 19:52   ` Anssi Kolehmainen
2021-01-06  7:19     ` Bartosz Golaszewski
2021-01-06  7:21 ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X/RzBqyV4hCdmrBy@kelvin.aketzu.net \
    --to=anssi@aketzu.net \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.