Getting ghc/Main.hs to import modules

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting ghc/Main.hs to import modules

Anton Xue
Hey all,

I want to make modifications to a custom version of ghc/Main.hs that depends on packages not natively shipped with GHC 8.2.2.

In short, I want to be able to write "import Network" (http://hackage.haskell.org/package/network-2.8.0.0) in ghc/Main.hs and then build GHC from source. However, I am running into some problems, and here is what I have attempted based on the Building/Modifying page (https://ghc.haskell.org/trac/ghc/wiki/Building/Modifying):

1. I downloaded a copy of the network package and placed it in libraries/network.
2. I added an entry to the packages file for library/network, and used dashes for all the other entries.
3. perl boot
4. I modified ghc.mk and placed libraries/network as the first PACKAGES_STAGE1 append right before ghc-prim
5. make -j5

The build then fails complaining that:

ghc/Main.hs:77:8: error:
    Could not find module ‘Network’
    Use -v to see a list of the files searched for.
   |
77 | import Network


A similar problem also appears when I replace "import Network" with "import System.Console.Haskeline", which is strange considering that haskeline was shipped with GHC 8.2.2. However, other imports such as "import System.CPUTime", which was defined in base, do not raise this error. Otherwise GHC builds fine with no errors.

I am wondering what I should do to solve this issue.


Thank you,

Anton



_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Getting ghc/Main.hs to import modules

Carter Schonwald
you will need to edit the associated cabal file

On Wed, Jan 2, 2019 at 10:49 PM Anton Xue <[hidden email]> wrote:
Hey all,

I want to make modifications to a custom version of ghc/Main.hs that depends on packages not natively shipped with GHC 8.2.2.

In short, I want to be able to write "import Network" (http://hackage.haskell.org/package/network-2.8.0.0) in ghc/Main.hs and then build GHC from source. However, I am running into some problems, and here is what I have attempted based on the Building/Modifying page (https://ghc.haskell.org/trac/ghc/wiki/Building/Modifying):

1. I downloaded a copy of the network package and placed it in libraries/network.
2. I added an entry to the packages file for library/network, and used dashes for all the other entries.
3. perl boot
4. I modified ghc.mk and placed libraries/network as the first PACKAGES_STAGE1 append right before ghc-prim
5. make -j5

The build then fails complaining that:

ghc/Main.hs:77:8: error:
    Could not find module ‘Network’
    Use -v to see a list of the files searched for.
   |
77 | import Network


A similar problem also appears when I replace "import Network" with "import System.Console.Haskeline", which is strange considering that haskeline was shipped with GHC 8.2.2. However, other imports such as "import System.CPUTime", which was defined in base, do not raise this error. Otherwise GHC builds fine with no errors.

I am wondering what I should do to solve this issue.


Thank you,

Anton


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Getting ghc/Main.hs to import modules

Anton Xue
Hey Carter,

Thanks for getting back to me.

I've tried sticking a "network == 2.8.0.0" dependency into different combinations of the following files:

- compiler/ghc.cabal.in
- utils/ghc-cabal/ghc-cabal.cabal
- utils/ghc-pkg-ghc-pkg.cabal


In addition, I've also tried adding a "-ilibraries/network" into utils/ghc-cabal/ghc.mk

At the moment, there is evidently some progress, since it fails with:


Configuring ghc-pkg-6.9...
Configuring ghc-8.2.2...
ghc-cabal: Encountered missing dependencies:
network ==2.8.0.0
utils/ghc-pkg/ghc.mk:64: recipe for target 'utils/ghc-pkg/dist/package-data.mk' failed
make[1]: *** [utils/ghc-pkg/dist/package-data.mk] Error 1
make[1]: *** Waiting for unfinished jobs....
ghc-cabal: Encountered missing dependencies:
network ==2.8.0.0
compiler/ghc.mk:587: recipe for target 'compiler/stage1/package-data.mk' failed
make[1]: *** [compiler/stage1/package-data.mk] Error 1
Makefile:122: recipe for target 'all' failed
make: *** [all] Error 2


However, from here I'm stuck.

The network package that already exists on my system is also 2.8.0.0.


Anton

On Thu, Jan 3, 2019 at 2:34 PM Carter Schonwald <[hidden email]> wrote:
you will need to edit the associated cabal file

On Wed, Jan 2, 2019 at 10:49 PM Anton Xue <[hidden email]> wrote:
Hey all,

I want to make modifications to a custom version of ghc/Main.hs that depends on packages not natively shipped with GHC 8.2.2.

In short, I want to be able to write "import Network" (http://hackage.haskell.org/package/network-2.8.0.0) in ghc/Main.hs and then build GHC from source. However, I am running into some problems, and here is what I have attempted based on the Building/Modifying page (https://ghc.haskell.org/trac/ghc/wiki/Building/Modifying):

1. I downloaded a copy of the network package and placed it in libraries/network.
2. I added an entry to the packages file for library/network, and used dashes for all the other entries.
3. perl boot
4. I modified ghc.mk and placed libraries/network as the first PACKAGES_STAGE1 append right before ghc-prim
5. make -j5

The build then fails complaining that:

ghc/Main.hs:77:8: error:
    Could not find module ‘Network’
    Use -v to see a list of the files searched for.
   |
77 | import Network


A similar problem also appears when I replace "import Network" with "import System.Console.Haskeline", which is strange considering that haskeline was shipped with GHC 8.2.2. However, other imports such as "import System.CPUTime", which was defined in base, do not raise this error. Otherwise GHC builds fine with no errors.

I am wondering what I should do to solve this issue.


Thank you,

Anton


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs