Missing linux/types.h failing to install gem - header

I'm getting an error trying to install eventmachine on my ubuntu 12.04 server. Any ideas?
bundle exec gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
make
g++ -I. -I/opt/local/include -I. -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -DWITH_SSL -DBUILD_FOR_RUBY -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -c binder.cpp
In file included from /usr/include/i386-linux-gnu/bits/sigcontext.h:28:0,
from /usr/include/signal.h:339,
from project.h:40,
from binder.cpp:20:
/usr/include/i386-linux-gnu/asm/sigcontext.h:5:25: fatal error: linux/types.h: No such file or directory
compilation terminated.
make: *** [binder.o] Error 1

I've just run into the same problem. Either the path for types.h is different on your distribution, or it does not exist at all. Try to manually include it.
http://linux.die.net/include/sys/types.h
Your program is going to give you a file, and line number error where it is trying to "include" types.h. What I did to solve the problem, was add types.h into the same folder as the file requesting it. Then you go into the file, on the line that the include error is, and replace the path of (for example) "/linux/types.h", with "types.h" since you have it in the same directory. Now, make, make install. If you receive another include issue, you might want to consider either changing flavors, or if you feel up to it, keep adding includes. Welcome to the wonderful world of hacking. :)

Related

How to fix libtool: undefined symbols not allowed in x86_64-pc-msys shared

I am trying to build heimdal package for msys2. To my dismay, during linking of the first constituent library, roken, dlls fail to be built, and that causes sort of a chain reaction further on.
The only message i get is:
libtool: undefined symbols not allowed in x86_64-pc-msys shared ... only static will be built
however, there is no information provided on what symbols are undefined. How can i find that out?
If i turn on output of commands wuth make V=1 i get libtool command that links from a large numbert of .lo files. If i try to run gcc over them (copying command from there), it does not recognize them as anything.
I am trying to follow instructions as outlined in msys2 package build script for heimdal.
On Windows building a shared library while allowing undefined symbols is not allowed.
Try to build with the -Wl,-no-undefined linker flag, for example by adding LDFLAGS="-Wl,-no-undefined" to the ./configure command.
If that didn't work try this after ./configure and before make:
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool
If you already had a failed build earlier you should also clean up any .la files like this before running make again:
rm $(find -name '*.la')

Building wget with clang/llvm

I downloaded the source files for wget and tried to compile it with Clang. I want to configure with the link time optimization (-flto). At first, I simply tried:
./configure CC=clang CFLAGS=-flto
make
The configuration was successful, but I could not run make which output:
/tmp/lto-llvm-4f0f02.o:ld-temp.o:function _do_handshake: error: undefined reference to 'rpl_fcntl'
and other numerous similar errors, all of the same format (error: undefined reference to xxx).
So I thought I needed to link the files correctly. After searching for answers, I then tried all of the following commands:
./configure CC=clang CFLAGS=-flto LDFLAGS=-flto
make
-----------------------------------------------
./configure CC=clang CFLAGS=-flto LDFLAGS="-fuse-ld=lld-4.0"
make
-----------------------------------------------
./configure CC=clang CFLAGS=-flto LDFLAGS="-fuse-ld=gold"
make
But I am still getting the same error.
I am running this on Debian-9.5. What am I missing?
You need to also specify the specific ar utility to use - the default ar and ranlib produce .a files that are unusable for linking (no entries to use), so for me this worked:
./configure CC=clang-4.0 CFLAGS=-flto AR=llvm-ar-4.0 RANLIB=llvm-ranlib-4.0
You may get away with just llvm-ar, without the version postfix, but you need to ensure that the clang, ar, and ranlib versions match, otherwise you encounter other errors.

Building Apache on Mountain Lion libtool problems

I'm trying to install apache from source on my mac. But keep running into problems. I've tried a ton of different things and just can't get this to build.
First, I couldn't configure without errors so I reinstalled apache apr. Now, I can configure but when I run make, I get this error:
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
I tried this to add in the libtool tag:
./configure LIBTOOL='/usr/local/bin/glibtool --tag=CC'
And this still gave the same error. I read that mountain lions glibtool is the unix-like libtool so that's why I tried this here. Still to no avail. I also tried symlinking the libtool that make uses to other versions on my machine, still to no avail, as I got the same error.
Here's what the make command runs, I tried symlinking /usr/share/apr-1/build-1/libtool
/usr/share/apr-1/build-1/libtool --silent --mode=compile /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 -std=gnu99 -O2 -arch x86_64 -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/opt/local/include -I/opt/X11/include -I. -I/usr/local/src/httpd-2.4.3/os/unix -I/usr/local/src/httpd-2.4.3/include -I/usr/include/apr-1 -I/usr/local/include -I/usr/local/src/httpd-2.4.3/modules/aaa -I/usr/local/src/httpd-2.4.3/modules/cache -I/usr/local/src/httpd-2.4.3/modules/core -I/usr/local/src/httpd-2.4.3/modules/database -I/usr/local/src/httpd-2.4.3/modules/filters -I/usr/local/src/httpd-2.4.3/modules/ldap -I/usr/local/src/httpd-2.4.3/modules/loggers -I/usr/local/src/httpd-2.4.3/modules/lua -I/usr/local/src/httpd-2.4.3/modules/proxy -I/usr/local/src/httpd-2.4.3/modules/session -I/usr/local/src/httpd-2.4.3/modules/ssl -I/usr/local/src/httpd-2.4.3/modules/test -I/usr/local/src/httpd-2.4.3/server -I/usr/local/src/httpd-2.4.3/modules/arch/unix -I/usr/local/src/httpd-2.4.3/modules/dav/main -I/usr/local/src/httpd-2.4.3/modules/generators -I/usr/local/src/httpd-2.4.3/modules/mappers -prefer-non-pic -static -c exports.c && touch exports.lo
This still didn't work.
Finally, I got further if I ran configure like this, ./configure --with-apr='/usr/local/src/apr/apr-config (where I installed the system, but this is still broken.) This got me further but it still wouldn't finish make, and gave me a ton of errors like this.
exports.c:1809: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1141: error: previous definition of 'ap_hack_apr_version_string' was here
I finally figured it out ...
For anyone having trouble installing apache on Mountain Lion, it looks like the default LIBTOOLS in the source's build/config_vars.mk file is the wrong location.
I reinstalled LIBTOOLS with homebrew (which put it at /usr/local/bin/glibtool) and set this as the variable and all worked fine.

How to compile rabbitmq-c library on Mac OS X?

I'm failing to compiled the rabbitmq-c library on Mac OS 10.6.6
I intend to build the php-ampq extension against it.
I've tried both the latest branch of rabbitmq-c and rabbitmq-codegen according to the instructions here and the specific branches according to the instructions here.
Running autoreconf -i as per instructions I get:
glibtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
glibtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:12: installing `./config.sub'
configure.ac:12: required file `./ltmain.sh' not found
configure.ac:3: installing `./missing'
configure.ac:3: installing `./install-sh'
configure.ac:12: installing `./config.guess'
examples/Makefile.am: installing `./depcomp'
autoreconf: automake failed with exit status: 1
Running simply autoconf I get:
configure.ac:3: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:12: error: possibly undefined macro: AM_PROG_LIBTOOL
configure.ac:90: error: possibly undefined macro: AM_CONDITIONAL
Most of what I can find by searching online suggests I don't have libtool or automake. I have both.
I'm afraid I'm out of my depth with autoconf, so I don't know how/where to alter configure.ac, or whether the warning is anything do with the missing ltmain.sh file.
I solved the same problem by installing pkg-config:
sudo port install pkgconfig

upgrade to osx lion, bundler gets native extension errors - no such file or directory

I am having a problem that has had me stuck for a day and a half, and I would like some assistance.
I have been moving my latest rails 3 app between my iMac and my macbook pro, with a simple copy, and up till now, I have had no problems.
fyi, I use rvm to manage my project versions.
I got a new iMac, with lion installed, and everything seemed to be good until I ran the bundle update on it. Since then I have not been able to get the bundler to work. The problems crop up when building a gem native extension.
Once I run the bundle update, nothing works on my iMac (osx lion) machine. I can continue to run bundle update on my laptop (Snow Leopard).
So I would like to be able to continue to develop on my Lion machine. Here is what I have done so far:
Initially, I got some errors about my compilers, but since I have reinstalled xcode and run the installer, I no longer those errors.
I still continued to get errors on my nokogiri build. At one point I followed some blog instructions ( and did:
sudo port upgrade --enforce-variants libxml2 +universal
but it seemed to make no difference to building nokogiri.
Now when I do the bundle update, I am getting:
Installing nokogiri (1.5.0) with native extensions /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
make
gcc-4.2 -I. -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -I. -DHAVE_XMLHASFEATURE -DHAVE_XMLFIRSTELEMENTCHILD -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/libxml2 -I/usr/local/include/libxml2 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/libxml2 -I/opt/local/include -I/usr/local/include -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include -I/usr/include -I/usr/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -o html_document.o -c html_document.c
make: gcc-4.2: No such file or directory
make: *** [html_document.o] Error 1
Gem files will remain installed in /Users/tayloredwebsites/.rvm/gems/ruby-1.9.2-p136#current/gems/nokogiri-1.5.0 for inspection.
After doing this waaaay too many times, I decided to remove capybara and lanuchy from my Gemfile, so that I would get past this error. Lo and behold, bundle update gives me another failure to build a native extension:
Installing sqlite3 (1.3.5) with native extensions /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile
make
gcc-4.2 -I. -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -I. -DHAVE_RB_PROC_ARITY -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_BACKUP_INIT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o backup.o -c backup.c
make: gcc-4.2: No such file or directory
make: *** [backup.o] Error 1
So it appears that I am getting a no such file error on my builds, for the same set of code, with the basic difference that one machine is on Lion, and the other is on Snow Leopard.
So maybe someone can help me with these questions:
In my investigations, I noticed that in the nokogiri build, libxml2 is being asked for in 3 places (two of which do not exist!!!!). Anyone know how to control how to control these arguments, so that I can remove the ones that do not exist?
When I looked at the sqlite3 build, I did not notice any missing files, yet I seem to be still getting them. Could this be hung over from the nokogiri problem? If so, does anyone know how I clear these out?
I would like to know what file is missing, and I cant seem to find it in the error message. Is there any way to get debugger detail from the bundle update?
also I noticed that in the make, the include directory contains a directory named with an older version of ruby. This has been this way for quite a while, without any problems, so I suspect this will not be the problem here, but just wanted to point it out.
There is literally no such file or directory gcc-4.2 on Lion. I got stuck on this when trying to "rvm install ruby-1.9.3" which failed similar to what you report. A fix was to specify the CC command like this "CC=gcc rvm install ruby-1.9.3". If the CC=gcc option cannot be passed through to bundler, it might be simpler to "sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2" and just create the symlink it is looking for.
I have reinstalled everything on my OSX Lion. I upgraded to Server to get past some postgres issues. Note when I installed rvm, one of the steps is to run;
$ rvm requirements
which returns, among other things:
Xcode 4.2: * is only supported by ruby 1.9.3+ using command line
flag: --with-gcc=clang * it breaks gems with native extensions,
especially DB drivers.
Xcode 4.2.1+ users - please be warned - in case of any compilation
issues * downgrade to Xcode 4.1 * uninstall Xcode and install
osx-gcc-installer and reinstall your rubies.
Note: if you uninstall Xcode, you lose the standard MacPort Xcode setup.
Note you can build MacPorts from source using gcc - not tried (at least yet).
ln -s /usr/bin/gcc /usr/bin/gcc-4.2
I had built my ruby-1.9.3 with clang so when installing the nokogiri gem I used CC=clang gem install nokogiri -v '1.5.5' which worked for me.