Error accessing data files from package code in Cabal: Unkown symbol

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

Error accessing data files from package code in Cabal: Unkown symbol

Bugzilla from alfonso.acosta@gmail.com
Hi!

I'm working on a library package called ForSyDe.

Following Cabal's documentation, I'm using the autogenerated
Paths_ForSyDe module in order to access the data files of my library
during execution.

After installation,  the Paths_ForSyDe import seems to be causing an
unknown-symbol error whenever I try to compile any code which makes
use of the ForSyDe library:

" unknown symbol `___stginit_ForSyDezm0zi1_PathszuForSyDe_' "

I'm not sure, but it seems that cabal doesn't properly link or install
the Paths_ForSyDe module (I tried to include it in the cabal
description file to no avail)

Any suggestions about how to fix this problem?

Thanks in advance,

Fons

P.S: I'm using Cabal-1.2.3.0
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Error accessing data files from package code in Cabal: Unkown symbol

Don Stewart-2
alfonso.acosta:

> Hi!
>
> I'm working on a library package called ForSyDe.
>
> Following Cabal's documentation, I'm using the autogenerated
> Paths_ForSyDe module in order to access the data files of my library
> during execution.
>
> After installation,  the Paths_ForSyDe import seems to be causing an
> unknown-symbol error whenever I try to compile any code which makes
> use of the ForSyDe library:
>
> " unknown symbol `___stginit_ForSyDezm0zi1_PathszuForSyDe_' "
>
> I'm not sure, but it seems that cabal doesn't properly link or install
> the Paths_ForSyDe module (I tried to include it in the cabal
> description file to no avail)
>
> Any suggestions about how to fix this problem?
>
> Thanks in advance,

Probably you've not listed the Paths_ForSyDe module in your module
exports in the .cabal file?
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Error accessing data files from package code in Cabal: Unkown symbol

Bugzilla from alfonso.acosta@gmail.com
On Tue, Jul 1, 2008 at 1:26 PM, Don Stewart <[hidden email]> wrote:
> Probably you've not listed the Paths_ForSyDe module in your module
> exports in the .cabal file?

Thanks, that was the problem.

Since Paths_pkgname is somehow a special module, I stupidly assumed
that cabal would take care of exporting it under the hood. I hope that
the directory where the Paths_pkgname is included (dist/build/autogen
) doesn't change in the future.

Either way, I think it would be a good idea to include a comment about
it in the Cabal documentation
(http://www.haskell.org/cabal/release/latest/doc/users-guide/authors.html#paths-module
).
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Error accessing data files from package code in Cabal: Unkown symbol

Duncan Coutts

On Tue, 2008-07-01 at 14:10 -0500, Alfonso Acosta wrote:

> On Tue, Jul 1, 2008 at 1:26 PM, Don Stewart <[hidden email]> wrote:
> > Probably you've not listed the Paths_ForSyDe module in your module
> > exports in the .cabal file?
>
> Thanks, that was the problem.
>
> Since Paths_pkgname is somehow a special module, I stupidly assumed
> that cabal would take care of exporting it under the hood. I hope that
> the directory where the Paths_pkgname is included (dist/build/autogen
> ) doesn't change in the future.

Do not hard code the path. It can change (via a command line flag).

It's not necessary to hard code anything anyway, just using:

other-modules: Paths_ForSyDe

will work fine (because the $dist/build/autogen path is on the sources
search path)

I suggest using other-modules rather than exposed-modules because you
probably do not need to make that module part of your public api.

> Either way, I think it would be a good idea to include a comment about
> it in the Cabal documentation
> (http://www.haskell.org/cabal/release/latest/doc/users-guide/authors.html#paths-module
> ).

Right.

Duncan

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Error accessing data files from package code in Cabal: Unkown symbol

Bugzilla from alfonso.acosta@gmail.com
On Wed, Jul 2, 2008 at 8:57 AM, Duncan Coutts
<[hidden email]> wrote:
> Do not hard code the path. It can change (via a command line flag).
>
> It's not necessary to hard code anything anyway, just using:
>
> other-modules: Paths_ForSyDe

I tried to avoid doing it, but without adding dist/build/autogen to
hs-source-dirs  (that is, leaving it as "hs-source-dirs:  src") I get
the following error:

Setup.hs: can't find source for Paths_ForSyDe in ["src"]

> I suggest using other-modules rather than exposed-modules because you
> probably do not need to make that module part of your public api.

Yes, that's what I did.
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Error accessing data files from package code in Cabal: Unkown symbol

Duncan Coutts

On Wed, 2008-07-02 at 10:50 -0500, Alfonso Acosta wrote:

> On Wed, Jul 2, 2008 at 8:57 AM, Duncan Coutts
> <[hidden email]> wrote:
> > Do not hard code the path. It can change (via a command line flag).
> >
> > It's not necessary to hard code anything anyway, just using:
> >
> > other-modules: Paths_ForSyDe
>
> I tried to avoid doing it, but without adding dist/build/autogen to
> hs-source-dirs  (that is, leaving it as "hs-source-dirs:  src") I get
> the following error:
>
> Setup.hs: can't find source for Paths_ForSyDe in ["src"]

Ah, sorry, that bug was only fixed in Cabal-1.4 so yes it will not work
in Cabal-1.2.x.

The reason not that many people have run into this issue is that
typically it is executables not libraries that use data files and thus
use the Paths_pkgname module and for executables it's possible to get
away without listing all modules in the extra/other-modules fields.

Duncan

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries