Skip to content

Use pkg_config method to set CFLAGS LDFLAGS correctly#4

Merged
tompng merged 1 commit intoruby:masterfrom
tompng:fix_extconf_pkgconfig
Jun 3, 2023
Merged

Use pkg_config method to set CFLAGS LDFLAGS correctly#4
tompng merged 1 commit intoruby:masterfrom
tompng:fix_extconf_pkgconfig

Conversation

@tompng
Copy link
Copy Markdown
Member

@tompng tompng commented Jun 1, 2023

In my new mac(M2), rake compile failed.

After changing extconf.rb like this, rake compile succeed.

+ $CFLAGS = "#{`pkg-config --cflags vterm`} -Werror".delete("\n")
+ $LDFLAGS = `pkg-config --libs vterm`
  create_makefile('vterm')
- $CFLAGS = "#{`pkg-config --cflags vterm`} -Werror"
- $LDFLAGS = `pkg-config --libs vterm`

These are the problems.

create_makefile('vterm')
# Setting global variable after creating makefile has no effect.
$CFLAGS = "#{`pkg-config --cflags vterm`} -Werror" # Output of pkg-config has trailing \n, need to remove it
$LDFLAGS = `pkg-config --libs vterm`

Fortunately, we don't have to set $CFLAGS, $LDFLAGS and other global variables manually. pkg_config('vterm') will do it.

Copy link
Copy Markdown
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes my installation problem 👍

@tompng tompng merged commit ab90c9c into ruby:master Jun 3, 2023
@tompng tompng deleted the fix_extconf_pkgconfig branch June 3, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants