Git Product home page Git Product logo

Comments (11)

chshersh avatar chshersh commented on September 1, 2024 1

@Ericson2314 Your link is broken, unfortunately 😞

Also, I still see the following error:

Can't run protoc; run 'cabal configure' first.
CallStack (from HasCallStack):
  error, called at src/Data/ProtoLens/Setup.hs:191:24 in prt-lns-prtc-0.3.1.0-2003cf77:Data.ProtoLens.Setup
  sDistHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:113:5 in Cabal-2.2.0.1:Distribution.Simple.UserHooks

when I'm trying to build project with cabal new-build.

from proto-lens.

judah avatar judah commented on September 1, 2024

Thank you for the report. Can you please give:

  • The value of your $PATH
  • The result of which proto-lens-protoc
  • The command that you ran to produce that error
  • If you used cabal, the output of cabal --version

I just verified that cabal install proto-lens-combinators worked on my machine. My $PATH includes ~/.cabal/bin.

from proto-lens.

hvr avatar hvr commented on September 1, 2024

$PATH does not contain proto-lens-protoc nor is proto-lens-protoc installed, as cabal new-build had no indication it needed to auto-install and provide proto-lens-protoc on $PATH (in order to that, you need to use build-tools-depends; build-depends or setup-depends only specifies to bring library components into scope). In the new-build paradigm, there is no auto-populated ~/.cabal/bin anymore, as you need to be able to satisfy multiple versions of executables simultaneously.

I'm currently investigating how we can get this to work in cabal new-build (which as you may know is going to become the default in cabal-3.0 - so we still have time to figure out how to make this work), as it appears that it's not enough to add

  build-tool-depends: proto-lens-protoc:proto-lens-protoc >= 0.1 && < 0.3

to the library section, as the build-tool is already required at Setup.hs time.

So I'm afraid that this can't be addressed for cabal-2.0 users yet, and we may need to extend the custom-setup grammar in cabal-2.2 to express this kind of dependency; I'll keep you posted.


PS: The commands to reproduce this more or less how https://matrix.hackage.haskell.org/package/proto-lens-combinators does it:

$ cabal --version
cabal-install version 2.1.0.0
compiled using version 2.1.0.0 of the Cabal library

$ cabal get proto-lens-combinators
Unpacking to proto-lens-combinators-0.1.0.8/

$ cd proto-lens-combinators-0.1.0.8/

$ cabal new-build
Resolving dependencies...
Build profile: -w ghc-8.2.1 -O1
In order, the following will be built (use -v for more details):
 - proto-lens-combinators-0.1.0.8 {proto-lens-combinators-0.1.0.8-inplace} (lib:proto-lens-combinators) (first run)
[1 of 1] Compiling Main             ( /tmp/proto-lens-combinators-0.1.0.8/dist-newstyle/build/x86_64-linux/ghc-8.2.1/proto-lens-combinators-0.1.0.8/setup/setup.hs, /tmp/proto-lens-combinators-0.1.0.8/dist-newstyle/build/x86_64-linux/ghc-8.2.1/proto-lens-combinators-0.1.0.8/setup/Main.o )
Linking /tmp/proto-lens-combinators-0.1.0.8/dist-newstyle/build/x86_64-linux/ghc-8.2.1/proto-lens-combinators-0.1.0.8/setup/setup ...
Configuring proto-lens-combinators-0.1.0.8...
==========
Error: couldn't find the executable "proto-lens-protoc" in your $PATH.
    Please file a bug at https://github.com/google/proto-lens/issues .
==========
Missing executable "proto-lens-protoc"
CallStack (from HasCallStack):
  error, called at src/Data/ProtoLens/Setup.hs:297:13 in proto-lens-protoc-0.2.2.0-6fbfcc9fefb6f837231240070e1fad9e51f23d5d830dd28e2a4fa31f1e705ca4:Data.ProtoLens.Setup

PS2: Here's what happens if I add build-tool-depends to the library stanza:

Build profile: -w ghc-8.2.1 -O1
In order, the following will be built (use -v for more details):
 - proto-lens-combinators-0.1.0.8 {proto-lens-combinators-0.1.0.8-inplace} (lib:proto-lens-combinators) (first run)
./proto-lens-combinators.cabal has been changed. Re-configuring with most
recently used options. If this fails, please run configure manually.
Configuring proto-lens-combinators-0.1.0.8...
Preprocessing library for proto-lens-combinators-0.1.0.8..
Building library for proto-lens-combinators-0.1.0.8..
Can't run protoc; run 'cabal configure' first.
CallStack (from HasCallStack):
  error, called at src/Data/ProtoLens/Setup.hs:155:24 in proto-lens-protoc-0.2.2.0-6fbfcc9fefb6f837231240070e1fad9e51f23d5d830dd28e2a4fa31f1e705ca4:Data.ProtoLens.Setup
  sDistHook, called at ./Distribution/Simple/UserHooks.hs:113:5 in Cabal-2.0.0.2-0da1efa03ad749960141ea36de1dddd541a1cbe6060c2da24f506e4b072b4bc9:Distribution.Simple.UserHooks
  sdistAction, called at ./Distribution/Simple.hs:182:50 in Cabal-2.0.0.2-0da1efa03ad749960141ea36de1dddd541a1cbe6060c2da24f506e4b072b4bc9:Distribution.Simple
  defaultMainHelper, called at ./Distribution/Simple.hs:128:42 in Cabal-2.0.0.2-0da1efa03ad749960141ea36de1dddd541a1cbe6060c2da24f506e4b072b4bc9:Distribution.Simple
  defaultMainWithHooks, called at src/Data/ProtoLens/Setup.hs:94:7 in proto-lens-protoc-0.2.2.0-6fbfcc9fefb6f837231240070e1fad9e51f23d5d830dd28e2a4fa31f1e705ca4:Data.ProtoLens.Setup

which points to the code-fragment

    , sDistHook = \p maybe_l h f -> case maybe_l of
            Nothing -> error "Can't run protoc; run 'cabal configure' first."
            Just l -> do
                        generate p l
                        sDistHook hooks (fudgePackageDesc l p) maybe_l h f

from proto-lens.

judah avatar judah commented on September 1, 2024

Thanks for the detailed explanation. For your "PS2", I tracked this down to --list-sources:

$ cabal get proto-lens-combinators-0.1.0.8
$ cd proto-lens-combinators-0.1.0.8
$ cabal sdist --list-sources=output
Can't run protoc; run 'cabal configure' first.
CallStack (from HasCallStack):
error, called at src/Data/ProtoLens/Setup.hs:155:24 in
proto-lens-protoc-0.2.2.0-62akSW3yVjMghzUMuuS0D:Data.ProtoLens.Setup

The current implementation of sdist in Data.ProtoLens.Setup doesn't work unless cabal configure is run first. We'll need to look into it further to tell whether this is something that module can fix, or if we'd want the behavior of cabal-install itself to change.

from proto-lens.

Ericson2314 avatar Ericson2314 commented on September 1, 2024

I see the error message I get is now in a head #if: https://github.com/google/proto-lens/blob/master/proto-lens-protoc/src/Data/ProtoLens/Setup.hs#L188-L206 . Does that mean this problem is solved?

from proto-lens.

mpickering avatar mpickering commented on September 1, 2024

I think that the 0.4 version fixes the problem of new-build not working at all. Will it be released on hackage soon?

from proto-lens.

judah avatar judah commented on September 1, 2024

@mpickering are you sure it fixes the issue? I just tried cabal new-build on the latest master of proto-lens and got the same error as originally reported:

$ cabal new-build proto-lens-protobuf-types
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
 - proto-lens-protobuf-types-0.3.0.3 (lib:proto-lens-protobuf-types) (first run)
==========
Error: couldn't find the executable "proto-lens-protoc" in your $PATH.
    Please file a bug at https://github.com/google/proto-lens/issues .
==========
Missing executable "proto-lens-protoc"
CallStack (from HasCallStack):
  error, called at src/Data/ProtoLens/Setup.hs:394:13 in proto-lens-setup-0.4.0.0-inplace:Data.ProtoLens.Setup

I'm hoping to release 0.4 next week; the current progress is being tracked in https://github.com/google/proto-lens/wiki/Release-Plan .

from proto-lens.

mpickering avatar mpickering commented on September 1, 2024

I made sure proto-lens-protoc was on my path then the error in #110 (comment) is fixed.

from proto-lens.

judah avatar judah commented on September 1, 2024

Update: I've released proto-lens-protoc-0.3.1.1 which contains the fix in question. @mpickering can you please try it out and see whether it works for you?

Also, I verified manually that using build-tool-depends: proto-lens-protoc:proto-lens-protoc (as suggested in #110 (comment)) should prevent you from needing to put proto-lens-protoc in your path.

I think this issue can be closed once:

  1. We document that build-tool-depends is required for cabal new-build
  2. We add it to packages like proto-lens-protobuf-types
  3. We add another build job for cabal new-build in Travis CI

It's unfortunate that this complicates proto-lens's Cabal UX. Long-term something like haskell/cabal#5411 or haskell/cabal#4648 would be nicer.

from proto-lens.

mpickering avatar mpickering commented on September 1, 2024

proto-lens-protoc-0.3.1.1 works for me. Thanks a lot.

from proto-lens.

hvr avatar hvr commented on September 1, 2024

@judah are you aware that while packages such as proto-lens-combinators don't run anymore into the cannot-find-proto-exe issue, whereas the package proto-lens-protobuf-types still does?

from proto-lens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.