NREL / conan-openstudio-ruby

3 stars 5 forks source link

Fix dbm problems on Ubuntu / Travis #13

Closed jmarrec closed 5 years ago

jmarrec commented 5 years ago

https://travis-ci.org/NREL/conan-openstudio-ruby/jobs/567005211#L2409

ext/extinit.c updated
compiling ext/extinit.o
generating enc.mk
compiling enc/encinit.c
linking ruby
*** Following extensions are not compiled:
dbm:
    Could not be configured. It will not be installed.
    Check ext/dbm/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.

Might need some system dependencies etc.

tijcolem commented 5 years ago

This points to an issue with either conan failing to link to the required dependency [gdbm/1.18.1@bincrafters/stable]9https://bintray.com/bincrafters/public-conan/gdbm%3Abincrafters/1.18.1%3Astable), or the gdbm lib that conan installs does not have content to build dbm.a

When I install apt-get install libgdbm-dev before running conan, conan successfully links to those static libs and can compile the ext/dbm.a.

I extracted a snippet of the /ext/dbm/mkmf.log which shows the linker looking in system folders. Does conan automatically try to link to required conan dependency paths (e.g /home/conan/.conan/data/gdbm/...) or does this need to explicity set somewhere in the configs?

We can hack it and run apt-get install libgdbm-dev but that kinda defeats the purposes of using conan.


have_type: checking for DBM in ndbm.h... -------------------- no

"/usr/bin/gcc -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/dbm -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -Wrestrict -c conftest.c" conftest.c:3:10: fatal error: ndbm.h: No such file or directory

include

      ^~~~~~~~

compilation terminated. checked program was: / begin / 1: #include "ruby.h" 2: 3: #include 4: 5: /top/ 6: typedef DBM conftest_type; 7: int conftestval[sizeof(conftest_type)?1:-1]; / end /


have_type: checking for DBM in qdbm/relic.h... -------------------- no

"/usr/bin/gcc -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/dbm -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -Wrestrict -c conftest.c" conftest.c:3:10: fatal error: qdbm/relic.h: No such file or directory

include <qdbm/relic.h>

      ^~~~~~~~~~~~~~

compilation terminated. checked program was: / begin / 1: #include "ruby.h" 2: 3: #include <qdbm/relic.h> 4: 5: /top/ 6: typedef DBM conftest_type; 7: int conftestval[sizeof(conftest_type)?1:-1]; / end /


have_type: checking for DBM in relic.h... -------------------- no

"/usr/bin/gcc -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/dbm -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -Wrestrict -c conftest.c" conftest.c:3:10: fatal error: relic.h: No such file or directory

include

      ^~~~~~~~~

compilation terminated. checked program was: / begin / 1: #include "ruby.h" 2: 3: #include 4: 5: /top/ 6: typedef DBM conftest_type; 7: int conftestval[sizeof(conftest_type)?1:-1]; / end /



have_library: checking for -lgdbm... -------------------- no

"/usr/bin/gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/dbm -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-const ant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0 -Wduplicated-cond -Wrestrict conftest.c -L. -L../.. -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/conan/.conan/data/openstudio_ruby/2.5.5/nrel/stable/build/1814c0429e8b31430cfd31e305ad1ac9f11e 0703/Ruby-prefix/src/Ruby-install/lib -L/home/conan/.conan/data/openstudio_ruby/2.5.5/nrel/stable/build/1814c0429e8b31430cfd31e305ad1ac9f11e0703/Ruby-prefix/src/Ruby-install/lib -lruby-static -lgdbm -lpthread -lgmp -ldl -lcrypt -lm -lc" /usr/bin/ld: cannot find -lgdbm collect2: error: ld returned 1 exit status checked program was: / begin / 1: #include "ruby.h" 2: 3: /top/ 4: extern int t(void); 5: int main(int argc, char *argv) 6: { 7: if (argc > 1000000) { 8: printf("%p", &t); 9: } 10: 11: return 0; 12: } 13: 14: int rb_hasFile(const char t_filename) { 15: return 0; 16: } 17: 18: int rb_require_embedded(const char t_filename) { 19: return 0; 20: } 21: 22: int t(void) { ; return 0; } / end */

jmarrec commented 5 years ago

@tijcolem do you have the full log please?

We're normally passing --with-gdbm-dir to the ruby configure command, I'd like to make sure this works.

Cf https://github.com/NREL/conan-openstudio-ruby/blob/4b24bb49d9130b53672a4037128c1e3fa10712c6/CMakeLists.txt#L142

And i made the point of use actually echo it to the build log cf https://github.com/NREL/conan-openstudio-ruby/blob/4b24bb49d9130b53672a4037128c1e3fa10712c6/CMakeLists.txt#L188

tijcolem commented 5 years ago

Full build logs.

running conan to build: https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/scratch/output.log

/etc/dbm/mkmf.log https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/scratch/mkmf.log

Steps to reproduce this (not fun).

1 ) I created a private conan-openstudio-ruby in travis to run the debug tool (UI it's only available for private repos)

2 ) Run job in travis debug and connect via ssh

3 ) Set up the env by running the travis commands (see https://docs.travis-ci.com/user/running-build-in-debug-mode/)

travis_run_before_install travis_run_install travis_run_before_script travis_run_script

The travis_run_script will run the docker container but then exit it and the data will be lost so you need to run the container and run the commands yourself.

You can run travis_run_script and watch the docker command (looks like below) and then copy and run it like this so you can docker exec -it <containerid> /bin/bash

sudo -E docker run -d --rm -v "/home/travis/build/ci-commercialbuildings/conan_openstudio_ruby_test:/home/conan/project" -e CONAN_REMOTES="https://api.bintray.com/conan/bincrafters/public-conan@True@remote0,https://api.bintray.com/conan/commercialbuilding/nrel@True@upload_repo,https://api.bintray.com/conan/jmarrec/testing@True@remote2" -e CONAN_GCC_VERSIONS="7" -e CONAN_DOCKER_IMAGE="conanio/gcc7" -e CONAN_UPLOAD="https://api.bintray.com/conan/commercialbuilding/nrel@True@upload_repo" -e CONAN_BUILD_TYPES="Release,Debug" -e CONAN_STABLE_BRANCH_PATTERN="master" -e CONAN_USERNAME="***" -e CONAN_ARCHS="x86_64" -e CONAN_LOGIN_USERNAME="********" -e CONAN_PASSWORD="*************" -e CONAN_CHANNEL="stable" -e CONAN_UPLOAD_ONLY_WHEN_STABLE="0" -e CONAN_REFERENCE="openstudio_ruby/2.5.5@nrel/stable" -e CPT_PROFILE="@@include(default)@@@@[settings]@@arch=x86_64@@build_type=Release@@compiler=gcc@@compiler.libcxx=libstdc++11@@compiler.version=7@@[options]@@@@[env]@@@@[build_requires]@@@@" -e CONAN_TEMP_TEST_FOLDER="1" -e CPT_UPLOAD_ENABLED="True" -e CPT_UPLOAD_RETRY="3" -e CPT_BUILD_POLICY="outdated" -e CPT_CONANFILE="conanfile.py" -e PIP_PROGRESS_BAR="off" -e PIP_DISABLE_PIP_VERSION_CHECK="1" conanio/gcc7 /bin/sh -c " cd project && run_create_in_docker "

replace the command cd project && run_create_in_docker with something like "tail -f /dev/null" Then exec into the container and run cd project && run_create_in_docker to view the logs.

Also, you should be able to run all the above locally if you can recreate the env for travis.

https://docs.travis-ci.com/user/running-build-in-debug-mode/

jmarrec commented 5 years ago

Ok so I figured the problem, will open a PR for clarity.