I have issues starting a Ruby on Rails project - ruby-on-rails

I'm starting a new project but I have issues installing sqlite3 on my computer. What is the problem?
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20190428-9612-10i9sod.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for dlopen()... no
missing function dlopen
*** 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.
I have already installed Ruby, Rails, Bundle. But apparently, something is missing.

I had this error on my win7, and this was my solution:
type ridk exec pacman -S mingw-w64-x86_64-dlfcn and install
This should work if your install ruby in 'common' way. Like 'rubyinstaller'.

You can consider skipping SQLite altogether. The only reason Rails is setup for SQLite by default is that its easy to setup up on most systems. If not then its mostly a waste of time.
Its not really a viable option for deployment as its file based. This is especially if you want to deploy to cloud platforms such as Heroku which use ephemeral file systems.
You will want to develop and test on the same database that you are going to deploy to such as Postgres.
Differences between backing services mean that tiny incompatibilities
crop up, causing code that worked and passed tests in development or
staging to fail in production. These types of errors create friction
that disincentivizes continuous deployment. The cost of this friction
and the subsequent dampening of continuous deployment is extremely
high when considered in aggregate over the lifetime of an application.
https://12factor.net/dev-prod-parity

Related

Does Pivotal projectmonitor require Xcode?

My iMac(Mac OS Sierra V10.12) doesn't have Xcode. so I get below error during 'bundle install'. When I tried to install Xcode from AppStore, I realized it's of size 4 GB. SO just wanted to ensure I am not doing something wrong.
current directory:
/Users/xecckq4/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.11.1
/Users/xecckq4/.rbenv/versions/2.3.1/bin/ruby -r
./siteconf20170813-3495-gf683v.rb extconf.rb
Project ERROR: Xcode not set up properly. You may need to confirm the license
agreement by running /usr/bin/xcodebuild.
* extconf.rb failed *
extconf.rb configures the makefile that specifies all the things you'll need to build a gem. In your case, XCode is required, so yes, by all means, download and install it.
If you're on a Mac, you're probably going to be making use of Homebrew as well, which also depends on XCode (as do a number of other gems you'll run into sooner or later), so even if decided to ignore this issue, you'd need XCode sooner or later.

installing gnucobol on windows10

I have a problem with installing gnucobol 2.2.
I get an error message telling me there's no c compiler found. I run windows10 on my laptop
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether CFLAGS can be modified... yes
checking for gcc... no
checking for xlc... no
checking for cc... no
configure: error: in `/cygdrive/c/gnucobol-2.2-rc':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
can someone please help me with this problem?
thank you :)
Whilst not directly related to the "./configure" question, a general "easy" answer to "installing gnucobol on windows10" might be:
Use a package manager such as chocolatey
https://community.chocolatey.org/packages/gnucobol
This doesn't work at the moment due to an issue with the packaging, but generally speaking is likely the easiest "just install" option on native Windows
Install WSL and then "apt install gnucobol" in there.
WSL is "Windows Subsystem for Linux". See https://learn.microsoft.com/en-us/windows/wsl/install . The drawback of this approach is that if you're using gnucobol to create objects, libraries or executables (as opposed to just C code) then you'll get Linux objects, libraries or executables, which likely isn't what you want on Windows. However, for just getting access to the environment, it's likely the fastest way there.

warnings being treated as errors in rails

I have the following error when i try to make "bundle install" in my rails projects
C:/Ruby22/bin/ruby.exe -r ./siteconf20150427-5772-lng4pk.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
cc1.exe: warnings being treated as errors
In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
from ./byebug.h:4,
from breakpoint.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:319:44: error: 'struct timespec' declared inside parameter list
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:319:44: error: its scope is only this definition or declaration, which is probably not what you want
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:320:43: error: 'struct timespec' declared inside parameter list
make: *** [breakpoint.o] Error 1
make failed, exit code 2
i'm on windows 7, after research a lot, i find that i have to unset the option of take warnings as errors. Anyone knows where i can unset such option (in the makefile isn't possible because the makefile is a generated file)
This may not be what you want to hear. But I had this error a lot when I was developing RoR applications out of windows. I also had a plethora of other issues that have nothing to do with rails, and more to do with how Ruby interacts with the Windows OS. Ruby is very "Linuxy" in it's nature. Because of this, I would recommend using a virtual machine running linux ubuntu when developing using Ruby and Rails.
There is a great linux virtual machine called "Vagrant". It has been wonderful to use Ruby in. They have documentation on how to get up and running with Ruby found here:
https://www.vagrantup.com/
I hope this helps. I know switching to the Vagrant virtual machine helped me solve a lot of these futile problems that had nothing to do with writing the actual code.

Installing webkit for Capybara

I'm trying to install webkit for Capybara, using the information provided here, but I'm getting an error.
Following the instructions I have tried to change the qmake.conf file in the Qt installation directory but I couldn't find the QMAKE_IDC parameter and I don't know where the following values should be placed:
QMAKE_RCC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}rcc$${EXE_SUFFIX}
QMAKE_LFLAGS = -static-libgcc -static-libstdc++
The following error is what I got:
C:\Users\Deepzster\Desktop\app\app>gem install capybara-webkit
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe -r ./siteconf20141118-9536-wfpmna.rb extconf.rb
Command 'qmake -spec win32-g++ ' not available
Makefile not found
I had the same problem. I had installed the latest version of Qt, which is version 5.3. I looked up the instructions on https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit, and one of the instructions is to modify the qmake.conf file, and the edits are to be made after "the line beginning with QMAKE_IDC". However, this line wasn't available in my qmake.conf file.
Therefore, I installed the version stated in the instructions, which is version 4.8.5. Here's the link - http://download.qt-project.org/archive/qt/4.8/4.8.5/. I downloaded qt-win-opensource-4.8.5-mingw.exe (I'm on a Windows 7 64-bit machine).
The qmake.conf file in this version does have the line beginning with QMAKE_IDC, so I could edit it as required. I then followed the rest of the instructions up to step 10 on the link (I also tried step 11, but I got a 'make failed' error). I then went to the directory containing my Gemfile and entered
gem install capybara-webkit
and the installation was successful.
Make sure your qmake is added in system path, otherwise it will fail to install.
There is no qmake utility on your workstation, as indicated by this message:
Command 'qmake -spec win32-g++ ' not available
I may suggest you to install QT for Windows. If this already done here suggested readings.

How can I test my external API calls without having to push my code changes to my Ruby on Rails application?

Question Rephrase:
Can I configure my local web server to be connected to the public internet so that I can test my API calls locally?
Details: (edited)
I'm still looking for some help on this. It seems that there is a compatibility issue from what I can gather from many Google searches. Has anyone out there used the gem Proxylocal on a Windows machine? Did you need to perform any extra steps to get it to work because you were on a Windows machine?
I am using Ruby on Rails and Heroku for deployment.
I was pointed to Pow (pow.cx), but this only works on macs. I am running Windows 8. Does anyone have a suggestion for me? Thanks!
Update:
I was unable to install the proxylocal gem. I receive the following error upon entering gem install proxylocal in my command line prompt:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing proxylocal:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
make
generating decode-i386-mingw32.def
compiling decode.c
decode.c:3:24: fatal error: netinet/in.h: No such file or directory
compilation terminated.
make: *** [decode.o] Error 1
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bert-1.1.6 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bert-1.1.6/ext/bert/c/gem_make.out
And this is the contents of gem_make.out:
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
make
generating decode-i386-mingw32.def
compiling decode.c
decode.c:3:24: fatal error: netinet/in.h: No such file or directory
compilation terminated.
make: *** [decode.o] Error 1
Does anyone have an idea of what might be the issue here? I don't see any spaces in the paths I have my gems installed in, which seems to be a common cause to this error for a lot of people...
You can try the proxylocal gem
I was facing the same issue, but I found that, it's not proxylocal's problem, it's bert's problem, see the error log:
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bert-1.1.6 for inspection.
It's because with bert distribution, linux headers are being provided, I have posted here a solution for the same after testing it on my windows system. Please have a look and let me know, it you were able to solve it or not!

Resources