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

Environment variable #437

Open
sterankin opened this issue Jun 10, 2019 · 2 comments
Open

Environment variable #437

sterankin opened this issue Jun 10, 2019 · 2 comments

Comments

@sterankin
Copy link

I am using the environment variable (FREETDS_DIR) to provide a path to freetds in my application.

Since I am using Cloud Foundry and can only use 1 buildpack, I need to vendor the freetds dependency (please see the custom libraries section here: https://docs.pivotal.io/pivotalcf/2-2/buildpacks/ruby/ruby-tips.html#custom-libraries)

I am unclear what I need to do in order to provide the freetds dependencies that tiny_tds needs. Do I need to build and compile freetds or simply download the zip file and unzip it?

Here is what I have done:

Is this sufficient, from looking at the tiny_tds code, it looks for a freetds/include folder and also a freetds/lib folder.

I don't see a lib folder anywhere.

Can I vendor the freetds dependency this way and what folders should I supply with my applications source code?

Thanks

@sterankin
Copy link
Author

sterankin commented Jun 11, 2019

Just to add an update, I am now trying to use the bundler config option, which allows you to tell bundler where to install the freetds libraries from.

So my bundle/.config file looks like:

---
BUNDLE_BUILD__TINY_TDS: "--with-freetds-dir=/home/vcap/app/ld_library_path/freetds"

From the logs I can see bundler using this option when installing tiny_tds, although it seems to have an extra backslash before the = sign?

--with-freetds-dir\=/home/vcap/app/ld_library_path/freetds

Full log:

current directory:
          /tmp/contents075463777/deps/0/vendor_bundle/ruby/2.4.0/gems/tiny_tds-2.1.2/ext/tiny_tds
          /tmp/contents075463777/deps/0/ruby/bin/ruby -I
          /tmp/contents075463777/deps/0/ruby/lib/ruby/site_ruby/2.4.0 -r
          ./siteconf20190611-51-sl5mbj.rb extconf.rb
          --with-freetds-dir\=/home/vcap/app/ld_library_path/freetds
          checking for sybfront.h... no
          checking for sybdb.h... no
          checking for tdsdbopen() in -lsybdb... no
          checking for dbanydatecrack() in -lsybdb... no
          Failed! Do you have FreeTDS 0.95.80 or higher installed?
          *** extconf.rb failed ***
          Could not create Makefile due to some reason, probably lack of necessary
          libraries and/or headers.  Check the mkmf.log file for more details.  You may
          need configuration options.
          
          Provided configuration options:
          	--with-opt-dir
          	--without-opt-dir
          	--with-opt-include
          	--without-opt-include=${opt-dir}/include
          	--with-opt-lib
          	--without-opt-lib=${opt-dir}/lib
          	--with-make-prog
          	--without-make-prog
          	--srcdir=.
          	--curdir
          	--ruby=/tmp/contents075463777/deps/0/ruby/bin/$(RUBY_BASE_NAME)
          	--help
          	--with-freetds-dir
          	--with-freetds-include
          	--without-freetds-include=${freetds-dir}/include
          	--with-freetds-lib
          	--without-freetds-lib=${freetds-dir}/lib
          	--with-freetds-dir
          	--with-freetds-include
          	--without-freetds-include=${freetds-dir}/include
          	--with-freetds-lib
          	--without-freetds-lib=${freetds-dir}/lib
          	--with-sybdblib
          	--without-sybdblib
          	--with-sybdblib
          	--without-sybdblib
          
          To see why this extension failed to compile, please check the mkmf.log which can
          be found here:
          
          /tmp/contents075463777/deps/0/vendor_bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/tiny_tds-2.1.2/mkmf.log
          
          extconf failed, exit code 1
          
          Gem files will remain installed in
          /tmp/contents075463777/deps/0/vendor_bundle/ruby/2.4.0/gems/tiny_tds-2.1.2 for
          inspection.
          Results logged to
          /tmp/contents075463777/deps/0/vendor_bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/tiny_tds-2.1.2/gem_make.out
          
          An error occurred while installing tiny_tds (2.1.2), and Bundler cannot
          continue.
          Make sure that `gem install tiny_tds -v '2.1.2' --source
          'https://repo.forge.lmig.com/content/groups/ets-ruby-gems/'` succeeds before
          bundling.
          
          In Gemfile:
            activerecord-sqlserver-adapter was resolved to 5.0.8, which depends on
              tiny_tds
          **ERROR** Unable to install gems: exit status 5
   Failed to compile droplet: Failed to run all supply scripts: exit status 15
   Exit status 223

@sterankin
Copy link
Author

Ok the path was wrong, I was able to use the correct path to the compiled freetds folder:

BUNDLE_BUILD__TINY_TDS: "--with-freetds-dir=/tmp/app/vendor/freetds"

But its now failing with:

OUT] Starting health monitoring of container
2019-06-11T16:12:39.355+01:00 [APP/PROC/WEB/0] [ERR] /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/tiny_tds-2.1.2/lib/tiny_tds.rb:60:in `require': libsybdb.so.5: cannot open shared object file: No such file or directory - /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/tiny_tds-2.1.2/lib/tiny_tds/tiny_tds.so (LoadError)

So it can't find libsybdb.so? Its in my ROOT/vendor/freetds/lib folder, is there a way to change it to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant