You are not logged in.

#1 2015-01-25 07:24:11

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Possible -fpic issue with glibc [solved]

I was compiling iperf3 at work on my 64-bit Arch setup when I came across this ominous message:

/usr/bin/ld: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: relocation R_X86_64_32S against `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: error adding symbols: Bad value

This persisted even after making sure all files in the project were built using -fpic.
gcrt1.o is part of the glibc runtime. None of my coworkers can reproduce this issue on other Linux distros, and Arch pushed out a glibc upgrade fairly recently (January 6). Could the latest glibc package have been accidentally compiled without -fpic or something?

It can't be dismissed as an oddity on one particular machine with one particular build, either. On my home machine (also 64-bit Arch), I have the same issue building iperf3. Also, attempting to compile any D program (including Hello World) with the reference compiler (DMD) is met with:

/usr/bin/ld: hi.o: relocation R_X86_64_32 against `<some symbol such as .deh_end or .rodata>' can not be used when making a shared object; recompile with -fPIC
hi.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1

The same happens when attempting to build a D program with LDC (the LLVM backend), but compilation is successful with GDC (the GCC backend).

Last edited by slavik262 (2015-01-25 22:19:54)

Offline

#2 2015-01-25 08:32:06

cargoan
Member
Registered: 2013-07-13
Posts: 20

Re: Possible -fpic issue with glibc [solved]

aur package builds ok. (https://aur.archlinux.org/packages/iperf3)

for last version (3.0.11) modify PKGBUILD file:

...
pkgver=3.0.10   ==> pkgver=3.0.11
...
sha1sums=('5340c08fcb72f1302a111fc635d42dcfff68ca0a')   ==> sha1sums=('19c90c048689b0f0af003bbcd328e7759e266c75')
...

Offline

#3 2015-01-25 08:45:09

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Re: Possible -fpic issue with glibc [solved]

Not on my machine:

libtool: link: gcc -pg -g -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Wall -pg -g -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -o .libs/iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o  ./.libs/libiperf.so
/usr/bin/ld: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: relocation R_X86_64_32S against `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:768: recipe for target 'iperf3_profile' failed
make[2]: *** [iperf3_profile] Error 1
make[2]: Leaving directory '/tmp/yaourt-tmp-mrkline/aur-iperf3/src/iperf-3.0.10/src'
Makefile:615: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/tmp/yaourt-tmp-mrkline/aur-iperf3/src/iperf-3.0.10/src'
Makefile:371: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Makepkg was unable to build iperf3.
==> Restart building iperf3 ? [y/N]
==> -------------------------------

I get the same when attempting to build from the gzipped tarball for 3.0.11 on the website. And as originally stated, the problem seems to be farther-reaching than just iperf3.

Last edited by slavik262 (2015-01-25 08:45:53)

Offline

#4 2015-01-25 09:56:24

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Possible -fpic issue with glibc [solved]

I just built it with the current gcc and clang from our repos.  It built just fine.

How are you building it?

Offline

#5 2015-01-25 10:00:52

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Re: Possible -fpic issue with glibc [solved]

Both with yaourt from the AUR package and via the tarball with configure then make.

Miscellaneous info:

~ % uname -a
Linux kline-arch 3.18.2-2-ARCH #1 SMP PREEMPT Fri Jan 9 07:37:51 CET 2015 x86_64 GNU/Linux
~ % gcc --version
gcc (GCC) 4.9.2 20141224 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ % yaourt -Qi gcc-multilib
Name           : gcc-multilib
Version        : 4.9.2-2
Description    : The GNU Compiler Collection - C and C++ frontends for multilib
Architecture   : x86_64
URL            : http://gcc.gnu.org
Licenses       : GPL  LGPL  FDL  custom
Groups         : multilib-devel
Provides       : gcc=4.9.2-2
Depends On     : gcc-libs-multilib=4.9.2-2  binutils>=2.25  libmpc
Optional Deps  : None
Required By    : clang  dkms  dmd  gdc
Optional For   : None
Conflicts With : gcc
Replaces       : None
Installed Size :  92.49 MiB
Packager       : Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Build Date     : Fri 26 Dec 2014 09:50:17 PM PST
Install Date   : Tue 06 Jan 2015 10:54:01 AM PST
Install Reason : Explicitly installed
Install Script : Yes
Validated By   : Signature

GCC is just the GCC-multilib from the official packages

Offline

#6 2015-01-25 10:11:51

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Possible -fpic issue with glibc [solved]

Hrm...  I just built it with gcc-multilib just to be sure.

Have you modified you CFLAGS etc in makepkg.conf?

Offline

#7 2015-01-25 11:17:41

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Re: Possible -fpic issue with glibc [solved]

Thanks for your help with this; it's as much of a mystery to me as it is to you. I've never touched makepkg.conf, but for the hell of it, these are my flags:

CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"

Those are applied only when building through AUR though, no? iperf3's source tarball gives me the same issue:

~ % cd /tmp
/tmp % curl -o src.tar.gz "http://downloads.es.net/pub/iperf/iperf-3.0.11.tar.gz"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  414k  100  414k    0     0  1240k      0 --:--:-- --:--:-- --:--:-- 1244k
/tmp % tar xf src.tar.gz 
/tmp % cd iperf-3.0.11 
/t/iperf-3.0.11 % ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
 73 checking whether gcc understands -c and -o together... yes
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking whether ln -s works... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/lib/hardening-wrapper/bin/ld
checking if the linker (/usr/lib/hardening-wrapper/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/lib/hardening-wrapper/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... (cached) ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -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 for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/lib/hardening-wrapper/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ANSI C header files... (cached) yes
checking for library containing nanosleep... none required
checking for library containing hstrerror... none required
checking for an ANSI C-conforming const... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/version.h
config.status: creating examples/Makefile
config.status: creating iperf3.spec
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
/t/iperf-3.0.11 % make
Making all in src
make[1]: Entering directory '/tmp/iperf-3.0.11/src'
make  all-am
make[2]: Entering directory '/tmp/iperf-3.0.11/src'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c -o cjson.lo cjson.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c  -fPIC -DPIC -o .libs/cjson.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c -o cjson.o >/dev/null 2>&1
mv -f .deps/cjson.Tpo .deps/cjson.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c -o iperf_api.lo iperf_api.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c iperf_api.c  -fPIC -DPIC -o .libs/iperf_api.o
iperf_api.c: In function ‘iperf_parse_arguments’:
iperf_api.c:641:3: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
   system("uname -a");
   ^
iperf_api.c: In function ‘diskfile_recv’:
iperf_api.c:2517:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  (void) write(sp->diskfile_fd, sp->buffer, r);
  ^
iperf_api.c: In function ‘iperf_reporter_callback’:
iperf_api.c:2177:3: warning: ‘end_time’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   cJSON_AddItemToObject(test->json_end, "sum", iperf_json_printf("start: %f  end: %f  seconds: %f  bytes: %d  bits_per_second: %f  jitter_ms: %f  lost_packets: %d  packets: %d  lost_percent: %f", (double) start_time, (double) end_time, (double) end_time, (int64_t) total_sent, bandwidth * 8, (double) avg_jitter * 1000.0, (int64_t) lost_packets, (int64_t) total_packets, (double) lost_percent));
   ^
iperf_api.c:2019:24: note: ‘end_time’ was declared here
     double start_time, end_time, avg_jitter = 0.0, lost_percent;
                        ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c iperf_api.c -o iperf_api.o >/dev/null 2>&1
mv -f .deps/iperf_api.Tpo .deps/iperf_api.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_error.lo -MD -MP -MF .deps/iperf_error.Tpo -c -o iperf_error.lo iperf_error.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_error.lo -MD -MP -MF .deps/iperf_error.Tpo -c iperf_error.c  -fPIC -DPIC -o .libs/iperf_error.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_error.lo -MD -MP -MF .deps/iperf_error.Tpo -c iperf_error.c -o iperf_error.o >/dev/null 2>&1
mv -f .deps/iperf_error.Tpo .deps/iperf_error.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_client_api.lo -MD -MP -MF .deps/iperf_client_api.Tpo -c -o iperf_client_api.lo iperf_client_api.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_client_api.lo -MD -MP -MF .deps/iperf_client_api.Tpo -c iperf_client_api.c  -fPIC -DPIC -o .libs/iperf_client_api.o
iperf_client_api.c: In function ‘iperf_run_client’:
iperf_client_api.c:365:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  system("uname -a");
  ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_client_api.lo -MD -MP -MF .deps/iperf_client_api.Tpo -c iperf_client_api.c -o iperf_client_api.o >/dev/null 2>&1
mv -f .deps/iperf_client_api.Tpo .deps/iperf_client_api.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_locale.lo -MD -MP -MF .deps/iperf_locale.Tpo -c -o iperf_locale.lo iperf_locale.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_locale.lo -MD -MP -MF .deps/iperf_locale.Tpo -c iperf_locale.c  -fPIC -DPIC -o .libs/iperf_locale.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_locale.lo -MD -MP -MF .deps/iperf_locale.Tpo -c iperf_locale.c -o iperf_locale.o >/dev/null 2>&1
mv -f .deps/iperf_locale.Tpo .deps/iperf_locale.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_server_api.lo -MD -MP -MF .deps/iperf_server_api.Tpo -c -o iperf_server_api.lo iperf_server_api.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_server_api.lo -MD -MP -MF .deps/iperf_server_api.Tpo -c iperf_server_api.c  -fPIC -DPIC -o .libs/iperf_server_api.o
iperf_server_api.c: In function ‘iperf_accept’:
iperf_server_api.c:131:10: warning: unused variable ‘cookie’ [-Wunused-variable]
     char cookie[COOKIE_SIZE];
          ^
iperf_server_api.c: In function ‘iperf_run_server’:
iperf_server_api.c:469:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  system("uname -a");
  ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_server_api.lo -MD -MP -MF .deps/iperf_server_api.Tpo -c iperf_server_api.c -o iperf_server_api.o >/dev/null 2>&1
mv -f .deps/iperf_server_api.Tpo .deps/iperf_server_api.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_tcp.lo -MD -MP -MF .deps/iperf_tcp.Tpo -c -o iperf_tcp.lo iperf_tcp.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_tcp.lo -MD -MP -MF .deps/iperf_tcp.Tpo -c iperf_tcp.c  -fPIC -DPIC -o .libs/iperf_tcp.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_tcp.lo -MD -MP -MF .deps/iperf_tcp.Tpo -c iperf_tcp.c -o iperf_tcp.o >/dev/null 2>&1
mv -f .deps/iperf_tcp.Tpo .deps/iperf_tcp.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_udp.lo -MD -MP -MF .deps/iperf_udp.Tpo -c -o iperf_udp.lo iperf_udp.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_udp.lo -MD -MP -MF .deps/iperf_udp.Tpo -c iperf_udp.c  -fPIC -DPIC -o .libs/iperf_udp.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_udp.lo -MD -MP -MF .deps/iperf_udp.Tpo -c iperf_udp.c -o iperf_udp.o >/dev/null 2>&1
mv -f .deps/iperf_udp.Tpo .deps/iperf_udp.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_util.lo -MD -MP -MF .deps/iperf_util.Tpo -c -o iperf_util.lo iperf_util.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_util.lo -MD -MP -MF .deps/iperf_util.Tpo -c iperf_util.c  -fPIC -DPIC -o .libs/iperf_util.o
iperf_util.c: In function ‘get_system_info’:
iperf_util.c:222:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
     fgets(buf, sizeof(buf), fp);
     ^
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_util.lo -MD -MP -MF .deps/iperf_util.Tpo -c iperf_util.c -o iperf_util.o >/dev/null 2>&1
mv -f .deps/iperf_util.Tpo .deps/iperf_util.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT net.lo -MD -MP -MF .deps/net.Tpo -c -o net.lo net.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT net.lo -MD -MP -MF .deps/net.Tpo -c net.c  -fPIC -DPIC -o .libs/net.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT net.lo -MD -MP -MF .deps/net.Tpo -c net.c -o net.o >/dev/null 2>&1
mv -f .deps/net.Tpo .deps/net.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT tcp_info.lo -MD -MP -MF .deps/tcp_info.Tpo -c -o tcp_info.lo tcp_info.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT tcp_info.lo -MD -MP -MF .deps/tcp_info.Tpo -c tcp_info.c  -fPIC -DPIC -o .libs/tcp_info.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT tcp_info.lo -MD -MP -MF .deps/tcp_info.Tpo -c tcp_info.c -o tcp_info.o >/dev/null 2>&1
mv -f .deps/tcp_info.Tpo .deps/tcp_info.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT tcp_window_size.lo -MD -MP -MF .deps/tcp_window_size.Tpo -c -o tcp_window_size.lo tcp_window_size.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT tcp_window_size.lo -MD -MP -MF .deps/tcp_window_size.Tpo -c tcp_window_size.c  -fPIC -DPIC -o .libs/tcp_window_size.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT tcp_window_size.lo -MD -MP -MF .deps/tcp_window_size.Tpo -c tcp_window_size.c -o tcp_window_size.o >/dev/null 2>&1
mv -f .deps/tcp_window_size.Tpo .deps/tcp_window_size.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT timer.lo -MD -MP -MF .deps/timer.Tpo -c -o timer.lo timer.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT timer.lo -MD -MP -MF .deps/timer.Tpo -c timer.c  -fPIC -DPIC -o .libs/timer.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT timer.lo -MD -MP -MF .deps/timer.Tpo -c timer.c -o timer.o >/dev/null 2>&1
mv -f .deps/timer.Tpo .deps/timer.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT units.lo -MD -MP -MF .deps/units.Tpo -c -o units.lo units.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT units.lo -MD -MP -MF .deps/units.Tpo -c units.c  -fPIC -DPIC -o .libs/units.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT units.lo -MD -MP -MF .deps/units.Tpo -c units.c -o units.o >/dev/null 2>&1
mv -f .deps/units.Tpo .deps/units.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2 -Wall   -o libiperf.la -rpath /usr/local/lib cjson.lo iperf_api.lo iperf_error.lo iperf_client_api.lo iperf_locale.lo iperf_server_api.lo iperf_tcp.lo iperf_udp.lo iperf_util.lo net.lo tcp_info.lo tcp_window_size.lo timer.lo units.lo  
libtool: link: gcc -shared  -fPIC -DPIC  .libs/cjson.o .libs/iperf_api.o .libs/iperf_error.o .libs/iperf_client_api.o .libs/iperf_locale.o .libs/iperf_server_api.o .libs/iperf_tcp.o .libs/iperf_udp.o .libs/iperf_util.o .libs/net.o .libs/tcp_info.o .libs/tcp_window_size.o .libs/timer.o .libs/units.o    -g -O2   -Wl,-soname -Wl,libiperf.so.0 -o .libs/libiperf.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libiperf.so.0" && ln -s "libiperf.so.0.0.0" "libiperf.so.0")
libtool: link: (cd ".libs" && rm -f "libiperf.so" && ln -s "libiperf.so.0.0.0" "libiperf.so")
libtool: link: ar cru .libs/libiperf.a  cjson.o iperf_api.o iperf_error.o iperf_client_api.o iperf_locale.o iperf_server_api.o iperf_tcp.o iperf_udp.o iperf_util.o net.o tcp_info.o tcp_window_size.o timer.o units.o
libtool: link: ranlib .libs/libiperf.a
libtool: link: ( cd ".libs" && rm -f "libiperf.la" && ln -s "../libiperf.la" "libiperf.la" )
gcc -DHAVE_CONFIG_H -I.    -g -g -O2 -Wall -MT iperf3-main.o -MD -MP -MF .deps/iperf3-main.Tpo -c -o iperf3-main.o `test -f 'main.c' || echo './'`main.c
mv -f .deps/iperf3-main.Tpo .deps/iperf3-main.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -g -g -O2 -Wall -g  -o iperf3 iperf3-main.o libiperf.la 
libtool: link: gcc -g -g -O2 -Wall -g -o .libs/iperf3 iperf3-main.o  ./.libs/libiperf.so -Wl,-rpath -Wl,/usr/local/lib
gcc -DHAVE_CONFIG_H -I.    -g -g -O2 -Wall -MT t_timer-t_timer.o -MD -MP -MF .deps/t_timer-t_timer.Tpo -c -o t_timer-t_timer.o `test -f 't_timer.c' || echo './'`t_timer.c
mv -f .deps/t_timer-t_timer.Tpo .deps/t_timer-t_timer.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -g -g -O2 -Wall   -o t_timer t_timer-t_timer.o libiperf.la 
libtool: link: gcc -g -g -O2 -Wall -o .libs/t_timer t_timer-t_timer.o  ./.libs/libiperf.so -Wl,-rpath -Wl,/usr/local/lib
gcc -DHAVE_CONFIG_H -I.    -g -g -O2 -Wall -MT t_units-t_units.o -MD -MP -MF .deps/t_units-t_units.Tpo -c -o t_units-t_units.o `test -f 't_units.c' || echo './'`t_units.c
mv -f .deps/t_units-t_units.Tpo .deps/t_units-t_units.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -g -g -O2 -Wall   -o t_units t_units-t_units.o libiperf.la 
libtool: link: gcc -g -g -O2 -Wall -o .libs/t_units t_units-t_units.o  ./.libs/libiperf.so -Wl,-rpath -Wl,/usr/local/lib
gcc -DHAVE_CONFIG_H -I.    -g -g -O2 -Wall -MT t_uuid-t_uuid.o -MD -MP -MF .deps/t_uuid-t_uuid.Tpo -c -o t_uuid-t_uuid.o `test -f 't_uuid.c' || echo './'`t_uuid.c
mv -f .deps/t_uuid-t_uuid.Tpo .deps/t_uuid-t_uuid.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -g -g -O2 -Wall   -o t_uuid t_uuid-t_uuid.o libiperf.la 
libtool: link: gcc -g -g -O2 -Wall -o .libs/t_uuid t_uuid-t_uuid.o  ./.libs/libiperf.so -Wl,-rpath -Wl,/usr/local/lib
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-main.o -MD -MP -MF .deps/iperf3_profile-main.Tpo -c -o iperf3_profile-main.o `test -f 'main.c' || echo './'`main.c
mv -f .deps/iperf3_profile-main.Tpo .deps/iperf3_profile-main.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-cjson.o -MD -MP -MF .deps/iperf3_profile-cjson.Tpo -c -o iperf3_profile-cjson.o `test -f 'cjson.c' || echo './'`cjson.c
mv -f .deps/iperf3_profile-cjson.Tpo .deps/iperf3_profile-cjson.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_api.o -MD -MP -MF .deps/iperf3_profile-iperf_api.Tpo -c -o iperf3_profile-iperf_api.o `test -f 'iperf_api.c' || echo './'`iperf_api.c
iperf_api.c: In function ‘iperf_parse_arguments’:
iperf_api.c:641:3: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
   system("uname -a");
   ^
iperf_api.c: In function ‘diskfile_recv’:
iperf_api.c:2517:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  (void) write(sp->diskfile_fd, sp->buffer, r);
  ^
iperf_api.c: In function ‘iperf_reporter_callback’:
iperf_api.c:2177:3: warning: ‘end_time’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   cJSON_AddItemToObject(test->json_end, "sum", iperf_json_printf("start: %f  end: %f  seconds: %f  bytes: %d  bits_per_second: %f  jitter_ms: %f  lost_packets: %d  packets: %d  lost_percent: %f", (double) start_time, (double) end_time, (double) end_time, (int64_t) total_sent, bandwidth * 8, (double) avg_jitter * 1000.0, (int64_t) lost_packets, (int64_t) total_packets, (double) lost_percent));
   ^
iperf_api.c:2019:24: note: ‘end_time’ was declared here
     double start_time, end_time, avg_jitter = 0.0, lost_percent;
                        ^
mv -f .deps/iperf3_profile-iperf_api.Tpo .deps/iperf3_profile-iperf_api.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_error.o -MD -MP -MF .deps/iperf3_profile-iperf_error.Tpo -c -o iperf3_profile-iperf_error.o `test -f 'iperf_error.c' || echo './'`iperf_error.c
mv -f .deps/iperf3_profile-iperf_error.Tpo .deps/iperf3_profile-iperf_error.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_client_api.o -MD -MP -MF .deps/iperf3_profile-iperf_client_api.Tpo -c -o iperf3_profile-iperf_client_api.o `test -f 'iperf_client_api.c' || echo './'`iperf_client_api.c
iperf_client_api.c: In function ‘iperf_run_client’:
iperf_client_api.c:365:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  system("uname -a");
  ^
mv -f .deps/iperf3_profile-iperf_client_api.Tpo .deps/iperf3_profile-iperf_client_api.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_locale.o -MD -MP -MF .deps/iperf3_profile-iperf_locale.Tpo -c -o iperf3_profile-iperf_locale.o `test -f 'iperf_locale.c' || echo './'`iperf_locale.c
mv -f .deps/iperf3_profile-iperf_locale.Tpo .deps/iperf3_profile-iperf_locale.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_server_api.o -MD -MP -MF .deps/iperf3_profile-iperf_server_api.Tpo -c -o iperf3_profile-iperf_server_api.o `test -f 'iperf_server_api.c' || echo './'`iperf_server_api.c
iperf_server_api.c: In function ‘iperf_accept’:
iperf_server_api.c:131:10: warning: unused variable ‘cookie’ [-Wunused-variable]
     char cookie[COOKIE_SIZE];
          ^
iperf_server_api.c: In function ‘iperf_run_server’:
iperf_server_api.c:469:2: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
  system("uname -a");
  ^
mv -f .deps/iperf3_profile-iperf_server_api.Tpo .deps/iperf3_profile-iperf_server_api.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_tcp.o -MD -MP -MF .deps/iperf3_profile-iperf_tcp.Tpo -c -o iperf3_profile-iperf_tcp.o `test -f 'iperf_tcp.c' || echo './'`iperf_tcp.c
mv -f .deps/iperf3_profile-iperf_tcp.Tpo .deps/iperf3_profile-iperf_tcp.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_udp.o -MD -MP -MF .deps/iperf3_profile-iperf_udp.Tpo -c -o iperf3_profile-iperf_udp.o `test -f 'iperf_udp.c' || echo './'`iperf_udp.c
mv -f .deps/iperf3_profile-iperf_udp.Tpo .deps/iperf3_profile-iperf_udp.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-iperf_util.o -MD -MP -MF .deps/iperf3_profile-iperf_util.Tpo -c -o iperf3_profile-iperf_util.o `test -f 'iperf_util.c' || echo './'`iperf_util.c
iperf_util.c: In function ‘get_system_info’:
iperf_util.c:222:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
     fgets(buf, sizeof(buf), fp);
     ^
mv -f .deps/iperf3_profile-iperf_util.Tpo .deps/iperf3_profile-iperf_util.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-net.o -MD -MP -MF .deps/iperf3_profile-net.Tpo -c -o iperf3_profile-net.o `test -f 'net.c' || echo './'`net.c
mv -f .deps/iperf3_profile-net.Tpo .deps/iperf3_profile-net.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-tcp_info.o -MD -MP -MF .deps/iperf3_profile-tcp_info.Tpo -c -o iperf3_profile-tcp_info.o `test -f 'tcp_info.c' || echo './'`tcp_info.c
mv -f .deps/iperf3_profile-tcp_info.Tpo .deps/iperf3_profile-tcp_info.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-tcp_window_size.o -MD -MP -MF .deps/iperf3_profile-tcp_window_size.Tpo -c -o iperf3_profile-tcp_window_size.o `test -f 'tcp_window_size.c' || echo './'`tcp_window_size.c
mv -f .deps/iperf3_profile-tcp_window_size.Tpo .deps/iperf3_profile-tcp_window_size.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-timer.o -MD -MP -MF .deps/iperf3_profile-timer.Tpo -c -o iperf3_profile-timer.o `test -f 'timer.c' || echo './'`timer.c
mv -f .deps/iperf3_profile-timer.Tpo .deps/iperf3_profile-timer.Po
gcc -DHAVE_CONFIG_H -I.    -pg -g -g -O2 -Wall -MT iperf3_profile-units.o -MD -MP -MF .deps/iperf3_profile-units.Tpo -c -o iperf3_profile-units.o `test -f 'units.c' || echo './'`units.c
mv -f .deps/iperf3_profile-units.Tpo .deps/iperf3_profile-units.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -pg -g -g -O2 -Wall -pg -g  -o iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o libiperf.la 
libtool: link: gcc -pg -g -g -O2 -Wall -pg -g -o .libs/iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o  ./.libs/libiperf.so -Wl,-rpath -Wl,/usr/local/lib
/usr/bin/ld: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: relocation R_X86_64_32S against `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/gcrt1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:768: recipe for target 'iperf3_profile' failed
make[2]: *** [iperf3_profile] Error 1
make[2]: Leaving directory '/tmp/iperf-3.0.11/src'
Makefile:615: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/tmp/iperf-3.0.11/src'
Makefile:371: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

And as I said originally, the issue seems to be deeper than just this one library - compiling D seems to be broken and giving a very similar message about R_X86_64_32.

Last edited by slavik262 (2015-01-25 11:18:57)

Offline

#8 2015-01-25 11:28:57

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Possible -fpic issue with glibc [solved]

From that output, you are using the hardening wrapper.  It installs a file to ensure it is in your path at boot.  Don't use it.

Edit: to be clear, -pg and -fPIE are not friends



<- 10,000th post!

Offline

#9 2015-01-25 21:21:42

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Re: Possible -fpic issue with glibc [solved]

I don't see how this could be a problem with flags or my configuration. Again, I'm using all defaults:

  1. I  have never modified makepkg.conf and I just verified this by reinstalling pacman (whose package contains /etc/makepkg.conf) and finding the exact same flags.

  2. As you can see from the output, I am not modifying a single thing when building from the source tarball. And compilation works with that default build process (configure && make) on other distros.

Still concerning is:

  • Why the error involving position dependent code is coming from inside gcrt1.o

  • Why D won't compile

Congrats on 10k.

Last edited by slavik262 (2015-01-25 21:25:09)

Offline

#10 2015-01-25 21:46:01

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: Possible -fpic issue with glibc [solved]

Look at what the hardening wrapper does. It installs wrappers for gcc, clang, etc. and makes these wrappers appear first in your PATH. If you run

which gcc

You will (probably) see that gcc is "/usr/lib/hardening-wrapper/bin/gcc" on your system. If you read that file, you will see what changes it makes to your build environment.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#11 2015-01-25 22:19:45

slavik262
Member
From: WA, USA
Registered: 2012-07-12
Posts: 46
Website

Re: Possible -fpic issue with glibc [solved]

I'll be damned. That was it - removing hardening-wrapper fixes the problems. Apparently hardening-wrapper was installed as a dependency for some other package, but whatever package it was has since been uninstalled. Odd.

Thank you for your help!

Offline

Board footer

Powered by FluxBB