Closed cgag closed 8 years ago
Interesting. Adding --constraint "tls +hans" will solve this problem. I wonder if there's a better way to solve this, though.
I got it to compile earlier using "cabal install -fhans". I'm running into an issue now with something like "cannot connect to self", but I'm going to investigate more if that's my fault before opening another issue.
I admit I don't know what a tap device is. Does using one make sense when not using HalVM? I imagine the main executable eventually mirroring the current tor executable, and I don't see any mention of tap devices there.
Otherwise, how about just making hans an unconditional dependency?
If those don't work, for now just updating the readme would be good. I can send a PR if you'd like.
@cgag I'm not the owner of this project, but yes please, do send a PR.
Trying to build this in a cabal sandbox and can't figure out how. Currently trying:
cabal sandbox init
cabal install --dependencies-only --enable-tests -fhans
cabal build
The final step fails just like in the original report.
The trick is that you need to add a constraint to the tls
library when you want to build with hans
. I really wish I could specify this in the cabal file, but it sounds like that's a non-starter for the Cabal team.
I believe I've now made this whole problem much simpler in 0.1.1, which I've now posted to Hackage, and hopefully the README now makes some of the network stack stuff a little clearer. But, for normal machines:
hans
, which is simpler.hans
, you will need to make sure to add --constraint="tls +hans"
to your install flags.I've also made sure that the full set of flags is tested by Travis, so hopefully we won't run into this sort of thing again.
@cgag, can you try with the updated system, and see if that helps?
The code for 0.1.1 doesn't seem to be here on Github yet but if I do:
mkdir /tmp/wibble/
cd /tmp/wibble
cabal sandbox init
cabal install --constraint="tls +hans" haskell-tor
I now get:
Preprocessing test suite 'test-tor' for haskell-tor-0.1.1...
test/Test.hs:2:8:
Could not find module ‘Test.Handshakes’
Use -v to see a list of the files searched for.
test/Test.hs:3:8:
Could not find module ‘Test.HybridEncrypt’
Use -v to see a list of the files searched for.
test/Test.hs:4:8:
Could not find module ‘Test.TorCell’
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
haskell-tor-0.1.1 failed during the building phase. The exception was:
which certainly seems to be an improvement.
Meh. Of course. If you pull from GitHub, it will fix this issue.
I missed testing to make sure sdist grabbed everything from the testing repo. Will see if I can fix this. Meh. Cabal is my enemy.
Thanks, git head is working for me.
Excellent. Version 0.1.2, which I just uploaded to Hackage, should also fix this.
Hi, @acw . I'm trying to build haskell-tor-0.1.2
with stack
and have same issue:
No instance for (tls-1.3.3:Network.TLS.Backend.HasBackend Socket)
arising from a use of ‘MkNS’
If I understood correctly I do not need hans
support, so, is it possible to build everything with stack
or should I fallback to cabal-install
in this case?
Thanks.
Howdy. I have to be honest: I've never used stack, so I have no idea if it works or not. Perhaps we should add a bug for it?
As for the error you're seeing, usually that is fixed by either adding -f-hans
or --constraint="tls +hans"
to your cabal-install
invocation.
Well, I did some research and stack
have few options to pass flags to cabal:
stack build --flag PACKAGE:FLAG
stack.yaml
:flags:
tls:
hans: true
I should mention, that to be able to change tls
flag I have add tls
package to extra-dep
section of stack.yaml
, here is complete list:
extra-deps:
- attoparsec-0.13.0.1
- hans-2.6.0.0
- haskell-tor-0.1.2
- pretty-hex-1.0
- pure-zlib-0.4
- tls-1.3.2
I tried to enable and disable hans
flag, but the result was always the same.
stack build --flag tls:hans
connection-0.2.5: unregistering (missing dependencies: tls)
http-client-tls-0.2.2: unregistering (missing dependencies: connection, tls)
tls-1.3.2: unregistering (flags changed from ["-f-hans"] to ["-fhans"])
...
[3 of 3] Compiling Main ( exe/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/haskell-tor/haskell-tor-tmp/Main.o )
/tmp/stack16033/haskell-tor-0.1.2/exe/Main.hs:169:21:
No instance for (tls-1.3.2:Network.TLS.Backend.HasBackend Socket)
stack build --flag tls:-hans
connection-0.2.5: unregistering (missing dependencies: tls)
http-client-tls-0.2.2: unregistering (missing dependencies: connection, tls)
tls-1.3.2: unregistering (flags changed from ["-fhans"] to ["-f-hans"])
...
[3 of 3] Compiling Main ( exe/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/haskell-tor/haskell-tor-tmp/Main.o )
/tmp/stack16033/haskell-tor-0.1.2/exe/Main.hs:169:21:
No instance for (tls-1.3.2:Network.TLS.Backend.HasBackend Socket)
I can try to install GHC and cabal-install (they are both installed by stack in my case) and build my project within cabal sandbox, but I guess the result will be the same.
Thank you for quick response! I'll post further results tomorrow.
Indeed, I've initialized sandbox in empty directory and then run cabal install haskell-tor -f-hans
, and got successful result. I'll open issue for stack
in this case.
Update! I was able to build my project running
stack build --flag *:-hans
In this case stack rebuilt several package dependent on this flag, namely:
$ stack build --flag *:-hans
attoparsec-0.13.0.1: unregistering (flags changed from [] to ["-f-hans"])
connection-0.2.5: unregistering (flags changed from [] to ["-f-hans"])
http-client-tls-0.2.2: unregistering (missing dependencies: connection)
pretty-hex-1.0: unregistering (flags changed from [] to ["-f-hans"])
pure-zlib-0.4: unregistering (flags changed from [] to ["-f-hans"])
So, running stack build --flag tls:-hans
is not enough. Initially, I was not able to specify *
wildcard because of fish shell (it have its own precedence for this stuff), but this command works fine in bash. I'll do one final test I report result. Sorry if I'm too verbose, hope this will be helpful for somebody.
Well, this is the first case I've faced where fish fails completely, if I escape asterisk \*
stack
fails to parse this, so the only way is to use bash at least for now. It is not possible to use wildcards in flags
section of stack.yaml
yet too (https://github.com/commercialhaskell/stack/issues/1452).
Thank you anyway @acw !
I'm attempting to build this on linux (as a nomral executable, not a HalVM instance) and ran:
cabal sandbox init cabal install --only-dependencies cabal build
and I'm running into:
Looks like the both versions of initializeSystem call hansNetworkStack. It seems like you always need to depend on hans to build the executable at the moment in case you want to use a tap device.