I have a Rails 3.2.14 app that deploys and operates fine on a production server. I'm working on deploying it to another server to test changes before I push out to production. I'm running the latest version of passenger/nginx and using Capistrano 2.12.0 with Ruby 1.9.3-p194 due to this being a legacy app and I'm trying to mimic the environment.
I can deploy the app without a problem, but it won't spawn passenger and start up the app.
Here's one of the errors I get in /var/log/nginx/error.log
[ 2014-08-10 07:09:08.7782 733/7f2626fb2700 Pool2/Implementation.cpp:284 ]: Could not spawn process for application /home/d
eploy/exigencad/current: An error occured while starting up the preloader.
Error ID: aa5360f9
Error details saved to: /tmp/passenger-error-0aEhJZ.html
Message from application: cannot load such file -- bundler/setup (LoadError)
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
[ 2014-08-10 07:09:08.7874 733/7f2624c8d700 agents/HelperAgent/RequestHandler.h:2305 ]: [Client 20] Cannot checkout session
because a spawning error occurred. The identifier of the error is . Please see earlier logs for details about the error.
App 1521 stdout:
App 1521 stdout:
I noticed an error about bundler but I did install the bundler gem, and here's my output running as deploy user or root user:
bundle -v
Bundler version 1.1.4
Here's the specific error log file for passenger
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="Phusion Passenger">
<title>Web application could not be started</title>
<style type="text/css">
body {
font-family: Verdana, 'Bitstream Vera Sans', Arial, Sans-Serif;
font-size: 10pt;
background: white;
color: #222222;
margin: 0;
padding-top: 3em;
padding-bottom: 3em;
padding-left: 4.5em;
padding-right: 4.5em;
}
h1 {
font-size: 17pt;
font-weight: medium;
color: #533e72;
border-bottom: 1px solid #533e72;
}
h1.title {
margin-top: 0;
}
h1.error_title {
color: red;
border-bottom: 1px solid red;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
dt {
font-weight: bold;
color: #280050;
}
dd {
margin-top: 0.5em;
margin-bottom: 1em;
}
.commands {
border: 1px solid #b594e7;
background: #ddc6ff;
padding: 0.5em;
margin: 0.5em;
font-family: 'Bitstream Vera Sans Mono', 'Courier New', Monospace;
}
pre {
overflow: auto;
white-space: pre-wrap;
text-align: left;
}
table.backtrace th {
background: #8470a6;
color: white;
}
table.backtrace th,
table.backtrace td {
padding: 0.2em;
padding-left: 0.4em;
padding-right: 0.4em;
}
table.backtrace tr td {
background: #ecdfff;
}
table.backtrace tr.even td {
background: #f7f2ff;
}
table.backtrace td.index {
font-weight: bold;
}
#site_footer {
border-top: solid 1px black;
margin-top: 1em;
padding-top: 1em;
font-size: small;
color: #777777;
}
#site_footer a {
color: #65498e;
}
#site_footer a:hover {
color: #9681d9;
}
#site_header .corporate_identity {
display: none;
}
</style>
<link rel="stylesheet" type="text/css" href="http://www.modrails.com/error_pages/1.0/error_page.css">
<style type="text/css">
dd {
text-align: left;
}
dd pre {
margin-top: 0;
margin-bottom: 0;
}
</style>
</head>
<body>
<div id="site_container">
<div id="site_header">
<ul class="corporate_identity">
<li class="logo"><span>Phusion Passenger</span></li>
</ul>
</div>
<div id="site_body">
<h1 class="error_title">Web application could not be started</h1>
<div id="content">
<pre>cannot load such file -- bundler/setup (LoadError)
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:<wbr>36:<wbr>in `require'
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:<wbr>36:<wbr>in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>263:<wbr>in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>366:<wbr>in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>261:<wbr>in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>100:<wbr>in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>158:<wbr>in `<module:<wbr>App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>29:<wbr>in `<module:<wbr>PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>28:<wbr>in `<main>'
</pre>
<dl>
<dt>Error ID</dt>
<dd>aa5360f9</dd>
<dt>Application root</dt>
<dd>/home/deploy/exigencad/current</dd>
<dt>Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)</dt>
<dd>production</dd>
<dt>Ruby interpreter command</dt>
<dd><pre>/home/deploy/.rbenv/shims/ruby</pre></dd>
<dt>User and groups</dt>
<dd><pre>uid=<wbr>1000(deploy) gid=<wbr>1000(deploy) groups=<wbr>1000(deploy),<wbr>27(sudo)
</pre></dd>
<dt>Environment variables</dt>
<dd><pre>RBENV_VERSION =<wbr> 1.9.3-p194
TERM =<wbr> xterm-256color
SHELL =<wbr> /bin/bash
PYTHONUNBUFFERED =<wbr> 1
PASSENGER_DEBUG_DIR =<wbr> /tmp/passenger.spawn-debug.XXXX3H8hx2
SERVER_PORT =<wbr> 80
USER =<wbr> deploy
DOCUMENT_ROOT =<wbr> /home/deploy/exigencad/current/public
SCGI =<wbr> 1
RBENV_ROOT =<wbr> /home/deploy/.rbenv
REQUEST_URI =<wbr> /
IN_PASSENGER =<wbr> 1
RACK_ENV =<wbr> production
RBENV_HOOK_PATH =<wbr> :<wbr>/home/deploy/.rbenv/rbenv.d:<wbr>/usr/local/etc/rbenv.d:<wbr>/etc/rbenv.d:<wbr>/usr/lib/rbenv/hooks
REMOTE_PORT =<wbr> 64649
PATH =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/bin:<wbr>/home/deploy/.rbenv/libexec:<wbr>/home/deploy/.rbenv/plugins/ruby-build/bin:<wbr>/usr/local/sbin:<wbr>/usr/local/bin:<wbr>/sbin:<wbr>/bin:<wbr>/usr/sbin:<wbr>/usr/bin
WSGI_ENV =<wbr> production
PWD =<wbr> /home/deploy/exigencad/current
LANG =<wbr> en_US.UTF-8
NODE_PATH =<wbr> /usr/share/passenger/node
NODE_ENV =<wbr> production
REMOTE_ADDR =<wbr> 75.89.97.25
SERVER_NAME =<wbr> prod.hcems.com
HOME =<wbr> /home/deploy
SHLVL =<wbr> 0
RAILS_ENV =<wbr> production
RBENV_DIR =<wbr> /usr/share/passenger/helper-scripts
SERVER_SOFTWARE =<wbr> nginx/1.6.0
LOGNAME =<wbr> deploy
QUERY_STRING =<wbr>
SERVER_ADDR =<wbr> 72.14.181.99
SERVER_PROTOCOL =<wbr> HTTP/1.1
PASSENGER_APP_ENV =<wbr> production
REQUEST_METHOD =<wbr> GET
</pre></dd>
<dt>Ulimits</dt>
<dd><pre>Unknown</pre></dd>
<dt>System metrics</dt>
<dd><pre>------------- General -------------
Kernel version :<wbr> 3.15.4-x86_64-linode45
Uptime :<wbr> 14h 3m 25s
Load averages :<wbr> 0.01%,<wbr> 0.22%,<wbr> 0.27%
Fork rate :<wbr> unknown
------------- CPU -------------
Number of CPUs :<wbr> 4
Average CPU usage :<wbr> 0% -- 0% user,<wbr> 0% nice,<wbr> 0% system,<wbr> 100% idle
CPU 1 :<wbr> 0% -- 0% user,<wbr> 0% nice,<wbr> 0% system,<wbr> 100% idle
CPU 2 :<wbr> 0% -- 0% user,<wbr> 0% nice,<wbr> 0% system,<wbr> 100% idle
CPU 3 :<wbr> 0% -- 0% user,<wbr> 0% nice,<wbr> 0% system,<wbr> 100% idle
CPU 4 :<wbr> 0% -- 0% user,<wbr> 0% nice,<wbr> 0% system,<wbr> 100% idle
I/O pressure :<wbr> 0%
CPU 1 :<wbr> 0%
CPU 2 :<wbr> 0%
CPU 3 :<wbr> 0%
CPU 4 :<wbr> 0%
Interference from other VMs:<wbr> 0%
CPU 1 :<wbr> 0%
CPU 2 :<wbr> 0%
CPU 3 :<wbr> 0%
CPU 4 :<wbr> 0%
------------- Memory -------------
RAM total :<wbr> 4002 MB
RAM used :<wbr> 205 MB (5%)
RAM free :<wbr> 3797 MB
Swap total :<wbr> 255 MB
Swap used :<wbr> 0 MB (0%)
Swap free :<wbr> 255 MB
Swap in :<wbr> unknown
Swap out :<wbr> unknown
</pre></dd>
<dt>General Ruby interpreter information</dt>
<dd><pre>RUBY_VERSION =<wbr> 1.9.3
RUBY_PLATFORM =<wbr> x86_64-linux
RUBY_ENGINE =<wbr> ruby
RubyGems version =<wbr> 1.8.23
RubyGems paths =<wbr> ["/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1",<wbr> "/home/deploy/.gem/ruby/1.9.1"]
</pre></dd>
<dt>Ruby configuration (RbConfig::CONFIG)</dt>
<dd><pre>DESTDIR =<wbr>
MAJOR =<wbr> 1
MINOR =<wbr> 9
TEENY =<wbr> 1
PATCHLEVEL =<wbr> 194
INSTALL =<wbr> /usr/bin/install -c
EXEEXT =<wbr>
prefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194
ruby_install_name =<wbr> ruby
RUBY_INSTALL_NAME =<wbr> ruby
RUBY_SO_NAME =<wbr> ruby
exec =<wbr> exec
ruby_pc =<wbr> ruby-1.9.pc
PACKAGE =<wbr> ruby
BUILTIN_TRANSSRCS =<wbr> newline.c
USE_RUBYGEMS =<wbr> YES
MANTYPE =<wbr> doc
NROFF =<wbr> /usr/bin/nroff
vendorhdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/vendor_ruby
sitehdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/site_ruby
rubyhdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1
UNIVERSAL_INTS =<wbr>
UNIVERSAL_ARCHNAMES =<wbr>
configure_args =<wbr> '--prefix=<wbr>/home/deploy/.rbenv/versions/1.9.3-p194' 'LDFLAGS=<wbr>-L/home/deploy/.rbenv/versions/1.9.3-p194/lib ' 'CPPFLAGS=<wbr>-I/home/deploy/.rbenv/versions/1.9.3-p194/include '
vendordir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
sitedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
ruby_version =<wbr> 1.9.1
sitearch =<wbr> x86_64-linux
arch =<wbr> x86_64-linux
RI_BASE_NAME =<wbr> ri
ridir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/ri
rubylibprefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby
MAKEFILES =<wbr> Makefile
THREAD_MODEL =<wbr> pthread
SYMBOL_PREFIX =<wbr>
EXPORT_PREFIX =<wbr>
COMMON_HEADERS =<wbr>
COMMON_MACROS =<wbr>
COMMON_LIBS =<wbr>
MAINLIBS =<wbr>
ENABLE_SHARED =<wbr> no
DLDLIBS =<wbr> -lc
SOLIBS =<wbr>
LIBRUBYARG_SHARED =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib
LIBRUBYARG_STATIC =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
LIBRUBYARG =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
LIBRUBY =<wbr> libruby-static.a
LIBRUBY_ALIASES =<wbr> libruby.so
LIBRUBY_SO =<wbr> libruby.so.1.9.1
LIBRUBY_A =<wbr> libruby-static.a
RUBYW_INSTALL_NAME =<wbr>
rubyw_install_name =<wbr>
LIBRUBY_DLDFLAGS =<wbr>
LIBRUBY_LDSHARED =<wbr> gcc -shared
warnflags =<wbr> -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
debugflags =<wbr> -ggdb
optflags =<wbr> -O3
cxxflags =<wbr> -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
cflags =<wbr> -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
cppflags =<wbr> -I/home/deploy/.rbenv/versions/1.9.3-p194/include
NULLCMD =<wbr> :<wbr>
INSTALLDOC =<wbr> all
CAPITARGET =<wbr> nodoc
RDOCTARGET =<wbr> rdoc
EXECUTABLE_EXTS =<wbr>
ARCHFILE =<wbr>
LIBRUBY_RELATIVE =<wbr> no
EXTOUT =<wbr> .ext
PREP =<wbr> miniruby
TEST_RUNNABLE =<wbr> yes
setup =<wbr> Setup
EXTSTATIC =<wbr>
STRIP =<wbr> strip -S -x
TRY_LINK =<wbr>
LIBPATHENV =<wbr> LD_LIBRARY_PATH
RPATHFLAG =<wbr> -Wl,<wbr>-R%1$-s
LIBPATHFLAG =<wbr> -L%1$-s
LINK_SO =<wbr>
LIBEXT =<wbr> a
DLEXT2 =<wbr>
DLEXT =<wbr> so
LDSHAREDXX =<wbr> g++ -shared
LDSHARED =<wbr> gcc -shared
CCDLFLAGS =<wbr> -fPIC
STATIC =<wbr>
ARCH_FLAG =<wbr>
DLDFLAGS =<wbr>
ALLOCA =<wbr>
WERRORFLAG =<wbr> -Werror
CHDIR =<wbr> cd -P
RMALL =<wbr> rm -fr
RMDIRS =<wbr> rmdir --ignore-fail-on-non-empty -p
RMDIR =<wbr> rmdir --ignore-fail-on-non-empty
CP =<wbr> cp
RM =<wbr> rm -f
PKG_CONFIG =<wbr> pkg-config
DOXYGEN =<wbr>
DOT =<wbr>
MAKEDIRS =<wbr> /bin/mkdir -p
MKDIR_P =<wbr> /bin/mkdir -p
INSTALL_DATA =<wbr> /usr/bin/install -c -m 644
INSTALL_SCRIPT =<wbr> /usr/bin/install -c
INSTALL_PROGRAM =<wbr> /usr/bin/install -c
SET_MAKE =<wbr>
LN_S =<wbr> ln -s
NM =<wbr> nm
DLLWRAP =<wbr>
WINDRES =<wbr>
OBJCOPY =<wbr> objcopy
OBJDUMP =<wbr> objdump
ASFLAGS =<wbr>
AS =<wbr> as
AR =<wbr> ar
RANLIB =<wbr> ranlib
try_header =<wbr>
COUTFLAG =<wbr> -o
OUTFLAG =<wbr> -o
CPPOUTFILE =<wbr> -o conftest.i
GNU_LD =<wbr> yes
GCC =<wbr> yes
EGREP =<wbr> /bin/grep -E
GREP =<wbr> /bin/grep
CPP =<wbr> gcc -E
CXXFLAGS =<wbr> -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
CXX =<wbr> g++
OBJEXT =<wbr> o
CPPFLAGS =<wbr> -I/home/deploy/.rbenv/versions/1.9.3-p194/include -I/home/deploy/.rbenv/versions/1.9.3-p194/include
LDFLAGS =<wbr> -L. -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -rdynamic -Wl,<wbr>-export-dynamic
CFLAGS =<wbr> -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
CC =<wbr> gcc
target_os =<wbr> linux
target_vendor =<wbr> unknown
target_cpu =<wbr> x86_64
target =<wbr> x86_64-unknown-linux-gnu
host_os =<wbr> linux-gnu
host_vendor =<wbr> unknown
host_cpu =<wbr> x86_64
host =<wbr> x86_64-unknown-linux-gnu
RUBYW_BASE_NAME =<wbr> rubyw
RUBY_BASE_NAME =<wbr> ruby
build_os =<wbr> linux-gnu
build_vendor =<wbr> unknown
build_cpu =<wbr> x86_64
build =<wbr> x86_64-unknown-linux-gnu
RUBY_RELEASE_DATE =<wbr> 2012-04-20
RUBY_PROGRAM_VERSION =<wbr> 1.9.3
BASERUBY =<wbr> echo executable host ruby is required. use --with-baseruby option.;<wbr> false
target_alias =<wbr>
host_alias =<wbr>
build_alias =<wbr>
LIBS =<wbr> -lpthread -lrt -ldl -lcrypt -lm
ECHO_T =<wbr>
ECHO_N =<wbr> -n
ECHO_C =<wbr>
DEFS =<wbr>
mandir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/man
localedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/locale
libdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib
psdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
pdfdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
dvidir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
htmldir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
infodir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/info
docdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
oldincludedir =<wbr> /usr/include
includedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include
localstatedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/var
sharedstatedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/com
sysconfdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/etc
datadir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share
datarootdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share
libexecdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/libexec
sbindir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/sbin
bindir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/bin
exec_prefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194
PACKAGE_URL =<wbr>
PACKAGE_BUGREPORT =<wbr>
PACKAGE_STRING =<wbr>
PACKAGE_VERSION =<wbr>
PACKAGE_TARNAME =<wbr>
PACKAGE_NAME =<wbr>
PATH_SEPARATOR =<wbr> :<wbr>
SHELL =<wbr> /bin/bash
rubylibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
archdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
sitelibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
sitearchdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
vendorlibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
vendorarchdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
topdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
</pre></dd>
<dt>Ruby load path ($LOAD_PATH)</dt>
<dd><pre>/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
</pre></dd>
<dt>Ruby loaded libraries ($LOADED_FEATURES)</dt>
<dd><pre>enumerator.so
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/defaults.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/deprecate.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/exceptions.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/etc.so
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/fileutils.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tmpdir.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpio.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/operating_system.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/version.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/requirement.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/platform.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/specification.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/path_support.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/ruby.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/binary_compatibility.rb
/home/deploy/.passenger/native_support/4.0.48/ruby-1.9.3-x86_64-linux/passenger_native_support.so
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/socket.so
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/socket.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/thread.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/ruby_core_enhancements.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpdir.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/constants.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/debug_logging.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/shellwords.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/shellwords.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/fcntl.so
/usr/lib/ruby/vendor_ruby/phusion_passenger/message_channel.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/message_client.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/native_support_utils.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/unseekable_socket.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/stringio.so
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tee_input.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/connection.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/transaction.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils/lock.rb
/usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/core.rb
</pre></dd>
</dl>
</div>
</div>
<div id="site_footer">
<!--
You are free to modify the footer as you see fit,
but we kindly ask of you to preserve to following
text. Thank you.
-->
<div class="container">
Powered by Phusion Passenger,
<tt>mod_rails</tt> / <tt>mod_rack</tt> for Apache and Nginx.
</div>
</div>
</div>
</body>
</html>
Here's my capistrano deploy.rb in case it helps (note, working on production server, but when I change the IP to the staging server it deploys but doesn't run rake tasks or whenever gem to set crontab):
require "bundler/capistrano"
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
server "72.14.181.01", :web, :app, :db, primary: true
set :application, "appname"
set :user, "deploy"
set :deploy_to, "/home/#{user}/#{application}"
#set :deploy_via, :remote_cache
set :use_sudo, false
set :rails_env, "production"
set :scm, "git"
set :repository, "git#github.com:appguy/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy:update", "gps_listener:restart"
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
end
end
namespace :gps_listener do
task :start do
run "#{sudo} start app-gps"
end
task :stop do
run "#{sudo} stop app-gps"
end
task :restart do
run "#{sudo} stop app-gps && sleep 1 && #{sudo} start app-gps"
end
end
task :after_update_code do
run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake gps:listen"
end
I'll admit, it's been a long time (1-2 years) since I've had to bootstrap a new server so recreating this legacy app with new versions of passenger/nginx is proving troublesome. I'm not sure if it's an issue with passenger itself or if it's a ruby issue.
Here's my passenger config for nginx btw:
/etc/nginx/nginx.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
Here's my default virtual host for /etc/nginx/site-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name prod.hcems.com;
passenger_enabled on;
rails_env production;
root /home/deploy/exigencad/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
It looks like the problem was with my .bashrc file.
I had the following at the bottom of the file:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
Which was not setting my rbenv environment variable. Once I moved it to the top of .bashrc I could deploy without an error. And passenger now spins up the application.
My whenever gem doesn't seem to be working (setting my crontab for rake tasks), but I'll open another question regarding that.
Related
I'm trying to compile cpputest with mingw-w64 but can't make it work and I can't find any resources on how to do that. So hopefully this question will help others in the future.
I would like to compile cpputest using mingw-w64, preferably without installing MSYS2 or other packages.
I have mingw-w64 i686-8.1.0-posix-dwarf-rt_v6-rev0 installed. I've cloned cpputest from here.
I tried following Compiling Google test with Mingw-w64 and Compiling and using CppUTest 3.8 under MSYS2/MinGW32 by calling CMake with:
cmake ^
-G "MinGW Makefiles" ^
-D CMAKE_C_COMPILER=gcc.exe ^
-D CMAKE_CXX_COMPILER=g++.exe ^
-D CMAKE_MAKE_PROGRAM=mingw32-make.exe ^
-D C++11=ON ^
.
Which yields:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe
CXX: C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -Wno-c++14-compat
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: ON
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Running make fails with:
>mingw32-make.exe
Scanning dependencies of target CppUTest
[ 1%] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj
In file included from C:/git/tdd/cpputest/include/CppUTest/Utest.h:34,
from C:/git/tdd/cpputest/include/CppUTest/TestHarness.h:39,
from C:\git\tdd\cpputest\src\CppUTest\CommandLineArguments.cpp:29:
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
C:/git/tdd/cpputest/include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
mingw32-make.exe[2]: *** [src\CppUTest\CMakeFiles\CppUTest.dir\build.make:63: src/CppUTest/CMakeFiles/CppUTest.dir/CommandLineArguments.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:886: src/CppUTest/CMakeFiles/CppUTest.dir/all] Error 2
mingw32-make.exe: *** [Makefile:140: all] Error 2
I tried the obvious solution of adding cstddef to SimpleString.h:
--- a/include/CppUTest/SimpleString.h
+++ b/include/CppUTest/SimpleString.h
## -180,6 +180,9 ## SimpleString BracketsFormattedHexString(SimpleString hexString);
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
+
+#include <cstddef>
+
SimpleString StringFrom(const nullptr_t value);
#endif
But that still fails with the same error.
So I tried following Build error with CMake and MSYS2 mingw-w64 by installing MSYS2 and then mingw-w64, CMake and Ninja. That gives:
-------------------------------------------------------
CppUTest Version 3.8
Current compiler options:
CC: C:/msys64/mingw64/bin/cc.exe
CXX: C:/msys64/mingw64/bin/c++.exe
CppUTest CFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Wstrict-prototypes
CppUTest CXXFLAGS: -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast
CppUTest LDFLAGS:
Features configured in CppUTest:
Memory Leak Detection: ON
Compiling Extensions: ON
Support Long Long: OFF
Use CppUTest flags: ON
Using Standard C library: ON
Using Standard C++ library: ON
Using C++11 library: OFF
Generating map file: OFF
Compiling with coverage: OFF
Compile and run self-tests ON
Run self-tests separately OFF
-------------------------------------------------------
Compiling with cmake -G Ninja . && ninja fails with:
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
[10/98] Building CXX object src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
FAILED: src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DCPPUTEST_HAVE_STRDUP=1 -DHAVE_CONFIG_H -D_TIMESPEC_DEFINED=1 -I. -Iinclude -Isrc/CppUTest/../../include -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "C:/git/tdd/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h" -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -O2 -g -DNDEBUG -MD -MT src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -MF src\CppUTest\CMakeFiles\CppUTest.dir\TestMemoryAllocator.cpp.obj.d -o src/CppUTest/CMakeFiles/CppUTest.dir/TestMemoryAllocator.cpp.obj -c src/CppUTest/TestMemoryAllocator.cpp
In file included from include/CppUTest/Utest.h:34,
from include/CppUTest/TestHarness.h:39,
from src/CppUTest/TestMemoryAllocator.cpp:28:
include/CppUTest/SimpleString.h:183:31: error: 'nullptr_t' does not name a type
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
include/CppUTest/SimpleString.h:183:31: note: 'nullptr_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
include/CppUTest/SimpleString.h:42:1:
+#include <cstddef>
include/CppUTest/SimpleString.h:183:31:
SimpleString StringFrom(const nullptr_t value);
^~~~~~~~~
ninja: build stopped: subcommand failed.
Thanks!!
Turns out this was a bug in CppUtest.
## -562,7 +562,7 ## SimpleString BracketsFormattedHexString(SimpleString hexString)
* Specifically nullptr_t is not officially supported
*/
#if __cplusplus > 199711L && !defined __arm__
- SimpleString StringFrom(const nullptr_t value)
+ SimpleString StringFrom(const std::nullptr_t value)
{
(void) value;
return "(null)";
It's fixed since Dec. 5th, 2019.
https://github.com/leonardopsantos/cpputest/commit/cb8c457dda6741ede7009103db99967b5f27c969
On Raspbian Stretch Lite, November 2018 version,
with following Qt5 GUI application:
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel label("Hello world !");
label.show();
return app.exec();
}
and following project file:
######################################################################
# Automatically generated by qmake (3.0) Tue Mar 5 01:53:35 2019
######################################################################
TEMPLATE = app
QT += widgets
TARGET = hello
INCLUDEPATH += .
# Input
SOURCES += hello.cpp
I've made as follows:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/arm-linux-gnueabihf/qt5 -isystem /usr/include/arm-linux-gnueabihf/qt5/QtWidgets -isystem /usr/include/arm-linux-gnueabihf/qt5/QtGui -isystem /usr/include/arm-linux-gnueabihf/qt5/QtCore -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o hello.o hello.cpp
g++ -Wl,-O1 -o hello hello.o -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lpthread
Then, execute it, I've get following error message:
./hello
QXcbConnection: Could not connect to display
Aborted
Does anyone know how can I configure my Qt Gui application running on the EGL or FB directory without X? Thank you for your help!
I'm trying to write a makefile to compile Objective-C with Cocoa on Linux.
I have installed the following packages:
sudo apt-get install gnustep gnustep-devel
I started with a minimal makefile, which compiles successfully:
FLAGS = $(shell gnustep-config --objc-flags)
LIBS = $(shell gnustep-config --base-libs)
all:
gcc $(FLAGS) HelloWorld.m $(LIBS) -o a.out
Here is the sole source file:
#include <Foundation/Foundation.h>
int main(int argc, const char* argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(#"Hello, World!");
[pool drain];
return 0;
}
Now I'm trying to write a more elaborate makefile but I haven't been able to get it working yet:
CC = gcc
SOURCES=HelloWorld.m
OBJECTS=$(SOURCES:.m=.o)
CFLAGS=-c $(shell gnustep-config --objc-flags)
LIBRARIES = $(shell gnustep-config --base-libs)
FRAMEWORKS:= -framework Foundation -framework Cocoa -framework AppKit
LDFLAGS=$(LIBRARIES) $(FRAMEWORKS)
EXECUTABLE=a.out
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
.m.o:
$(CC) $(CFLAGS) $(LIBRARIES) $< -o $#
Output:
$ make
gcc -rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -shared-libgcc -shared-libgcc -pthread -fexceptions -fgnu-runtime -L/home/brett/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -lgnustep-base -lobjc -lm -framework Foundation -framework Cocoa -framework AppKit HelloWorld.o -o a.out
gcc: error: Foundation: No such file or directory
gcc: error: Cocoa: No such file or directory
gcc: error: AppKit: No such file or directory
gcc: error: unrecognized command line option ‘-framework’
gcc: error: unrecognized command line option ‘-framework’
gcc: error: unrecognized command line option ‘-framework’
Makefile:14: recipe for target 'a.out' failed
make: *** [a.out] Error 1
Gcc version:
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3) gnustep-config --base-libs
$ gnustep-config --objc-flags
-MMD -MP -Wdate-time -D_FORTIFY_SOURCE=2 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fdebug-prefix-map=/build/gnustep-make-1owDvd/gnustep-make-2.6.8=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -fdebug-prefix-map=/build/gnustep-make-1owDvd/gnustep-make-2.6.8=. -fstack-protector-strong -Wformat -Werror=format-security -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/home/brett/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep
$ gnustep-config --base-libs
-rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -shared-libgcc -shared-libgcc -pthread -fexceptions -fgnu-runtime -L/home/brett/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -lgnustep-base -lobjc -lm
brett#brett-desktop:~/Git/Mandelbrot/Mandelbrot2$ gnustep-config --base-libsgnustep-config --base-libs
Actually I think I see the problem, my gnustep-config --base-libs outputs -L/home/brett/GNUstep/Library/Libraries which does not exist in my environment. I will update if I figure out how to properly install the libraries.
It appears as if the gnustep-devel package only installed the docs:
$ dpkg-query -L gnustep-devel
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/gnustep-devel
/usr/share/doc/gnustep-devel/copyright
/usr/share/doc/gnustep-devel/changelog.gz
I found some files under /usr/share/GNUstep but no Foundation.h:
$ find . -name *.h
./Makefiles/TestFramework/ObjectTesting.h
./Makefiles/TestFramework/Testing.h
You may want to try this :
CC = gcc
SOURCES=HelloWorld.m
OBJECTS=$(SOURCES:.m=.o)
CCFLAGS=`gnustep-config --objc-flags` -c
OBJCLIBS=`gnustep-config --objc-libs` -lgnustep-base
EXECUTABLE=a.out
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) -o $# $^ $(OBJCLIBS)
%.o : %.m
$(CC) $(CCFLAGS) -o $# -c $<
I did not check in detail but with your makefile all "-I" directives are missing like this :
-I/usr/local/include/GNUstep -I/usr/include/GNUstep
While I was trying to build Plasma5 on Ubuntu Trusty, I got an issue related to eglibc 2.19.
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(lstat64.oS): In function ``lstat64':
(.text+0xc): undefined reference to ``__lxstat64'
I have no idea how to fix this. Thanks.
Edit
Appended -v to g++ and ld, got:
COLLECT_GCC=/etc/alternatives/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.0-3ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=gcc4-compatible --disable-libstdcxx-dual-abi --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-fPIC' '-pipe' '-D' 'QT_STRICT_ITERATORS' '-D' 'QURL_NO_CAST_FROM_STRING' '-D' 'QT_NO_HTTP' '-D' 'QT_NO_FTP' '-Wformat=1' '-Werror=format-security' '-Werror=return-type' '-Wno-variadic-macros' '-Wlogical-op' '-Wmissing-include-dirs' '-std=c++11' '-std=c++11' '-fno-exceptions' '-Wall' '-Wextra' '-Wcast-align' '-Wchar-subscripts' '-Wformat-security' '-Wno-long-long' '-Wpointer-arith' '-Wundef' '-Wnon-virtual-dtor' '-Woverloaded-virtual' '-Werror=return-type' '-Wpedantic' '-g' '-shared' '-o' 'baloosearch.so' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8S8VVK.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -shared -z relro -o baloosearch.so /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -v --no-undefined --fatal-warnings --enable-new-dtags -soname baloosearch.so CMakeFiles/kio_baloosearch.dir/kio_search.cpp.o CMakeFiles/kio_baloosearch.dir/kio_baloosearch_automoc.cpp.o /opt/kde/install/lib/x86_64-linux-gnu/libKF5KIOCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 ../../lib/libKF5Baloo.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5Service.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5FileMetaData.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5ConfigCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5.20.0 /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5Core.so.5.5.1 -rpath /opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/lib:/opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/build/baloo/src/engine: -rpath-link /opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/engine -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
collect2 version 5.3.0 20151204
/usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8S8VVK.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -shared -z relro -o baloosearch.so /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -v --no-undefined --fatal-warnings --enable-new-dtags -soname baloosearch.so CMakeFiles/kio_baloosearch.dir/kio_search.cpp.o CMakeFiles/kio_baloosearch.dir/kio_baloosearch_automoc.cpp.o /opt/kde/install/lib/x86_64-linux-gnu/libKF5KIOCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 ../../lib/libKF5Baloo.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5Service.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5FileMetaData.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5I18n.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5ConfigCore.so.5.20.0 /opt/kde/install/lib/x86_64-linux-gnu/libKF5CoreAddons.so.5.20.0 /opt/Qt5.5.1/5.5/gcc_64/lib/libQt5Core.so.5.5.1 -rpath /opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/lib:/opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/build/baloo/src/engine: -rpath-link /opt/Qt5.5.1/5.5/gcc_64/lib:/opt/kde/install/lib/x86_64-linux-gnu:/opt/kde/build/baloo/src/engine -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
GNU ld (GNU Binutils for Ubuntu) 2.24
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(lstat64.oS): In function `lstat64':
(.text+0xc): undefined reference to `__lxstat64'
collect2: error: ld returned 1 exit status
I ran into the exact same problem trying to do the exact same thing. I don't know if this is a good solution, but I found three ways to fix this problem.
run the compile command and add
"/usr/lib/x86_64-linux-gnu/libc_nonshared.a" to it
run the compile command and add "-lc" to it
the best solution if you're using kdesrc-build is to add the option to the baloo module in your .kdesrc-buildrc like this:
options baloo
cmake-options -DCMAKE_CXX_FLAGS="-lc"
end options
After some hoops and hurdles I was able to build and run Plasma 5 on Ubuntu 14.04 and will probably write a guide on how to do it.
I am pretty certain this bug should have been solved a long time ago in previous versions of g++, but in my case I still see this when giving the command:
std::this_thread::sleep_for(std::chrono::milliseconds(10))
the error message I get is:
In member function ‘long long int Iterator::next()’:
error: ‘std::this_thread’ has not been declared
Make sure you have the C+11 flag and that you include "thread" in your header.
std::this_thread is in C++11. Use -std=c++11 flag.
#include <thread>
#include <chrono>
int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
compile:
g++ test.cpp --std=c++11 -g -Wall
version:
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5.2.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.2.0 (GCC)