Let's say I have a folder with some .hs files and I want to wrap it in a project
If I have cabal install and stack it's no big deal:
use cabal init (interactive choosing stuff)
go on with stack init
but when I just go the easy - just install stack route I don't have cabal install available - only stack
Now stack init does not work without a .cabal (or .package) file and for stack new I know of no template that does not set up additional files/folders.
Probably I'm missing something obvious and there is a stack parameter/command for this?
If not: What's the proper way to handle this? Install cabal-install?
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I was trying not to use the default go workspace, but to create a separate workspace location. So I did the following:
Created a folder, say "/Users/user_name/some_path/go_files/"
Created 3 directories in that folder - src, pkg and bin
Created a go file called "hello_world.go" inside "/Users/user_name/some_path/go_files/src"
Exported the GOPATH variable to "/Users/user_name/some_path/go_files"
Built the executable in 2 ways: go build src/hello_world.go and cd src go build hello_word.go
The above generated 2 executables - 1 in go_files/src and the other in go_files
However, running either of them gives an error saying: package hello_world is not in GOROOT (/usr/local/go/src/hello_world)
I tried to run the executable using go run hello_world. How do I resolve this? How do I run an executable?
Please note that I can do a go run hello_world.go from inside src or a go run src/hello_world.go, but I want to know how to run the executable.
However, running either of them gives an error saying: package hello_world is not in GOROOT (/usr/local/go/src/hello_world)
You haven't actually said what you're doing to provoke this error, but it sounds like you're almost certainly running go run hello_world. Once you've build an executable, Go (the language) and go (the command) are no longer involved. Binaries run independently of their compiler, which may be surprising to you if you're coming from an interpreted language background.
You run any given executable by typing its name (if it's in your path) or by typing the path to it (ie ./hello_world) and then pressing "return".
Where is runhaskell supposed to come from? It is not on my path, and when I run stack build runhaskell, I get Unknown package: runhaskell.
stack exec -- runhaskell --help sounds like the right tool, though I'm not sure what the best answer is if another tool expects it to be available unqualified.
How do I pass a flag to stack run like I'd do with stack install --flag asd:qwe?
I couldn't find a way to do this, so here is my suggested workaround:
Instead of using stack run ..., build your application using stack build and run the program directly.
So, instead of using
# The Problem: This doesn't work because run doesn't recognize --flag
> stack run --flag asd:qwe
use the following two-step approach:
stack build --flag asd:qwe
./path/to/your/executable/<your executable>
If you're using stack install instead of stack build, stack puts the compiled binary in the local-bin directory.¹ The documentation suggests that you add this directory to your $PATH variable, which means you can just call <your-executable>.
The rest of this response assumes that you are using stack build.
On my system (Arch linux, May '19, stack 1.9.3.1), stack puts the compiled binary in the bin-folder inside the local-install-root. (Show it using stack path --local-install-root.)
The complete path to the executable should be <local-install-root>/bin/<executable-name>
¹ According to The User guide there is regular confusion about the meaning of stack install. It's an alias to stack build --copy-bins, which just copies the binary to local-bin-path after building, which makes it generally available if your $PATH includes local-bin-path
I just installed
npm install -g angular-cli
And attempted to initialize a new project
ng new foo
Unfortunately I already have nailgun installed which also uses the ng keyword.
How can I set which has precedence? Better yet, is there an easy way to rename one of them?
The first one found in the path is the one that will be called, so you could re-order your path as a first option. When you needed nailgun, you could swap the order for the nailgun and global npm modules directories in your path.
You could rename ng in the .bin directory in your global install location, but this could have side effects if other angular tools expect to be able to call ng.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am trying to download the source code for wget in Mac.
I managed to get the source code of wget in Ubuntu by
apt-get source wget
However, I have not managed to download source codes in Mac's terminal.
I did not find the same utility in MacPorts.
MacPorts is a source-based package manager. That means that each time you install a package via MacPorts, it downloads the source, potentially patches it, configures it, builds it, installs it to a temporary location (so it can track which files the port needs), makes an archive of it, then installs that archive into the MacPorts root, which is usually /opt/local.
If you want to look at or edit the source before building it, you can execute a subset of the steps necessary to download and install it. port extract <name> will download and extract the source for the port, without actually building or installing it. You can then find the extracted source with port dir <portname>:
$ sudo port -v extract zlib
Password:
---> Fetching zlib
---> Verifying checksum(s) for zlib
---> Checksumming zlib-1.2.3.tar.bz2
---> Extracting zlib
---> Extracting zlib-1.2.3.tar.bz2
$ ls $(port dir zlib)
Portfile files work
$ ls $(port dir zlib)/work
zlib-1.2.3
$ ls $(port dir zlib)/work/zlib-1.2.3
ChangeLog as400 examples inftrees.h uncompr.c
FAQ compress.c gzio.c make_vms.com win32
INDEX configure infback.c minigzip.c zconf.h
Makefile contrib inffast.c msdos zconf.in.h
Makefile.in crc32.c inffast.h old zlib.3
README crc32.h inffixed.h projects zlib.h
adler32.c deflate.c inflate.c qnx zutil.c
algorithm.txt deflate.h inflate.h trees.c zutil.h
amiga example.c inftrees.c trees.h
See the MacPorts guide for more information on developing ports, and also man port.
Most open source projects provide a compressed archive of their source code, or a readable version control repository. For instance, the source code for wget is available at http://ftp.gnu.org/gnu/wget/. All you need to do is decide which version you want to download and enter in the terminal window a command like
ftp http://ftp.gnu.org/gnu/wget/wget-1.10.2.tar.gz
You can then unpack the source code with a command like
tar xvzf wget-1.10.2.tar.gz
If the code is in a version control repository, then the project will also list the command you'll need to download the code. For instance, cvs2svn gives you the command
svn co --username=guest http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
There may be Mac-specific methods, but the beauty of what I described is that it works for any Unix-like environment.
apt-get is a program for automatically downloading and installing software packages and their dependencies; it is only available on some Linux-based platforms like Debian and Ubuntu. Mac OS X has two similar utilities: Fink and MacPorts. Both serve the same purpose as apt-get. I personally prefer MacPorts because I think it has a nicer UI, but both pieces of software work more or less the same.
AFAIK, MacPorts doesn't have a similar function to apt-get's source.
However, the source URL is in the Portfiles. You can view the portfile for a port by typing
cat `port file port_name`
in the terminal, for example:
cat `port file wget`
Or you can just install the port and find the source in /opt/local/var/macports/distfiles.
You might even be able to use the install command to just download (and not build or install) the port.
If you want an apt interface onto open source projects, look at Fink, a dpkg system for Mac OS X with various open source packages.