-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
[fbthrift] Add new port #13072
[fbthrift] Add new port #13072
Conversation
Hello, how can i upgrade system package On osx, system default
|
Azure-pipelines use brew to install bison, but brew don't symlink it into vcpkg/scripts/azure-pipelines/osx/configuration/VagrantFile Lines 17 to 21 in 299f581
$ brew install bison
...
bison is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have bison first in your PATH run:
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.zshrc
For compilers to find bison you may need to set:
export LDFLAGS="-L/usr/local/opt/bison/lib"
... So should i patch fbthrift, and then let cmake use the bison installed by brew. find_package(BISON 3.0.4 REQUIRED) to find_package(BISON 3.0.4 REQUIRED PATHS /usr/local/opt/bison) Is this the best solution? |
Hi @curoky |
I'm not sure, that's just the first problem I encountered on osx. |
If this port need bison 3.0.4, please modify the following codes: vcpkg/scripts/cmake/vcpkg_find_acquire_program.cmake Lines 257 to 286 in 4a9b658
|
# Find required dependencies for thrift/compiler | ||
if(compiler_only OR build_all) | ||
+ if(APPLE) | ||
+ set(BISON_EXECUTABLE "/usr/local/opt/bison/bin/bison" CACHE PATH "Bison executable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do that.
Different bison versions will cause this port to fail to build. Therefore, we need to use the built-in bison in vcpkg instead of the system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that bison does not have a pre-compiled version, we need to compile bison from source during vcpkg installation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@curoky We don't need to build bison now, as I said, we need to update vcpkg build-in tools bison instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add these lines only for OSX, and only CMAKE_HOST_WIN32
have pre-compiled bison.
So how to use the built-in bison on OSX without compiling from source?
If there is no official pre-compiled version, or we don't want to compile from the source, then the version installed by brew is also a good choice.
$ brew info bison
bison: stable 3.7.1 (bottled) [keg-only]
Parser generator
https://www.gnu.org/software/bison/
/usr/local/Cellar/bison/3.7.1 (94 files, 3.2MB)
Poured from bottle on 2020-08-23 at 01:23:11
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/bison.rb
License: GPL-3.0
==> Caveats
bison is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have bison first in your PATH run:
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.zshrc
For compilers to find bison you may need to set:
export LDFLAGS="-L/usr/local/opt/bison/lib"
vcpkg/scripts/cmake/vcpkg_find_acquire_program.cmake
Lines 258 to 275 in 4a9b658
if(CMAKE_HOST_WIN32) | |
set(SOURCEFORGE_ARGS | |
REPO winflexbison | |
FILENAME winflexbison-2.5.16.zip | |
SHA512 0a14154bff5d998feb23903c46961528f8ccb4464375d5384db8c4a7d230c0c599da9b68e7a32f3217a0a0735742242eaf3769cb4f03e00931af8640250e9123 | |
NO_REMOVE_ONE_LEVEL | |
WORKING_DIRECTORY "${DOWNLOADS}/tools/winflexbison" | |
) | |
if(VAR MATCHES "FLEX") | |
set(PROGNAME win_flex) | |
else() | |
set(PROGNAME win_bison) | |
endif() | |
set(PATHS ${DOWNLOADS}/tools/winflexbison/0a14154bff-a8cf65db07) | |
if(NOT EXISTS "${PATHS}/data/m4sugar/m4sugar.m4") | |
file(REMOVE_RECURSE "${PATHS}") | |
endif() | |
elseif(VAR MATCHES "FLEX") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bison path should be automatically added to the environment or general vcpkg_find_acquire_program
is automatically exported, so there is no need to set its path here.
See
vcpkg/ports/libpcap/portfile.cmake
Lines 40 to 42 in 310f4df
vcpkg_find_acquire_program(BISON) | |
get_filename_component(BISON_PATH ${BISON} DIRECTORY) | |
vcpkg_add_to_path(${BISON_PATH}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best way to handle this is to add this bison path (/usr/local/opt/bison/bin/bison
) to be searched for in vcpkg_find_acquire_program(BISON)
preferentially over the system bison on OSX. We can then pass this in directly to the build using OPTIONS -DBISON_EXECUTABLE=${BISON}
as an additional argument to vcpkg_configure_cmake()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ras0219 👍🏻️ Thanks for your suggestion, it's elegant and simple.
# Find required dependencies for thrift/compiler | ||
if(compiler_only OR build_all) | ||
+ if(APPLE) | ||
+ set(BISON_EXECUTABLE "/usr/local/opt/bison/bin/bison" CACHE PATH "Bison executable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bison path should be automatically added to the environment or general vcpkg_find_acquire_program
is automatically exported, so there is no need to set its path here.
See
vcpkg/ports/libpcap/portfile.cmake
Lines 40 to 42 in 310f4df
vcpkg_find_acquire_program(BISON) | |
get_filename_component(BISON_PATH ${BISON} DIRECTORY) | |
vcpkg_add_to_path(${BISON_PATH}) |
@JackBoosY Also thanks for your suggestion. I just updated this pr. Hope this one can go through soon. |
Thanks for the PR! |
Describe the pull request
What does your PR fix?
Add new port: facebook/fbthrift
Which triplets are supported/not supported? Have you updated the CI baseline?
N/A. No.
Does your PR follow the maintainer guide?
Yes.