obsidiansystems / obelisk

Functional reactive web and mobile applications, with batteries included.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
959 stars 107 forks source link

error: 'cc' failed in phase `Linker' when building with nix-build #202

Closed Rizary closed 6 years ago

Rizary commented 6 years ago

I'm running nix-build -A exe -o result-exe on my nixos machine (18.03) and get this error:

[1 of 1] Compiling Main             ( exe/main.hs, dist/build/frontend/frontend-tmp/Main.dyn_o )
Linking dist/build/frontend/frontend ...
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadIOAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfHasDocumentAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadHoldAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadJSMAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfRouteWritertRouteWidgetAppT_closure'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_TypesziRouteWidget_Widget_static_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfPostBuildAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfRouteWritertRouteWidgetAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_TypesziRouteWidget_zdfEqRouteWidget_closure'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadRefAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfPerformEventtAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfDomBuildertAppT_closure'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfHasRoutetRouteWidgetAppT_closure'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadReflexCreateTriggerAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfHasJSContextAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_runAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadAppT3_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfDomBuildertAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfMonadFixAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_runAppT_closure'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfHasRoutetRouteWidgetAppT_info'
/tmp/nix-build-frontend-0.1.drv-0/y919m437f920nx6sq5cjxqg6h48as576-frontend/dist/build/libHSfrontend-0.1-4k4SdXtr1MQHlinfysyjpk-ghc8.0.2.so: undefined reference to `frontendzm0zi1zm4k4SdXtr1MQHlinfysyjpk_UIziBase_zdfTriggerEventAppT_info'
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/8jlf6lx6jpwiw1994dcg6lprdqy23ga1-frontend-0.1.drv' failed with exit code 1
cannot build derivation '/nix/store/2mywx64y0az36f2dpdcvnll25qfzbdfz-backend-0.1.drv': 1 dependencies couldn't be built
building '/nix/store/naiki81rsjcvf9zxd2dihxs9z84lnnra-obelisk-executable-config-0.1.drv'...
cannot build derivation '/nix/store/fsr1h3a65k34bzy8zz2l2imlqa7js3rq-serverExe.drv': 1 dependencies couldn't be built
error: build of '/nix/store/fsr1h3a65k34bzy8zz2l2imlqa7js3rq-serverExe.drv' failed
dalaing commented 6 years ago

What does your frontend.cabal file look like? Do all of the modules in your frontend project appear in either the exposed-modules or the other-modules sections?

Rizary commented 6 years ago

@dalaing

name: frontend
version: 0.1
cabal-version: >= 1.8
build-type: Simple

library
  hs-source-dirs: src
  build-depends: base
               , common
               , reflex-dom
               , static
               , obelisk-executable-config
               , text
               -- custom package
               , reflex
               , mtl
               , transformers
               , aeson
               , filepath
               , lens
               , bytestring
               , containers
               , email-validate
               , uri-bytestring
               , ref-tf
               , exception-transformers
               , dependent-sum
               , dependent-map
               , ghcjs-dom
               --, ghcjs-base
               , jsaddle
               , reflex-dom-nested-routing
               , reflex-dom-storage

  exposed-modules:
    Frontend
  other-modules:
      UI
    , Util.Button
    , Util.Collection
    , Util.Bulma.Components.Navbar
    , Web
    , Web.Aktivitas
    , Web.Footer
    , Web.Navigation
    , Web.Landing
    , Web.Media
    , Web.Media.Berita
    , Web.Media.Publikasi
    , Web.Media.SiaranPers
    , Web.Tentang
    , Web.Tentang.DKM
    , Web.Tentang.Galeri
    , Web.Tentang.LaporanTahunan
    , Web.Tentang.Sejarah
    , Web.Tentang.VisiMisi
  ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings
  if os(darwin)
     ghc-options: -dynamic
  if impl(ghcjs -any)
    ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings -dedupe
    cpp-options: -D_GHCJS_ -DGHCJS_GC_INTERVAL=60000 -DGHCJS_BROWSER

executable frontend
  main-is: main.hs
  hs-source-dirs: exe
  build-depends: base
               , reflex-dom
               , frontend

  --TODO: Make these ghc-options optional
  ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings
  if os(darwin)
     ghc-options: -dynamic
  if impl(ghcjs -any)
    ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings -dedupe
cpp-options: -D_GHCJS_ -DGHCJS_GC_INTERVAL=60000 -DGHCJS_BROWSER

this is my frontend.cabal file.

dalaing commented 6 years ago

Are you missing a UI.Base module in the other-modules section? I'm guessing that from the text of the linker errors, but I don't exactly have the details of the name mangling memorised :)

On Fri, 17 Aug 2018, 5:46 PM Andika Demas Riyandi notifications@github.com wrote:

@dalaing https://github.com/dalaing

name: frontend version: 0.1 cabal-version: >= 1.8 build-type: Simple

library hs-source-dirs: src build-depends: base , common , reflex-dom , static , obelisk-executable-config , text -- custom package , reflex , mtl , transformers , aeson , filepath , lens , bytestring , containers , email-validate , uri-bytestring , ref-tf , exception-transformers , dependent-sum , dependent-map , ghcjs-dom --, ghcjs-base , jsaddle , reflex-dom-nested-routing , reflex-dom-storage

exposed-modules: Frontend other-modules: UI , Util.Button , Util.Collection , Util.Bulma.Components.Navbar , Web , Web.Aktivitas , Web.Footer , Web.Navigation , Web.Landing , Web.Media , Web.Media.Berita , Web.Media.Publikasi , Web.Media.SiaranPers , Web.Tentang , Web.Tentang.DKM , Web.Tentang.Galeri , Web.Tentang.LaporanTahunan , Web.Tentang.Sejarah , Web.Tentang.VisiMisi ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings if os(darwin) ghc-options: -dynamic if impl(ghcjs -any) ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings -dedupe cpp-options: -DGHCJS -DGHCJS_GC_INTERVAL=60000 -DGHCJS_BROWSER

executable frontend main-is: main.hs hs-source-dirs: exe build-depends: base , reflex-dom , frontend

--TODO: Make these ghc-options optional ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings if os(darwin) ghc-options: -dynamic if impl(ghcjs -any) ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls -fexpose-all-unfoldings -dedupe cpp-options: -DGHCJS -DGHCJS_GC_INTERVAL=60000 -DGHCJS_BROWSER

this is my frontend.cabal file.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/obsidiansystems/obelisk/issues/202#issuecomment-413786131, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDhrOuni2LrCOZ7zMuNs7y0_71P-deNks5uRnTSgaJpZM4WA3Uh .

Rizary commented 6 years ago

@dalaing i'll look into it (but i think that is the case).

Rizary commented 6 years ago

@dalaing thanks, it works. I got some weird output though, but it is solved