Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking custom object files with Cabal

In a custom cabal hook I generated object files (*.o) which I want to pass to the linker. How do I do this idiomatically?

Solution Don Stewart's answer goes in the right direction. Currently I do the following:

$ runhaskell Setup.lhs build --ld-options="PATHS TO .o FILES"
like image 836
Long Avatar asked Feb 11 '26 19:02

Long


1 Answers

According to the Cabal documentation for UserHooks, it looks like you'll need to add a buildHook, by specifying additional build flags, that add your .o files to the buildFlags for ld.


As an aside, you should be aware that generating custom .o files is highly unusual, and likely to make your build fragile. Is there a particular reason why Cabal is unable to generate these .o files itself?

like image 146
Don Stewart Avatar answered Feb 15 '26 12:02

Don Stewart