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

terraspace new project infra --plugin azurerm --examples not working #188

Closed
3 tasks
boristyukin opened this issue Jan 13, 2022 · 3 comments
Closed
3 tasks
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@boristyukin
Copy link

boristyukin commented Jan 13, 2022

I just installed terraspace and terraform in Ubuntu WSL2. Everything is the latest version.

I used standalone installer for Terraspace as I did not want to install Ruby separately. Followed the steps here:
https://terraspace.cloud/docs/install/standalone/

$ terraspace setup check
Detected Terrspace version: 1.0.0
Detected Terraform bin: /home/boris/.tfenv/bin/terraform
Detected Terraform v1.1.3
Terraspace requires Terraform v0.12.x and above
You're all set!

If I run

terraspace new project infra --plugin azurerm --examples

I get this error below.

BUT
if I run demo for AWS or Google, all is fine! So these two commands below work perfectly fine for me:

terraspace new project infra --plugin aws --examples
terraspace new project infra --plugin google --examples
$ terraspace new project infra --plugin azurerm --examples

=> Creating new project called test4
       exist  test4
   identical  test4/.gitignore
   identical  test4/Gemfile
   identical  test4/README.md
   identical  test4/Terrafile
   identical  test4/config/app.rb
=> Installing dependencies with: bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your
bundle as root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Using minitest 5.15.0
Using aws-eventstream 1.2.0
Using aws-partitions 1.547.0
Using jmespath 1.5.0
Using faraday-em_http 1.0.0
Using faraday-em_synchrony 1.0.0
Using multipart-post 2.1.1
Using faraday-net_http 1.0.1
Using faraday-rack 1.0.0
Using faraday-retry 1.0.3
Using ruby2_keywords 0.0.5
Using concurrent-ruby 1.1.9
Using racc 1.6.0
Using timeliness 0.3.10
Fetching unf_ext 0.0.8
Using faraday-excon 1.1.0
Using connection_pool 2.2.5
Using azure_info 0.1.5
Using faraday-net_http_persistent 1.2.0
Using faraday-httpclient 1.0.1
Using bundler 2.3.4
Using faraday-patron 1.0.0
Using text-table 1.2.4
Using zeitwerk 2.5.3
Using deep_merge 1.2.2
Using diff-lcs 1.5.0
Using rainbow 3.1.1
Using eventmachine 1.2.7
Using graph 2.10.0
Using memoist 0.16.2
Using tilt 2.0.10
Using rexml 3.2.5
Using rspec-support 3.10.3
Using rubyzip 2.3.2
Using thor 1.2.1
Using tty-tree 0.4.0
Using net-http-persistent 4.0.1
Using faraday-multipart 1.0.3
Using i18n 1.8.11
Using eventmachine-tail 0.6.5
Using nokogiri 1.13.1 (x86_64-linux)
Using aws-sigv4 1.4.0
Using rhcl 0.1.0
Using dsl_evaluator 0.1.3
Using aws-sdk-core 3.125.3
Using rspec-core 3.10.1
Using aws-sdk-kms 1.53.0
Using rspec-mocks 3.10.2
Using faraday 1.9.3
Using tzinfo 2.0.4
Using hcl_parser 0.2.1
Using rspec-expectations 3.10.1
Using activesupport 7.0.1
Using faraday_middleware 1.2.0
Using cli-format 0.2.1
Using aws-sdk-s3 1.111.1
Using render_me_pretty 0.8.4
Using terraspace-bundler 0.4.4
Using ms_rest 0.7.6
Using azure-storage-common 2.0.4
Using rspec 3.10.0
Using azure-storage-blob 2.0.3
Using rspec-terraspace 0.3.1
Using terraspace 1.0.0
Installing unf_ext 0.0.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/unf_ext-0.0.8/ext/unf_ext
/opt/terraspace/embedded/bin/ruby -I /opt/terraspace/embedded/lib/ruby/3.0.0 -r
./siteconf20220113-5050-syt68u.rb extconf.rb
checking for -lstdc++... *** 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
        --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=/opt/terraspace/embedded/bin/$(RUBY_BASE_NAME)
        --with-static-libstdc++
        --without-static-libstdc++
        --with-stdc++-dir
        --without-stdc++-dir
        --with-stdc++-include
        --without-stdc++-include=${stdc++-dir}/include
        --with-stdc++-lib
        --without-stdc++-lib=${stdc++-dir}/lib
        --with-stdc++lib
        --without-stdc++lib
/opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:482:in `try_do': The compiler failed to
generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:575:in `try_link0'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:593:in `try_link'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:812:in `try_func'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:1040:in `block in have_library'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:982:in `block in checking_for'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:331:in `open'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:331:in `open'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:981:in `checking_for'
        from /opt/terraspace/embedded/lib/ruby/3.0.0/mkmf.rb:1035:in `have_library'
        from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found
here:

/opt/terraspace/embedded/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/unf_ext-0.0.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/unf_ext-0.0.8 for inspection.
Results logged to
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/unf_ext-0.0.8/gem_make.out

  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/builder.rb:93:in `run'
/opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in `block in
build'
  /opt/terraspace/embedded/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/builder.rb:159:in `build_extension'
/opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/builder.rb:193:in `block in
build_extensions'
  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `each'
  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `build_extensions'
  /opt/terraspace/embedded/lib/ruby/3.0.0/rubygems/installer.rb:845:in `build_extensions'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/source/rubygems.rb:204:in
`install'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/installer/gem_installer.rb:54:in
`install'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/worker.rb:62:in
`apply_func'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/worker.rb:57:in
`block in process_queue'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/worker.rb:54:in
`loop'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/worker.rb:54:in
`process_queue'
/opt/terraspace/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.3.4/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing unf_ext (0.0.8), and Bundler cannot continue.

In Gemfile:
  terraspace_plugin_azurerm was resolved to 0.4.0, which depends on
    azure_mgmt_resources was resolved to 0.18.2, which depends on
      ms_rest_azure was resolved to 0.12.0, which depends on
        faraday-cookie_jar was resolved to 0.0.7, which depends on
          http-cookie was resolved to 1.0.4, which depends on
            domain_name was resolved to 0.5.20190701, which depends on
              unf was resolved to 0.1.4, which depends on
                unf_ext
LoadError: cannot load such file -- terraspace_plugin_azurerm
ERROR: Unable to require plugin terraspace_plugin_azurerm
Are you sure you the plugin exists and you specified the right plugin option.
You specified --plugin azurerm

LoadError: cannot load such file -- terraspace_plugin_azurerm
ERROR: Unable to require plugin terraspace_plugin_azurerm

Checklist

  • Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Windows 10 with WSL2 Ubuntu, all most recent versions
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
Detected Terrspace version: 1.0.0
Detected Terraform v1.1.3

@boristyukin boristyukin added the bug Something isn't working label Jan 13, 2022
@tongueroo tongueroo added the help wanted Extra attention is needed label Jan 13, 2022
@tongueroo
Copy link
Contributor

Looks like terraspace_plugin_azurerm requires that unf_ext gem but the other plugins do not. And unf_ext gem is having trouble installing on the Windows WSL2 Linux env. What's in: /opt/terraspace/embedded/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/unf_ext-0.0.8/mkmf.log

gem install unf_ext

Guessing it's probably a missing development header library. Guessing that the ubuntu version on the Windows WSL2 is missing it. Unsure if installing the development header outside of opt will allow it to work.

Am interested in Windows WSL2. Think going to provide docs with terraspace and Windows WSL2. Have seen more and more folks in other projects like Jets using WSL2. So hopefully that's a way for windows users to use terraspace.

@boristyukin
Copy link
Author

thanks @tongueroo, yes WSL2 is super popular lately for sure!

this is the content of mkmf.log file:

"gcc -o conftest -I/opt/terraspace/embedded/include/ruby-3.0.0/x86_64-linux -I/opt/terraspace/embedded/include/ruby-3.0.0/ruby/backward -I/opt/terraspace/embedded/include/ruby-3.0.0 -I. -I/opt/terraspace/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -g -pipe -I/opt/terraspace/embedded/include   -I/opt/terraspace/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -g -pipe -fPIC conftest.c  -L. -L/opt/terraspace/embedded/lib -Wl,-rpath,/opt/terraspace/embedded/lib -L/opt/terraspace/embedded/lib -Wl,-rpath,/opt/terraspace/embedded/lib -L. -Wl,-rpath,/opt/terraspace/embedded/lib -L/opt/terraspace/embedded/lib -fstack-protector-strong -rdynamic -Wl,-export-dynamic -L/opt/terraspace/embedded/lib  -Wl,-rpath,/opt/terraspace/embedded/lib     -Wl,-rpath,/opt/terraspace/embedded/lib -L/opt/terraspace/embedded/lib -lruby  -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

@boristyukin
Copy link
Author

boristyukin commented Jan 13, 2022

@tongueroo looks like it works now!

I had to run that in WSL2 on Ubuntu and it seems that it did the trick:

sudo apt-get install build-essential
sudo apt-get install libxml2-dev libsqlite3-dev zlib1g-dev liblzma-dev

but I think I also installed terraspace using gem install terraspace when I was troubleshooting why example did not work with standalone terraspace installer

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

No branches or pull requests

2 participants