jcnelson / vdev

A device-file manager for *nix
GNU General Public License v3.0
101 stars 13 forks source link

Makefiles #25

Closed fbt closed 9 years ago

fbt commented 9 years ago

This commit brought some significant improvements to the build system: https://github.com/jcnelson/vdev/commit/a5185e5a022b66f6ee144662be22f44cc15e89ed

But it also results in this: [✓] fbt@twilight ~/git/pkgbuilds/vdev-git/pkg/vdev-git/usr/bin (master[f]) > ldd vdevd ... /home/fbt/git/pkgbuilds/vdev-git/src/vdev-git/build/lib/libvdev.so.1 (0x00007f1b17ead000) ...

And I can't quite figure out why does that even happen.

EDIT: Removed everything related to variable overrides, this happens regardless of those.

jcnelson commented 9 years ago

Hi fbt,

Thank you for reporting this. Does it continue to happen even if you move the libvdev.so.1 library somewhere else (like /lib)?

Also, after installing, does it work if you run sudo ldconfig first?

Thanks, Jude

fbt commented 9 years ago

Yes, it happens even if I have libvdev installed in /usr/lib before building vdevd and vdevfs.

ldconfig shouts at me: ldconfig: Can't link /usr/lib//home/fbt/git/pkgbuilds/vdev-git/src/vdev-git/build/lib/libvdev.so.1 to libvdev.so.1.0.1

EDIT: I misunderstood the error. ldconfig shouts at the libs themselves, the binaries are not related. EDIT1:

 > objdump -p pkg/libvdev-git/usr/lib/libvdev.so | grep SONAME
SONAME               /home/fbt/git/pkgbuilds/vdev-git/src/vdev-git/build/lib/libvdev.so.1
jcnelson commented 9 years ago

Thanks for your additional report. The new libvdev Makefile had incorrectly set the SONAME to the absolute path to where it was generated. Commit a1f85b94b22eaaf88433e11909d117c4aff09648 fixes this, so only the basename is included in the SONAME. Can you confirm that this fixes the issue?

fbt commented 9 years ago

Yep. It fixes that particular problem. But now this happens:

 > vdevd -1 -f /tmp/dev
08557:495671104: [          vdev.c:0638] vdev_preseed_run: ERROR: vdev_subprocess('/usr/local/lib/vdev/dev-setup.sh /tmp/dev') exit status 127
08557:495671104: [          main.c:0052] main: ERROR: vdev_preseed_run rc = 127

vdevd still searches for the helper scripts in the default PREFIX, not the new one (I build with /usr as the prefix, not /usr/local)

jcnelson commented 9 years ago

Thanks for letting me know!

In c9eba10ff4350e0bcd9a9905ab352d77892fe87a, I made the Makefiles preserve the some of the build variables (like PREFIX) in build/.install.mk. This file will get included in make install, so PREFIX will be preserved between make and make install. Can you confirm that this fixes the issue?

fbt commented 9 years ago

That actually complicates things and results in things like this:

[vdev-config]
firmware=/home/fbt/git/pkgbuilds/vdev-git/pkg/vdev-git/usr/lib/firmware
acls=/home/fbt/git/pkgbuilds/vdev-git/pkg/vdev-git/etc/vdev/acls
actions=/home/fbt/git/pkgbuilds/vdev-git/pkg/vdev-git/etc/vdev/actions
...

The reason vdevd was searching the wrong places is because teh config gets generated with the wrong PREFIX and other variables. If you feed it the variables on build, it will still get generated with the wrong ones because the package uses temporary dirs to install to.

A proper fix would be to separate PREFIX from DESTDIR. The difference is that DESTDIR only commands the destination directories for the install target and PREFIX affects paths in the code and such. This way you can set PREFIX to /usr/lib and everything gets built with the right paths, and DESTDIR='/tmp/package' just instructs the install target where to put stuff. Like:

install:
    install -Dm755 vdevd $(DESTDIR)$(PREFIX)$(SBINDIR)/vdevd
fbt commented 9 years ago

And btw, saving the variables between make and make install also makes it impossible to overwrite some vars on make and others on install. It's easy to fix by deleting the dotfile, so no big deal I guess. It will confuse people though.

jcnelson commented 9 years ago

I agree--I will add separate DESTDIR and PREFIX variables.

jcnelson commented 9 years ago

I removed the need for the dotfile and added separate DESTDIR and PREFIX. Can you confirm that this fixes your issue?

fbt commented 9 years ago

Yep, packaging vdevd is now more or less not a pain :)