Subject: libmruby-dev: static library compield without -fPIC on x86_64
Package: libmruby-dev
Version: 1.0.0+20141015+gitb4cc962c-1
Severity: important
Tags: newcomer upstream
Dear Maintainer,
* What led up to the situation?
I was trying to compile a dynamic library (.so) that linked against
libmruby. libmruby comes as a static library (.a). For a dynamic
lib on x86_64, the -fPIC compiler flag needs to be used on all object
files. In my case this includes the object files in libmruby.a
* What exactly did you do (or not do) that was effective (or
ineffective)?
gcc -shared -o foo.so foo.o -lmruby -lm
* What was the outcome of this action?
on x86_64 gcc error message that all objects need to be compiled
with -fPIC. On i386 it worked.
* What outcome did you expect instead?
I'd expect all static libraries installed from -dev packages be
compiled with -fPIC on x86_64, since a random user project
may want to link them in a dynamic lib.
* My local hack to solve the problem
apt-get source libmruby-dev
edit build_config.rb: uncomment the "conf.cc do |cc|" line and its
"end", then add cc.flags = '-fPIC'
rebuild the package and install
Proposed solution: enable -fPIC on x86_64 only and/or also compile a
.so of the mruby lib.
* Upstream
Downloaded the official release pack for 1.0.0 and 1.0.1, they both
compiled without -fPIC by default, so the problem is present in
the upstream.
-- System Information:
Debian Release: 8.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)
-- no debconf information
Best regards,
Tibor Palinkas