-
Notifications
You must be signed in to change notification settings - Fork 696
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
How to link a static lib (zlib) using cli options instead extra-libraries #5805
Comments
Are you experiencing #2997 ? If yes, adding the following to your
|
Thanks, i think it is not the cause: if i remove |
I should note that Succesful build (with
Wrong build (
I've noticed those points:
|
@hvr Would be a possible fix that
or
Not sure if it shoud be a per-component ... However it should be a way to link |
@jneira is this a dynamic library? if so, transitive inter-library dependencies should be resolved automatically when libssl internally needs e.g. zlib have you tried injecting
(in principle we could add support for injecting I'm a bit in a hurry, so please excuse me if I have missed something in your comments which makes my suggestion moot. I'll try to reread more carefully when I have more time later today. |
@hvr Dont worry and let me know if i can collect/extract more info to make easier the diagnostic.
I am afraid that i've tried it. Due to my ignorance about build internals i've tried adding to
Agree
Package maintainer argues that the root problem is in the
The main conclusion of my analysis comparing the succesful and wrong builds is in #5805 (comment) Thanks a lot! |
Static variants of libcrypto may depend on libz but can't express that dependency, so we have to worry about telling Cabal about it. Relevant Issue: - NixOS/cabal2nix#389 - haskell/cabal#5805
I wonder if #5446 would fix this issue too... |
Ok, i am trying again and i have the two calls of ghc linker phase:
AFAIU the main difference is the position where |
@jneira This may be the same problem as I had here:
In my case I think ghc puts the flags in the wrong position, but maybe I'm wrong given that it works fine when |
@nh2 wow, thanks for pointed out your insightful comments about the linker. So now i've got to compile the package with I know it is somewhat a hack (as you noted too) but i think it is difficult to tell cabal the position of |
@jneira I think we'll have to fix this in ghc. Would you mind filing a bug for this issue there and CC'ing me there? I'm pretty swamped with issues currently :) |
@nh2 i am doing a little bit of investigation: it is clear that ghc supports the cabal use of
When you inform the |
@jneira I have done this now: https://gitlab.haskell.org/ghc/ghc/issues/17071 I've also made a PR to fix the problem. It moves |
@nh2 great! It seems that is the good place to put them. |
I think it's because they are passed as
cabal/Cabal/Distribution/Simple/GHC.hs Line 847 in 63331c9
it's called cabal/Cabal/Distribution/Simple/Program/GHC.hs Lines 670 to 674 in 63331c9
where we can see that with On the GHC side (link) those probably get translated to be the last contents of I haven't checked in detail yet where e.g. your points (6) and (7) are joined into |
Hi, i've tried to build the package
hopenssl
, including the test suite in windows. The steps i've followed were:cabal get hopenssl-2.2.2
cabal new-build --enable-tests -v3
At first the build failed linking one of the executables tests:
Then i tested to add the
z
lib in theextra-libraries
section of the cabal file and it worked, without pointing to zlib location explicitly (full log).However it seems the package shouldn't add the lib, cause it is a specific issue of the concrete
openssl
lib implementation used in this case.So i thought the solution could be to add the
-lz
option cause in the succesful case i detected it was being passed tohsc2hs
andgcc
(but no toghc
, at least explicitly). However i had not luck passing-lz
in--gcc-options
,--ghc-options
,--ld-options
, etc. (full log ofcabal new-build --enable-tests --gcc-options=-lz
)Note: The build of
hackage2nix
executable ofcabal2nix
package fails with the same error. That is my primary goal (see NixOS/cabal2nix#389)Thanks in advance!
The text was updated successfully, but these errors were encountered: