Raymo111 / i3lock-color

The world's most popular non-default computer lockscreen.
Other
1.07k stars 133 forks source link

Help Compiling on Ubuntu 19.04 #143

Closed arjvik closed 4 years ago

arjvik commented 4 years ago

This issue is a....

Compilation issue

Hi!

I am trying to upgrade my i3 install by replacing i3lock with i3lock-color. Unfortunately, i3lock-color isn't in the 19.04 repos, and I'm not very sure about the PPA I found. So I decided to compile from source.

I started by cloning the repo and following the instructions at the bottom of the README:

autoreconf --force --install
rm -rf build/
mkdir -p build && cd build/
# so far, so good

../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
# oops I need libjpeg
sudo apt install libjpeg-turbo8-dev
../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
# good so far

make
# oh no, error about missing <security/pam_appl.h>
sudo apt install libpam0g-dev
make
# starting to see a lot of compilation errors

The specific error I recieved seems to be about the pam header files I installed:

i3lock.c:(.text+0x11ed): undefined reference to `pam_authenticate'
/usr/bin/ld: i3lock.c:(.text+0x17a1): undefined reference to `pam_setcred'
/usr/bin/ld: i3lock.c:(.text+0x17af): undefined reference to `pam_end'
/usr/bin/ld: i3lock-i3lock.o: in function `main':
i3lock.c:(.text.startup+0x10f): undefined reference to `pam_start'
/usr/bin/ld: i3lock.c:(.text.startup+0x137): undefined reference to `pam_set_item'
/usr/bin/ld: i3lock.c:(.text.startup+0x233d): undefined reference to `pam_strerror'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:551: i3lock] Error 1
make[1]: Leaving directory '/opt/i3lock-color/build'
make: *** [Makefile:454: all] Error 2

Versions:

I would really appreciate some help solving this error! Thanks!

PandorasFox commented 4 years ago

76

arjvik commented 4 years ago

It doesn't look like any of the errors from #76, this is about PAM and nothing was mentioned about PAM in that issue. Thanks for looking into it though.

arjvik commented 4 years ago

@PandorasFox any idea of what to try?

PandorasFox commented 4 years ago

No clue, really. I don't have any debian installs on-hand and I haven't really the time to figure this out.

Is the included error snippet from before or after installing libpam0g-dev? If it's before, what are the errors after?

arjvik commented 4 years ago

That's the error from after installing libpam0g-dev. The error before was a generic error about #include <security/pam_appl.h> not finding the required header file.

PandorasFox commented 4 years ago

My guess at this point is that it's pkg-config not giving the correct flags. Did you re-run ./configure after installing libpam? That might be necessary, unfortunately.

arjvik commented 4 years ago

I got it to work by doing the oddest thing.. Following the instructions in the README and doing mkdir -p build && cd build/ && make seemed to be causing the issues.

If instead I listened to the output of ./configure and did cd x86_64-pc-linux-gnu/ && make it worked!

I still have no clue why. Maybe add a note to the README about it?

arjvik commented 4 years ago

Never mind, it's not the directory, but rather the fact that I never ran ./configure.

That wasn't in the README instructions, so I completely forgot about it.

Would you mind adding it?

arjvik commented 4 years ago

Ok, I'm officially blind. You did indeed say to run ./configure.

And I ran it the first time after installing libpam. I changed nothing when I tried again today. However, it works now??

No clue what happened, but it works now. I followed the same instructions as last time. I guess I'll take the good fortune!

arjvik commented 4 years ago

This is finally what worked for me (from my ricing install script):

https://github.com/arjvik/dots/blob/2e5cc83b4962754075fcdb40ee60fa6417dc011d/install.sh#L127-L142

info "Installing i3lock-color"
if ! type i3lock; then
    sudo apt remove -y i3lock
    sudo apt install -y libjpeg-turbo8-dev libpam0g-dev
    cd /opt
    sudo git clone https://github.com/pandorasfox/i3lock-color
    sudo chown -R $USER:$USER i3lock-color
    cd i3lock-color
    git tag -f "git-`git rev-parse --short HEAD`"
    autoreconf --force --install
    rm -rf build/
    mkdir -p build && cd build/
    ../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers
    make
    sudo make install
info_done

Hopefully this can help someone else with this same problem

PandorasFox commented 4 years ago

honestly this is why I hate automake, but upstream i3lock switched to it and it was easiest to go along with that. It's incredibly opaque at times.

Glad you got it sorted!