Project

General

Profile

Actions

Bug #20494

closed

Non-default directories are not searched when checking for a gmp header

Added by lish82 (Hiroki Katagiri) 6 months ago. Updated 5 months ago.

Status:
Closed
Target version:
-
[ruby-core:117918]

Description

This is my very first issue submission
I would be happy to know if I missed anything


I found that the ruby installed with ruby-build is not linked to the gmp library

Environment:

  • OS: macOS Sonoma 14.5
  • Directory that gmp is installed: /opt/homebrew (= installed via homebrew)

I believe it was able to link to gmp before, so I tried to investigate the cause of the problem
As a result, I found the followings:

  • During the execution of ./configure, checking for gmp.h... is showing no
  • Specifying --with-gmp-dir=/opt/homebrew does not work
  • It has been occurring since 3.2.3
  • When I built it on linux, it was successfully linked to gmp
    • gmp was installed in the default directory (/usr/include)
  • Revert the following changes and the problem goes away

Based on these observations, I believe the issue is that the directories specified with --with-opt-dir or --with-gmp-dir are not being included in the search path when checking for the gmp header

I was able to solve the problem by changing the build process as follows

diff --git a/configure.ac b/configure.ac
index 18b4247..a440de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1363,7 +1363,11 @@ AS_CASE("$target_cpu", [x64|x86_64|i[3-6]86*], [
 RUBY_UNIVERSAL_CHECK_HEADER([x86_64, i386], x86intrin.h)
 
 AS_IF([test "x$with_gmp" != xno],
-  [AC_CHECK_HEADERS(gmp.h)
+  [original_CPPFLAGS="${CPPFLAGS}"
+   CPPFLAGS="${INCFLAGS} ${CPPFLAGS}"
+   AC_CHECK_HEADERS(gmp.h)
+   CPPFLAGS="${original_CPPFLAGS}"
+   unset original_CPPFLAGS
    AS_IF([test "x$ac_cv_header_gmp_h" != xno],
      AC_SEARCH_LIBS([__gmpz_init], [gmp],
        [AC_DEFINE(HAVE_LIBGMP, 1)]))])

However, I am not familiar with ruby's build process or autotools, so I'm not sure if this is the correct approach


I would appreciate it if someone could consider resolving this issue


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20515: --with-gmp is not working - GMP support won't be builtClosedsorah (Sorah Fukumori)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like1Like0Like0Like1Like0Like0Like0Like0Like0Like1Like0