Re: [PATCH] allow setting LDFLAGS from pci-userspace Makefile

  • From: Robert Millan <rmh@xxxxxxx>
  • To: pooka@xxxxxx, rumpkernel-users@xxxxxxxxxxxxx
  • Date: Tue, 25 Aug 2015 23:01:57 +0200

El 16/08/15 a les 13:34, Antti Kantee ha escrit:

On 16/08/15 11:28, Robert Millan wrote:
On 16/08/15 13:24, Antti Kantee wrote:
Component-specific flags. Specifically -lpciaccess on GNU/Hurd. See my more
recent
mails about this.

You still need to supply -lpciaccess "manually" if you want to link a static
rump kernel.

I'm not sure I follow. Please correct me if I missunderstood, but what I see is
that
the Makefile in libpci (buildrump.sh tree) is the one actually building and
linking of
OS-specific code in pci-userspace.

Therefore the Makefile in pci-userspace needs to pass along its requirements by
exporting
some variables.

Is that correct?

Shared libraries are linked when they are created, static libraries are just
archived. There is linking happening
in libpci in the latter case and hence LDFLAGS is not used.

Does the build of libpci on Hurd fail if you don't supply the additional
LDFLAGS?

No, but it needs symbols which aren't provided by any of its library
dependencies. E.g.

$ nm -D /usr/lib/librumpdev_pci.so.0.0 | grep pci_system_init
U pci_system_init

$ ldd /usr/lib/librumpdev_pci.so.0.0
libc.so.0.3 => /lib/i386-gnu/libc.so.0.3 (0x0105b000)
libmachuser.so.1 => /lib/i386-gnu/libmachuser.so.1 (0x0121a000)
/lib/ld.so.1 (0x00001000)
libhurduser.so.0.3 => /lib/i386-gnu/libhurduser.so.0.3 (0x01232000)

$ cat test.c
int
main()
{
}
$ gcc test.c -lrump -lrumpdev -lrumpdev_pci -lrumpvfs
/usr/lib/gcc/i586-gnu/4.9/../../../librumpdev_pci.so: undefined reference to
`pci_device_cfg_read_u32'
/usr/lib/gcc/i586-gnu/4.9/../../../librumpdev_pci.so: undefined reference to
`pci_device_cfg_write_u32'
/usr/lib/gcc/i586-gnu/4.9/../../../librumpdev_pci.so: undefined reference to
`pci_device_next'
/usr/lib/gcc/i586-gnu/4.9/../../../librumpdev_pci.so: undefined reference to
`pci_slot_match_iterator_create'
/usr/lib/gcc/i586-gnu/4.9/../../../librumpdev_pci.so: undefined reference to
`pci_system_init'
collect2: error: ld returned 1 exit status
$ gcc test.c -lrump -lrumpdev -lrumpdev_pci -lrumpvfs -lpciaccess
$

I find it strange that librumpdev_pci.so.0.0 build didn't break on the
unresolved symbol. Am I missing
something obvious?

--
Robert Millan

Other related posts: