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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build script cannot find homebrew installed gmp and mpfr on mac #1844

Open
VisenDev opened this issue Jan 2, 2025 · 4 comments
Open

build script cannot find homebrew installed gmp and mpfr on mac #1844

VisenDev opened this issue Jan 2, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@VisenDev
Copy link

VisenDev commented Jan 2, 2025

System info

Robert@Roberts-MBP-2 ~/n/arturo (master)> fastfetch
                     ..'          Robert@Roberts-MBP-2
                 ,xNMM.           --------------------
               .OMMMMo            OS: macOS Ventura 13.2 x86_64
               lMM"               Host: MacBook Pro (15-inch, 2018/2019)
     .;loddo:.  .olloddol;.       Kernel: Darwin 22.3.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:     Uptime: 9 days, 4 hours, 43 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.     Packages: 454 (brew), 38 (brew-cask), 226 (macports)
 XMMMMMMMMMMMMMMMMMMMMMMMX.       Shell: fish 3.7.1
;MMMMMMMMMMMMMMMMMMMMMMMM:        Display (Color LCD): 3360x2100 @ 60 Hz (as 1680x1050) in 15" [Built-in]
:MMMMMMMMMMMMMMMMMMMMMMMM:        DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.       WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.     WM Theme: Multicolor (Dark)
 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk    Font: .AppleSystemUIFont [System], Helvetica [User]
  'XMMMMMMMMMMMMMMMMMMMMMMMMK.    Cursor: Fill - Black, Outline - White (32px)
    kMMMMMMMMMMMMMMMMMMMMMMd      Terminal: tmux 3.5a
     ;KMMMMMMMWXXWMMMMMMMk.       CPU: Intel(R) Core(TM) i7-9750H (12) @ 2.60 GHz
       "cooc*"    "*coo'"         GPU 1: AMD Radeon Pro 555X [Integrated]
                                  GPU 2: Intel UHD Graphics 630 [Integrated]
                                  Memory: 14.49 GiB / 16.00 GiB (91%)
                                  Swap: 6.08 GiB / 7.00 GiB (87%)
                                  Disk (/): 397.81 GiB / 465.63 GiB (85%) - apfs [Read-only]
                                  Local IP (en0): 192.168.1.152/24
                                  Battery (bq20z451): 64% (3 hours, 8 mins remaining) [Discharging]
                                  Locale: en_US.UTF-8


Robert@Roberts-MBP-2 ~/n/arturo (master)> ./build.nims --log
Hint: used config file '/usr/local/Cellar/nim/2.2.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/usr/local/Cellar/nim/2.2.0/nim/config/config.nims' [Conf]
Hint: used config file '/Users/Robert/nim/arturo/config.nims' [Conf]
================================================================================

                               _
                              | |
                     __ _ _ __| |_ _   _ _ __ ___
                    / _` | '__| __| | | | '__/ _ \
                   | (_| | |  | |_| |_| | | | (_) |
                    \__,_|_|   \__|\__,_|_|  \___/

                     Arturo Programming Language
                      (c)2025 Yanis Zafirópulos

================================================================================
 ► INSTALL
================================================================================

--------------------------------------------------------------------------------
 ● Checking environment...
--------------------------------------------------------------------------------
  os: macosx
  compiler: Nim v2.2.0

--------------------------------------------------------------------------------
 ● Building...
--------------------------------------------------------------------------------
  version: 0.9.84-alpha/3334
  config: @full
  flags: --define:GMP --define:ssl

Hint: used config file '/usr/local/Cellar/nim/2.2.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/usr/local/Cellar/nim/2.2.0/nim/config/config.nims' [Conf]
Hint: used config file '/Users/Robert/nim/arturo/config.nims' [Conf]
............................................................................................................................................................................................................................................................................................................................
CC: static
CC: linenoise
CC: stringbuf
CC: utf8
CC: libminiz
CC: md4c
CC: md4c-html
CC: entity
CC: window
CC: webview-unix
CC: menubar
CC: clipboard_common
CC: clipboard_cocoa
CC: pfd
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/system/exceptions.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/std/private/digitsutils.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/std/assertions.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/system/iterators.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/std/formatfloat.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/std/objectdollar.nim
CC: ../../../../../usr/local/Cellar/nim/2.2.0/nim/lib/system/dollars.nim
/Users/Robert/nim/arturo/.cache/@m..@s..@s..@s..@s..@susr@slocal@sCellar@[email protected]@snim@slib@[email protected]:8:10: fatal error: 'gmp.h' file not found
    8 | #include <gmp.h>
      |          ^~~~~~~
1 error generated.
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/Robert/nim/arturo/src/extras/mimalloc/include" -I/Users/Robert/nim/arturo/src/extras -DWEBVIEW_COCOA=1 -DWEBVIEW_STATIC=1 -O3   -I/usr/local/Cellar/nim/2.2.0/nim/lib -I/Users/Robert/nim/arturo/src/extras -I/Users/Robert/nim/arturo/src/extras -I/Users/Robert/nim/arturo/src -o /Users/Robert/nim/arturo/.cache/@m..@s..@s..@s..@s..@susr@slocal@sCellar@[email protected]@snim@slib@[email protected] /Users/Robert/nim/arturo/.cache/@m..@s..@s..@s..@s..@susr@slocal@sCellar@[email protected]@snim@slib@[email protected]' failed with exit code: 1


stack trace: (most recent call last)
cli.nims(210, 24)
build.nims(543, 11)      buildTask
build.nims(327, 9)       buildArturo
build.nims(319, 15)      main
build.nims(306, 28)      tryCompilation
build.nims(219, 12)      compile
nimscript.nim(264, 7)    exec
/usr/local/Cellar/nim/2.2.0/nim/lib/system/nimscript.nim(264, 7) Error: unhandled exception: FAILED: nim c --define:GMP --define:ssl -o:bin/arturo src/arturo.nim [OSError]
Robert@Roberts-MBP-2 ~/n/arturo (master) [1]>

In order to successfully compile I had to add these lines to the compile() procedure in build.nims

    --passC:"-I/usr/local/Cellar/gmp/6.3.0/include"
    --passC:"-I/usr/local/Cellar/mpfr/4.2.1/include"
    --passL:"-L/usr/local/Cellar/gmp/6.3.0/lib"
    --passL:"-L/usr/local/Cellar/mpfr/4.2.1/lib"

The flags are just the output of pkg-config --libs --cflags for the two libraries. The build script should probably be modified so it uses pkg-config by default to find these (I would send a pr but I'm not familiar enough with nim to know how to do that)

@VisenDev VisenDev added the bug Something isn't working label Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

Thank you for submitting an issue! :)

@VisenDev VisenDev changed the title build script cannot find homebrew install gmp and mpfr on mac build script cannot find homebrew installed gmp and mpfr on mac Jan 2, 2025
@drkameleon
Copy link
Collaborator

@VisenDev First of all, welcome to our community! 🚀

The issue above looks a bit weird... I'm a Mac user myself (so all the compilation is done on macOS normally - M1 and Intel) but I haven't had any problem like this before.

Let me have a look! 😉

@VisenDev
Copy link
Author

VisenDev commented Jan 3, 2025

The issue above looks a bit weird... I'm a Mac user myself (so all the compilation is done on macOS normally - M1 and Intel) but I haven't had any problem like this before.

Thanks, my guess would be that those libraries are installed in a such a way on your machine so that clang searches for them by default. (Or my homebrew install is just weird and it didn't add those paths to the compiler search paths)

@drkameleon
Copy link
Collaborator

The issue above looks a bit weird... I'm a Mac user myself (so all the compilation is done on macOS normally - M1 and Intel) but I haven't had any problem like this before.

Thanks, my guess would be that those libraries are installed in a such a way on your machine so that clang searches for them by default. (Or my homebrew install is just weird and it didn't add those paths to the compiler search paths)

That's very weird...

Apparently, I have the exact same Nim version as you, with HomeBrew having installed the exact same GMP/MPFR version (the paths are identical). For some reason, the header/library path is set correctly here but not for you... 🤔

I'll keep investigating. Thanks for bringing it up, needless to say! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants