linking error under ubuntu 12

Dmitry V. Levin ldv at altlinux.org
Fri Jul 15 10:04:40 UTC 2016


On Fri, Jul 15, 2016 at 10:43:02AM +0800, Daniel Graczer wrote:
> hi, I am trying to compile strace under Ubuntu 12, and it succeeds
> initially. However if I define the USE_LIBINWIND macro in config.h.in

The only supported way of enabling -k option is configure --with-libunwind.

If you are editing config.h* manually, it's up to you to ensure
correctness of your changes.

> (I want to use the -k option for stack trace) the linking fails. I tried to
> manually link against the libunwind library, but that library doesn't have
> the functions strace is complaining about.

If you manually link strace, you are doing it on your own risk.

> gcc -Wall -Wwrite-strings -Wsign-compare  -g -O2   -o strace
> strace-access.o strace-affinity.o strace-aio.o strace-alpha.o strace-bjm.o
> strace-block.o strace-bpf.o strace-btrfs.o strace-cacheflush.o
> strace-capability.o strace-chdir.o strace-chmod.o strace-clone.o
> strace-copy_file_range.o strace-count.o strace-desc.o strace-dirent.o
> strace-dirent64.o strace-epoll.o strace-evdev.o strace-eventfd.o
> strace-execve.o strace-exit.o strace-fadvise.o strace-fallocate.o
> strace-fanotify.o strace-fchownat.o strace-fcntl.o
> strace-fetch_seccomp_fprog.o strace-fetch_struct_flock.o
> strace-fetch_struct_statfs.o strace-file.o strace-file_handle.o
> strace-file_ioctl.o strace-fs_x_ioctl.o strace-flock.o strace-futex.o
> strace-get_robust_list.o strace-getcpu.o strace-getcwd.o strace-getrandom.o
> strace-hdio.o strace-hostname.o strace-inotify.o strace-io.o strace-ioctl.o
> strace-ioperm.o strace-iopl.o strace-ioprio.o strace-ipc_msg.o
> strace-ipc_msgctl.o strace-ipc_sem.o strace-ipc_shm.o strace-ipc_shmctl.o
> strace-kcmp.o strace-kexec.o strace-keyctl.o strace-ldt.o strace-link.o
> strace-lookup_dcookie.o strace-loop.o strace-lseek.o strace-mem.o
> strace-membarrier.o strace-memfd_create.o strace-mknod.o strace-mount.o
> strace-mq.o strace-mtd.o strace-net.o strace-numa.o strace-open.o
> strace-or1k_atomic.o strace-pathtrace.o strace-perf.o strace-personality.o
> strace-poll.o strace-prctl.o strace-print_mq_attr.o strace-print_msgbuf.o
> strace-print_sigevent.o strace-print_statfs.o strace-print_time.o
> strace-print_timex.o strace-printmode.o strace-printrusage.o
> strace-printsiginfo.o strace-process.o strace-process_vm.o strace-ptp.o
> strace-quota.o strace-readahead.o strace-readlink.o strace-reboot.o
> strace-renameat.o strace-resource.o strace-rtc.o strace-sched.o
> strace-scsi.o strace-seccomp.o strace-sendfile.o strace-sigaltstack.o
> strace-signal.o strace-signalfd.o strace-sigreturn.o strace-sock.o
> strace-socketutils.o strace-sram_alloc.o strace-statfs.o strace-strace.o
> strace-swapon.o strace-syscall.o strace-sysctl.o strace-sysinfo.o
> strace-syslog.o strace-sysmips.o strace-term.o strace-time.o strace-times.o
> strace-truncate.o strace-ubi.o strace-uid.o strace-uid16.o strace-umask.o
> strace-umount.o strace-uname.o strace-userfaultfd.o strace-util.o
> strace-utime.o strace-utimes.o strace-v4l2.o strace-vsprintf.o
> strace-wait.o strace-xattr.o strace-xmalloc.o -L/var/tmp/libunwind/lib/
> -lunwind libstrace.a

It's obvious that the link command is wrong, your libunwind related
changes are out of place.  I strongly encourage you to avoid linking
strace manually and use traditional "configure && make" idiom.
You can specify a directory containing libunwind headers and libraries
using --with-libunwind=path-to-libunwind-directory syntax.

A word to others reading this.  I understand the bug in this manually
formed link command is trivial, but please don't fix it.  If users abandon
supported interfaces and start issuing link commands manually,
it's up to them to learn various features of GNU ld like --as-needed
and how they affect linking.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160715/b5dfa13d/attachment.bin>


More information about the Strace-devel mailing list