How to build dependencies with GCC #5869
Unanswered
boris-kolpackov
asked this question in
Writing Formulae/Casks
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Output of
brew config
Output of
brew doctor
Description of issue
I want to try to write a formula for ODB (an ORM for C++, Homebrew support requested by users). One of its components is the ODB compiler which is implemented as a GCC plugin. This means that the ODB compiler must be built with Homebrew GCC rather than Apple Clang (the plugin is loaded into the
cc1plus
process and should thus uselibstdc++
, etc). Homebrew GCC has plugin support enabled and we've been using it with ODB for many years without any major issues (thanks for that!)I found a couple of formulae that seem to be doing something similar (they use GCC for OpenMP support):
gromacs.rb
andpythran.rb
. So it seems I should be able to add a dependency ongcc
and force the use of GCC as the compiler. So far so good.What I am having trouble with is dependencies. The ODB compiler depends on two libraries,
libcutl
(already in Homebrew) andlibstudxml
(not in Homebrew but should be easy to add; it in turn will depend on the Expat library). My understanding is if I make them normal dependencies, they will be built with Apple Clang (and thus uselibc++
) and when I try to link them to the ODB compiler that was built with GCC (and thus useslibstdc++
), things will not go well.So my question is whether there is support for this scenario? I looked around but I don't see any mechanisms that would allow me to specify in my formula that I depend on a library but it must be built with GCC.
If there is no such mechanism (as I am suspecting), what is the recommended way to handle this? The only alternative that I can think of is to bundle these two (small) libraries with the ODB compiler and link them statically. I don't think this approach will have any major drawbacks. Specifically, the use of these libraries is not security-sensitive since they operate on local/trusted input.
I would appreciate some guidance on this from the Homebrew maintainers. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions