Trying to get Docker to build Scry


#1

I’m trying to get a docker image built for Scry. I need the image to run specs on travis and also so I can build a linux distribution.

Here’s the output when I try to run crystal spec

% docker run kofno/scry /bin/sh -c "cd /opt/scry; crystal spec"                                                                                                               ✹ ✭
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMNewDIBuilder':
llvm_ext.cc:(.text.LLVMNewDIBuilder+0x25): undefined reference to `llvm::DIBuilder::DIBuilder(llvm::Module&)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderCreateLexicalBlock':
llvm_ext.cc:(.text.LLVMDIBuilderCreateLexicalBlock+0x8): undefined reference to `llvm::DIBuilder::createLexicalBlock(llvm::DIDescriptor, llvm::DIFile, unsigned int, unsigned int, unsigned int)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderGetOrCreateTypeArray':
llvm_ext.cc:(.text.LLVMDIBuilderGetOrCreateTypeArray+0x5): undefined reference to `llvm::DIBuilder::getOrCreateArray(llvm::ArrayRef<llvm::Value*>)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderGetOrCreateArray':
llvm_ext.cc:(.text.LLVMDIBuilderGetOrCreateArray+0x5): undefined reference to `llvm::DIBuilder::getOrCreateArray(llvm::ArrayRef<llvm::Value*>)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderCreateSubroutineType':
llvm_ext.cc:(.text.LLVMDIBuilderCreateSubroutineType+0x7): undefined reference to `llvm::DIBuilder::createSubroutineType(llvm::DIFile, llvm::DIArray, unsigned int)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderCreateLocalVariable':
llvm_ext.cc:(.text.LLVMDIBuilderCreateLocalVariable+0x59): undefined reference to `llvm::DIRef<llvm::DIType>::DIRef(llvm::Value const*)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderInsertDeclareAtEnd':
llvm_ext.cc:(.text.LLVMDIBuilderInsertDeclareAtEnd+0x8): undefined reference to `llvm::DIBuilder::insertDeclare(llvm::Value*, llvm::DIVariable, llvm::BasicBlock*)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderCreateEnumerationType':
llvm_ext.cc:(.text.LLVMDIBuilderCreateEnumerationType+0x8f): undefined reference to `llvm::DIBuilder::createEnumerationType(llvm::DIDescriptor, llvm::StringRef, llvm::DIFile, unsigned int, unsigned long, unsigned long, llvm::DIArray, llvm::DIType, llvm::StringRef)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMDIBuilderCreateStructType':
llvm_ext.cc:(.text.LLVMDIBuilderCreateStructType+0xab): undefined reference to `llvm::DIBuilder::createStructType(llvm::DIDescriptor, llvm::StringRef, llvm::DIFile, unsigned int, unsigned long, unsigned long, unsigned int, llvm::DIType, llvm::DIArray, unsigned int, llvm::DIType, llvm::StringRef)'
/opt/crystal/src/llvm/ext/llvm_ext.o: In function `LLVMTemporaryMDNode':
llvm_ext.cc:(.text.LLVMTemporaryMDNode+0x7): undefined reference to `llvm::MDNode::getTemporary(llvm::LLVMContext&, llvm::ArrayRef<llvm::Value*>)'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc -o "/root/.cache/crystal/crystal-run-spec.tmp" "${@}"  -rdynamic  -lz `pkg-config --libs libssl || printf %s '-lssl -lcrypto'` `pkg-config --libs libcrypto || printf %s '-lcrypto'` /opt/crystal/src/llvm/ext/llvm_ext.o `$(command -v llvm-config-3.6 || command -v llvm-config36 || command -v llvm-config-3.5 || command -v llvm-config35 || command -v llvm-config) --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lxml2 -lpcre -lm -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`

And here’s the output from running the cc command:

% docker run kofno/scry /bin/sh -c "cc -o "/root/.cache/crystal/crystal-run-spec.tmp" "${@}"  -rdynamic  -lz `pkg-config --libs libssl || printf %s '-lssl -lcrypto'` `pkg-config --libs libcrypto || printf %s '-lcrypto'` /opt/crystal/src/llvm/ext/llvm_ext.o `$(command -v llvm-config-3.6 || command -v llvm-config36 || command -v llvm-config-3.5 || command -v llvm-config35 || command -v llvm-config) --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lxml2 -lpcre -lm -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib"
/usr/bin/ld: cannot open output file /root/.cache/crystal/crystal-run-spec.tmp: No such file or directory
collect2: error: ld returned 1 exit status
/bin/sh: 2: -lLLVMLTO: not found
/bin/sh: 3: -lcurses: not found

If you have any llvm or docker chops, your help would be appreciated. Here’s the link to the dockerfile --> https://github.com/kofno/scry/blob/master/Dockerfile


#2

two libraries are missing in your Docker image: curses and llvm, i guess it refers to debugging/dev packages. Which distro are you using as image base?


#3

It’s ubuntu… I’ve got llvm and llvm-dev… I wonder if there’s a third llvm I need to have installed. And I can’t even find a curses install. Just ncurses…


#4

ncurses should be ok, regarding llvm i seen their repo and looks like they use llvm 3.5 against the 3.6 you mentioned: https://hub.docker.com/r/crystallang/crystal/~/dockerfile/ Probably there is a reason for that?


#5

OK. I think I have something that works. Next step is to get it running on travis.


#6

And travis! --> https://travis-ci.org/kofno/scry