Debian Squeeze on Thinkpad X121e installation notes

Here are some notes on installing Debian Squeeze on a Thinkpad X121e. Before following this guide, check the system details (at the end of this post) to see if you have the same model of graphics card, wifi, ethernet, etc.

Installation notes

The ethernet card is not detected by the Debian installer, so at the first opportunity flip to a console, load the atl1c driver, and echo this magic string:

modprobe atl1c
echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id

(credit: http://wiki.debian.org/InstallingDebianOn/Thinkpad/X121e-30515YG)

Wrong resolution in xorg

The installation process runs ok but on rebooting the screen resolution in xorg was 1024×768 instead of 1366×768 so everything looked weird and squashed. Upgrading to a 3.2 kernel fixes the problem. Add this line to /etc/apt/sources.list:

deb http://backports.debian.org/debian-backports squeeze-backports main

then install the new kernel:

sudo apt-get update
sudo apt-get install -t squeeze-backports  linux-image-3.2.0-0.bpo.2-amd64  # (previously said: linux-image-2.6.39-bpo.2-amd64 which is wrong)

After rebooting into the new kernel the resolution should be ok. If graphics are slow (e.g. moving an xterm flickers) then also grab the backported xorg packages:

sudo apt-get install -t squeeze-backports xorg xserver-xorg xserver-xorg-core 
xserver-xorg-input-all xserver-xorg-video-all

Broadcom wifi driver

Getting the Broadcom wifi driver to work with the 3.2 kernel was not completely straightforward. The Debian Wiki says to install the broadcom-sta-source model and then compile it with module-assist:

sudo apt-get install broadcom-sta-source
sudo apt-get install module-assistant
sudo m-a prepare

Getting source for kernel version: 3.2.0-0.bpo.2-amd64
apt-get install kernel-headers-3.2.0-0.bpo.2-amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package kernel-headers-3.2.0-0.bpo.2-amd64
E: Couldn't find any package by regex 'kernel-headers-3.2.0-0.bpo.2-amd64'

This fails because the backported kernel header package is not called kernel-headers-3.2.0-0.bpo.2-amd64; it is actually linux-headers-3.2.0-0.bpo.2-amd64. Fortunately we can install the headers ourselves:

sudo apt-get install -t squeeze linux-headers-3.2.0-0.bpo.2-amd64

Now try the module-assist again:

sudo m-a update
sudo m-a a-i broadcom-sta

However we are compiling against the 3.2 kernel, and the broadcom-sta package in Squeeze is not new enough. It failed with an error about C pointers (sorry, forgot to save the details). However, happysumo on Whirlpool had a similar issue and suggested temporarily updating to the testing distribution. So edit /etc/apt/sources.list and change squeeze to testing, then

sudo apt-get update
sudo apt-get install broadcom-sta-source
sudo m-a update
sudo m-a a-i broadcom-sta

This successfully built the module. Then edit /etc/apt/sources.list again and change testing back to squeeze and do an update:

sudo apt-get update

After a reboot the built-in ethernet and wifi both worked.

VirtualBox

The version of VirtualBox in Squeeze is not new enough to compile against a 3.2 kernel, so just grab the 4.x release from www.virtualbox.org.

Where’s the Insert key!?

I think it’s strange that there is no Insert key on the X121e. According to this post there are some key combos to get the missing keys:

Fn + I = Insert
Fn + P = Pause
Fn + B = Break
Fn + S = Scroll Lock

System info

Output of “lspci -v”:

00:00.0 Host bridge: Intel Corporation Sandy Bridge DRAM Controller (rev 09)
	Subsystem: Lenovo Device 21ed
	Flags: bus master, fast devsel, latency 0
	Capabilities: [e0] Vendor Specific Information: Len=0c 
	Kernel driver in use: agpgart-intel

00:02.0 VGA compatible controller: Intel Corporation Sandy Bridge Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
	Subsystem: Lenovo Device 21ed
	Flags: bus master, fast devsel, latency 0, IRQ 42
	Memory at d0000000 (64-bit, non-prefetchable) [size=4M]
	Memory at c0000000 (64-bit, prefetchable) [size=256M]
	I/O ports at 4000 [size=64]
	Expansion ROM at  [disabled]
	Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [d0] Power Management version 2
	Capabilities: [a4] PCI Advanced Features
	Kernel driver in use: i915

00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)
	Subsystem: Lenovo Device 21ed
	Flags: bus master, fast devsel, latency 0, IRQ 11
	Memory at d1605000 (64-bit, non-prefetchable) [size=16]
	Capabilities: [50] Power Management version 3
	Capabilities: [8c] MSI: Enable- Count=1/1 Maskable- 64bit+

00:1a.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04) (prog-if 20 [EHCI])
	Subsystem: Lenovo Device 21ed
	Flags: bus master, medium devsel, latency 0, IRQ 16
	Memory at d160a000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
	Kernel driver in use: ehci_hcd

00:1b.0 Audio device: Intel Corporation Cougar Point High Definition Audio Controller (rev 04)
	Subsystem: Lenovo Device 21ed
	Flags: bus master, fast devsel, latency 0, IRQ 41
	Memory at d1600000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [130] Root Complex Link
	Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 1 (rev b4) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Lenovo Device 21ed
	Capabilities: [a0] Power Management version 2
	Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 2 (rev b4) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
	Memory behind bridge: d1500000-d15fffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Lenovo Device 21ed
	Capabilities: [a0] Power Management version 2
	Kernel driver in use: pcieport

00:1c.2 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 3 (rev b4) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=03, subordinate=07, sec-latency=0
	I/O behind bridge: 00003000-00003fff
	Memory behind bridge: d0d00000-d14fffff
	Prefetchable memory behind bridge: 00000000d0400000-00000000d0bfffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Lenovo Device 21ed
	Capabilities: [a0] Power Management version 2
	Kernel driver in use: pcieport

00:1c.5 PCI bridge: Intel Corporation Cougar Point PCI Express Root Port 6 (rev b4) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=08, subordinate=08, sec-latency=0
	I/O behind bridge: 00002000-00002fff
	Memory behind bridge: d0c00000-d0cfffff
	Capabilities: [40] Express Root Port (Slot+), MSI 00
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
	Capabilities: [90] Subsystem: Lenovo Device 21ed
	Capabilities: [a0] Power Management version 2
	Kernel driver in use: pcieport

00:1d.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
	Subsystem: Lenovo Device 21ed
	Flags: bus master, medium devsel, latency 0, IRQ 23
	Memory at d1609000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
	Kernel driver in use: ehci_hcd

00:1f.0 ISA bridge: Intel Corporation Cougar Point LPC Controller (rev 04)
	Subsystem: Lenovo Device 21ed
	Flags: bus master, medium devsel, latency 0
	Capabilities: [e0] Vendor Specific Information: Len=0c 

00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 04) (prog-if 01 [AHCI 1.0])
	Subsystem: Lenovo Device 21ed
	Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 40
	I/O ports at 4088 [size=8]
	I/O ports at 4094 [size=4]
	I/O ports at 4080 [size=8]
	I/O ports at 4090 [size=4]
	I/O ports at 4060 [size=32]
	Memory at d1608000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
	Capabilities: [70] Power Management version 3
	Capabilities: [a8] SATA HBA v1.0
	Capabilities: [b0] PCI Advanced Features
	Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation Cougar Point SMBus Controller (rev 04)
	Subsystem: Lenovo Device 21ed
	Flags: medium devsel, IRQ 18
	Memory at d1604000 (64-bit, non-prefetchable) [size=256]
	I/O ports at efa0 [size=32]

02:00.0 Network controller: Broadcom Corporation Device 0576 (rev 01)
	Subsystem: Broadcom Corporation Device 0576
	Flags: bus master, fast devsel, latency 0, IRQ 17
	Memory at d1500000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
	Capabilities: [58] Vendor Specific Information: Len=78 
	Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [d0] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [13c] Virtual Channel
	Capabilities: [160] Device Serial Number 00-00-12-ff-ff-dc-ac-81
	Capabilities: [16c] Power Budgeting 
	Kernel driver in use: wl

03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5209 (rev 01)
	Subsystem: Lenovo Device 21ed
	Flags: bus master, fast devsel, latency 0, IRQ 18
	Memory at d0d00000 (32-bit, non-prefetchable) [size=4K]
	Capabilities: [40] Power Management version 3
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [70] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [140] Device Serial Number 00-00-00-01-00-4c-e0-00
	Kernel driver in use: rts_pstor

08:00.0 Ethernet controller: Atheros Communications Device 1083 (rev c0)
	Subsystem: Lenovo Device 21f2
	Flags: bus master, fast devsel, latency 0, IRQ 43
	Memory at d0c00000 (64-bit, non-prefetchable) [size=256K]
	I/O ports at 2000 [size=128]
	Capabilities: [40] Power Management version 3
	Capabilities: [48] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [58] Express Endpoint, MSI 00
	Capabilities: [6c] Vital Product Data
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [180] Device Serial Number ff-0f-c2-94-04-7d-7b-ff
	Kernel driver in use: atl1c

cat /proc/cpuinfo:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping	: 7
microcode	: 0x1b
cpu MHz		: 800.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 2793.59
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping	: 7
microcode	: 0x1b
cpu MHz		: 800.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 2793.64
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping	: 7
microcode	: 0x1b
cpu MHz		: 800.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 2793.66
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
stepping	: 7
microcode	: 0x1b
cpu MHz		: 800.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 2793.65
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

Archived Comments

Date: 2012-07-24 11:50:28 UTC

Author: steve rinsler

your command for installing a 3.2 kernel specifies 2.6.39?? Isn’t that a mistake/typo?

Date: 2012-08-03 09:06:57 UTC

Author: carlo

Steve,

Thanks, I’ve updated the instructions to refer to the 3.2 kernel.

insserv: warning: script ‘K01vmware’ missing LSB tags and overrides

Note to self: if apt-get dist-upgrade explodes on Debian Squeeze with the error

Setting up initscripts (2.88dsf-13.1+squeeze1) ...
insserv: warning: script 'K01vmware' missing LSB tags and overrides
insserv: warning: script 'S50vmware-USBArbitrator' missing LSB tags and overrides
insserv: warning: script 'vmware-USBArbitrator' missing LSB tags and overrides
insserv: warning: script 'vmware' missing LSB tags and overrides
insserv: There is a loop between service rmnologin and mountnfs if started
insserv:  loop involving service mountnfs at depth 8

(more output snipped)

Then follow the instructions of post rldleblanc at http://communities.vmware.com/thread/337769:

rldleblanc
35 posts since
05-Aug-2005


7. 05-Dec-2011 11:14   in response to: SamSpade
Re: Vmware Player Prevents Aptitude from Installing Debian Packages
Probably a cleaner way to approach this is to use /etc/insserv/overrides.
Do the following:

Create /etc/insserv/overrides/vmware with the following:

### BEGIN INIT INFO
# Provides:          vmware
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 5
# Default-Stop:      2 3 5
# Short-Description: VMware VMX service for virtual machines
# Description:       Allows running of VMware virtual machines.
### END INIT INFO

Create /etc/insserv/overrides/vmware-USBArbitrator with the following:

### BEGIN INIT INFO
# Provides:          vmware-USBArbitrator
# Required-Start:    $remote_fs $syslog vmware
# Required-Stop:     $remote_fs $syslog vmware
# Default-Start:     2 3 5
# Default-Stop:      2 3 5
# Short-Description: Start daemon when vmware starts
# Description:       Enable service provided by daemon.
### END INIT INFO

Then run 'chmod +x /etc/insserv/overrides/vmware*

This prevents the fix from being broken with an update to the shipped init.d
script and my fix your USB problem. Since I don't use USB in a VM, I can't
test it.

Robert

R, MAKEFLAGS, rpath, and building packages

On our HPC at work we need to build various libraries and packages from source, and install them to custom locations. Putting everything in /usr/local is not an option because of dependencies on particular versions of various libraries (and many of these packages are not available through the distro’s package manager). While building RODBC for a colleague I encountered a problem with library paths:

library(RODBC)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
   unable to load shared object
'/opt/RODBC/RODBC_1.3-5/RODBC/libs/RODBC.so':
   libodbc.so.1: cannot open shared object file: No such file or directory
Error: package/namespace load failed for ‘RODBC’

The author of the package claimed that the solution is in the documentation, but I disagree. For the benefit of anyone who comes across this problem, here’s a log of how I debugged the problem.

First try to build with no options at all. Fails because it can’t find sql.h, as expected:

carlo@r500:/opt/src/RODBC> R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz
* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
configure: error: "ODBC headers sql.h and sqlext.h not found"
ERROR: configuration failed for package ‘RODBC’
* removing ‘/opt/RODBC/RODBC_1.3-5/RODBC’
* restoring previous ‘/opt/RODBC/RODBC_1.3-5/RODBC’

Now set location for ODBC library, using environment variables, as per the documentation:

export ODBC_INCLUDE=$ODBC_ROOT/include
export ODBC_LIBS=$ODBC_ROOT/lib

carlo@r500:/opt/src/RODBC> R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz
* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking sqlext.h usability... yes
checking sqlext.h presence... yes
checking for sqlext.h... yes
checking for library containing SQLTables... -lodbc
checking for SQLLEN... yes
checking for SQLULEN... yes
checking for long... yes
checking size of long... configure: error: cannot compute sizeof (long), 77
See `config.log' for more details.
ERROR: configuration failed for package ‘RODBC’
* removing ‘/opt/RODBC/RODBC_1.3-5/RODBC’
* restoring previous ‘/opt/RODBC/RODBC_1.3-5/RODBC’

This error is an error itself; the problem is actually with linking against libodbc. The usual Unix way is to set LDFLAGS, so let’s try that:

export LDFLAGS="-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib"
R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz

* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
ERROR: configuration failed for package ‘RODBC’
* removing ‘/opt/RODBC/RODBC_1.3-5/RODBC’
* restoring previous ‘/opt/RODBC/RODBC_1.3-5/RODBC’

Perhaps not. After reading more, I found that “R CMD INSTALL” can make use of the MAKEFLAGS environment variable, in which whitespaces have to be escaped (how odd). So let’s turn off LDFLAGS and try with that:

unset LDFLAGS
MAKEFLAGS='LDFLAGS=-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib' R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz

carlo@r500:/opt/src/RODBC> MAKEFLAGS='LDFLAGS=-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib' R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz
* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking sqlext.h usability... yes
checking sqlext.h presence... yes
checking for sqlext.h... yes
checking for library containing SQLTables... -lodbc
checking for SQLLEN... yes
checking for SQLULEN... yes
checking for long... yes
checking size of long... configure: error: cannot compute sizeof (long), 77
See `config.log' for more details.
ERROR: configuration failed for package ‘RODBC’
* removing ‘/opt/RODBC/RODBC_1.3-5/RODBC’
* restoring previous ‘/opt/RODBC/RODBC_1.3-5/RODBC’

This still fails, so maybe we can try the LD_LIBRARY_PATH?

MAKEFLAGS='LD_LIBRARY_PATH=/opt/gcc/4.4.2/lib64:/opt/gcc/4.4.2/lib:/opt/odbc/odbc-2.3.0/lib LDFLAGS=-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib' R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz

* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking sqlext.h usability... yes
checking sqlext.h presence... yes
checking for sqlext.h... yes
checking for library containing SQLTables... -lodbc
checking for SQLLEN... yes
checking for SQLULEN... yes
checking for long... yes
checking size of long... configure: error: cannot compute sizeof (long), 77
See `config.log' for more details.
ERROR: configuration failed for package ‘RODBC’
* removing ‘/opt/RODBC/RODBC_1.3-5/RODBC’
* restoring previous ‘/opt/RODBC/RODBC_1.3-5/RODBC’

Nope, LD_LIBRARY_PATH is ignored when it’s inside MAKEFLAGS. Let’s be psychic and set it as a shell environment variable instead:

export LD_LIBRARY_PATH=/opt/gcc/4.4.2/lib64:/opt/gcc/4.4.2/lib:/opt/odbc/odbc-2.3.0/lib
MAKEFLAGS='LDFLAGS=-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib' R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz
* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking sqlext.h usability... yes
checking sqlext.h presence... yes
checking for sqlext.h... yes
checking for library containing SQLTables... -lodbc
checking for SQLLEN... yes
checking for SQLULEN... yes
checking for long... yes
checking size of long... 8
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/config.h
** libs
gcc -std=gnu99 -I/opt/R/2.14.0/lib64/R/include -I. -I/opt/odbc/odbc-2.3.0/include -I/usr/local/include    -fpic  -g -O2 -c RODBC.c -o RODBC.o
gcc -std=gnu99 -shared -L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib -o RODBC.so RODBC.o -lodbc -L/opt/odbc/odbc-2.3.0/lib -L/opt/R/2.14.0/lib64/R/lib -lR
installing to /opt/RODBC/RODBC_1.3-5/RODBC/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
*** tangling vignette sources ...
   ‘RODBC.Rnw’
** testing if installed package can be loaded

* DONE (RODBC)

Success. Note the “-Wl,-rpath” option which lets RODBC.so know where libodbc.so is, so that the end user running R doesn’t need to set any environment variables before loading RODBC.

In summary:

export ODBC_INCLUDE=$ODBC_ROOT/include
export ODBC_LIBS=$ODBC_ROOT/lib
export LD_LIBRARY_PATH=/opt/gcc/4.4.2/lib64:/opt/gcc/4.4.2/lib:/opt/odbc/odbc-2.3.0/lib
MAKEFLAGS='LDFLAGS=-L/opt/odbc/odbc-2.3.0/lib -Wl,-rpath /opt/odbc/odbc-2.3.0/lib' R CMD INSTALL -l /opt/RODBC/RODBC_1.3-5 RODBC_1.3-5.tar.gz

Further reading: http://www.eyrie.org/~eagle/notes/rpath.html

Archived Comments

Date: 2013-06-19 01:00:49 UTC

Author: Dhanesh Padmanabhan

Thanks. This was really useful. In my case, I also had to add an additional CPPFLAGS=-I. in MAKEFLAGS and that solved it.

Date: 2017-02-18 01:24:30.628406 UTC

Author: joshua

In case this helps anyone: the solution here did not work for me, but the one posted here did:

http://r.789695.n4.nabble.com/Problem-installing-RODBC-td2016736.html

Just need this: yum install unixODBC-devel