Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:53:49+00:00 2026-06-17T04:53:49+00:00

With the following project structure: src/FirstExecutable.hs src/SecondExecutable.hs my-amazing-project.cabal and the following cabal setup: name:

  • 0

With the following project structure:

src/FirstExecutable.hs
src/SecondExecutable.hs
my-amazing-project.cabal

and the following cabal setup:

name:               my-amazing-project
version:            0.1.0.0
build-type:         Simple
cabal-version:      >=1.8

executable first-executable
  hs-source-dirs:   src
  main-is:          FirstExecutable.hs
  ghc-options:      -O2 -threaded -with-rtsopts=-N
  build-depends:    base == 4.5.*

executable second-executable
  hs-source-dirs:   src
  main-is:          SecondExecutable.hs
  ghc-options:      -O2 -threaded -with-rtsopts=-N
  build-depends:    base == 4.5.*

Running cabal install fails with the following output:

Installing executable(s) in
/Users/mojojojo/Library/Haskell/ghc-7.4.2/lib/my-amazing-project-0.1.0.0/bin
cabal: dist/build/second-executable/second-executable: does not exist
Failed to install my-amazing-project-0.1.0.0
cabal: Error: some packages failed to install:
my-amazing-project-0.1.0.0 failed during the final install step. The exception
was:
ExitFailure 1

What am I doing wrong or is this a Cabal bug?


The contents of the executable modules are as follows:

module FirstExecutable where

main = putStrLn "Running FirstExecutable"

and

module SecondExecutable where

main = putStrLn "Running SecondExecutable"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:53:50+00:00Added an answer on June 17, 2026 at 4:53 am

    cabal expects the module of the executable to be Main. You should skip the module line or use module Main where.

    Ok here is the possible reason. The executable of a haskell program is not produced when the module is not Main when you actually compile the program. The main function of the Main module is used when the executable is run. A possible workaround for ghc is -main-is flag. So you can have something like

    name:               my-amazing-project
    version:            0.1.0.0
    build-type:         Simple
    cabal-version:      >=1.8
    
    executable first-executable
      hs-source-dirs:   src
      main-is:          FirstExecutable.hs
      ghc-options:      -O2 -threaded -with-rtsopts=-N -main-is FirstExecutable
      build-depends:    base == 4.5.*
    
    executable second-executable
      hs-source-dirs:   src
      main-is:          SecondExecutable.hs
      ghc-options:      -O2 -threaded -with-rtsopts=-N -main-is SecondExecutable
      build-depends:    base == 4.5.*
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine the following folder structure: project src code.c makefile bin How can I compile
I have a project with the following structure: /. /src /project1 /bin /obj /project2
I have a Python project with the following directory structure: project/ project/src/ project/src/somecode.py project/src/mypackage/mymodule.py
In my project I have the following structure: src/ plugins/ \__ mpc |__ oper
I have a C project that has the following structure Main/ Makefile.am bin/ src/
I have an Eclipse project with the following directory structure: MyProj/ src/main/java/ com.me.myproject.widgets Widget.java
I have a simple java project with this basic structure: IncludeMe src deploy siteSpecific
I have a project using autoconf and automake with following structure: / src/ class.h
I have a project structure that looks like the following: [Solution Name] doc (documentation)
I have the following Project Structure / src/ # src-files for the app org.mayapp.main.Main/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.