Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build issues since 1.0.0 #54

Closed
aviaviavi opened this issue Nov 24, 2018 · 5 comments
Closed

docker build issues since 1.0.0 #54

aviaviavi opened this issue Nov 24, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@aviaviavi
Copy link
Owner

aviaviavi commented Nov 24, 2018

it appears docker stopped working with the latest release

Step 9/16 : RUN stack install --ghc-options '-optl-static -fPIC -optc-Os'
 ---> Running in c175bcc07af7

Warning: /app/toodles.cabal was modified manually. Ignoring /app/package.yaml in favor of the cabal
         file. If you want to use the package.yaml file instead of the cabal file, then please
         delete the cabal file.
Building all executables for `toodles' once. After a successful build of all of them, only specified executables will be rebuilt.
toodles-1.0.0: configure (lib + exe)
Configuring toodles-1.0.0...
toodles-1.0.0: build (lib + exe)
Preprocessing library for toodles-1.0.0..
Building library for toodles-1.0.0..
[1 of 6] Compiling Paths_toodles    ( .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/autogen/Paths_toodles.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Paths_toodles.o )
[2 of 6] Compiling Types            ( src/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Types.o )
[3 of 6] Compiling ToodlesApi       ( src/ToodlesApi.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/ToodlesApi.o )
[4 of 6] Compiling Parse            ( src/Parse.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Parse.o )
[5 of 6] Compiling Config           ( src/Config.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Config.o )
[6 of 6] Compiling Server           ( src/Server.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Server.o )
/usr/bin/ld.gold: error: /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__TMC_END__' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

--  While building custom Setup.hs for package toodles-1.0.0 using:
      /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build lib:toodles exe:toodles --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
The command '/bin/sh -c stack install --ghc-options '-optl-static -fPIC -optc-Os'' returned a non-zero code: 1
@aviaviavi
Copy link
Owner Author

aviaviavi commented Nov 25, 2018

@fbartels do you recall seeing anything like this when you were getting the docker container working?

note that i tried adding -fPIC -optc-Os from what is checked in in master right now, from seeing https://www.fpcomplete.com/blog/2016/10/static-compilation-with-stack. It didn't change the error. It's the same on dockerhub too https://hub.docker.com/r/aviaviavi/toodles/builds/b6oq4ftbbfswrujqt8mqyzl/

@aviaviavi
Copy link
Owner Author

when i remove the flags completely, i get issues running the binary on alpine. i'm going to try removing the flags and using debian:stretch instead. the final image should still be on the smaller side

@aviaviavi aviaviavi added the bug Something isn't working label Nov 25, 2018
@aviaviavi
Copy link
Owner Author

fixed with a8b73a7

@fbartels
Copy link
Contributor

Hi, no I did not encounter any compilation issues during building. Should I check if I can make it to work with alpine again or do you prefer the current approach?

@aviaviavi
Copy link
Owner Author

The alpine image was still a bit smaller, so I think getting that back would be an improvement if it's an easy fix! No need to spend too much time though since the Debian route is indeed working :)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants