You are not logged in.

#1 2020-01-08 22:07:53

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

[Solved] Trying to compile dwm from source in Debian

Hi everyone. I've been trying to compile dwm (in Debian 10) from source, so that I can change the mod key from Mod1 (Alt) to Mod4 (Win) in the config.h file. Unfortunately the compilation failed and I got this error;

fatal error: X11/Xlib.h: No such file or directory

Does anyone know how I might be able to fix it please? Also, is it possible to apply patches in dwm simply by editing the config.h file, adding the patch code to that file and then recompiling?

Thanks in advance,

CP .

Last edited by Colonel Panic (2020-01-14 17:54:38)

Offline

#2 2020-01-08 22:37:48

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: [Solved] Trying to compile dwm from source in Debian

Probably, you are missing development files ... Google 'compile dwm debian dependencies', and it will say you should do something like:

$ sudo apt-get install libx11-dev libxft-dev libxinerama-dev build-essential

Also, if you want to use dwm source already patched for debian (highly recommended!), you should fetch source like this (see DebianDwm):

$ apt-get source dwm

(appropriate 'deb-src' has to be enabled in the 'souces.list').

Last edited by iMBeCil (2020-01-08 22:38:22)


Postpone all your duties; if you die, you won't have to do them ..

Offline

#3 2020-01-09 04:54:04

ohnonot
...again
Registered: 2015-09-29
Posts: 4,880
Website

Re: [Solved] Trying to compile dwm from source in Debian

Colonel Panic wrote:

is it possible to apply patches in dwm simply by editing the config.h file, adding the patch code to that file and then recompiling?

I'm pretty sure that's not possible, patches have to be applied to dwm.c via the 'patch' utility.


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#4 2020-01-09 09:36:05

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: [Solved] Trying to compile dwm from source in Debian

ohnonot wrote:
Colonel Panic wrote:

is it possible to apply patches in dwm simply by editing the config.h file, adding the patch code to that file and then recompiling?

I'm pretty sure that's not possible, patches have to be applied to dwm.c via the 'patch' utility.

What are you talking about? Nothing of this 'patch utility' crap is needed, unless Colonel wants to package it ...

So, yes, as per instructions on the original dwm web page, and on DebianDwm web page, changing configuration in 'config.h', recompiling ('make') and installing new version ('make install') would do the trick. (Here I assume by 'apply patches in dwm' Colonel really means 'editing the config.h file'.)

Of course, one can also edit any other file (dwm.c, ...) and change dwm to its liking ...


Postpone all your duties; if you die, you won't have to do them ..

Offline

#5 2020-01-09 10:20:13

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,276

Re: [Solved] Trying to compile dwm from source in Debian

Here I assume by 'apply patches in dwm' Colonel really means 'editing the config.h file'.

Colonel Panic needs to be more specific about what he's doing. There are plenty of patches available from suckless.org that are usually applied using the patch utility (part of Debian base install, I think) or the patch can be added to the down.c file manually.

Some functions can/must be added to the config.h file then recompile.

Changing basic configuration like the modkey or a key binding is done by editing config.h and recompiling.

Last edited by PackRat (2020-01-09 16:51:40)


You must unlearn what you have learned.
    -- yoda

Offline

#6 2020-01-09 10:21:32

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: [Solved] Trying to compile dwm from source in Debian

^Indeed.


Postpone all your duties; if you die, you won't have to do them ..

Offline

#7 2020-01-09 11:12:27

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: [Solved] Trying to compile dwm from source in Debian

patching can be hit and miss with some patches on the suckless website, i know ive had to add in bits of code here and there to the config.def.h to make it work and also modify some of the code in the dwm.c, im pretty sure some patches override or mess with other patches as well, unless im not doing it correctly?

Anyhow if this is your first try at dwm ill try to help as ive installed it a number of times in many different configurations.

I prefer to git clone dwm from the suckless website.

imbecil is correct on the needed dependencies

i put patches inside the dwm cloned folder and then do the following command.

$ patch -p1 < dwm-tilegap-6.2.diff

1st things first though, once you have all the deps taken care of do the following.

sudo make clean install

if you dont want the binary in /usr/local/bin do the following for /usr/bin

sudo make clean prefix=/usr install

This is my github dots repo you can have a look at, it has a bunch of patches already configured.

https://github.com/clusterF/voidlinux/tree/master/dwm

Offline

#8 2020-01-09 11:12:32

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

Thanks to you both for your replies. IMBeCil; I've just downloaded the dwm source files and will get onto editing my config.h file soon

Ohnonot; thanks for your reply also but sorry I seem to have sparked off an argument here. I'm not in a hurry to patch the file so am happy to leave it for the future; all I really want to do is use Win instead of Alt for the mod key (less of a distance for my fingers to habve to stretch) and to have a status bar as standard, which I don't think you always get with dwm. I think both of these can be accomplished by editing the config.h file.

The one which caught my immediate interest was this one;

https://dwm.suckless.org/patches/fibonacci/

ClusterF; thanks for your comments too, I'll get round to reading them soon.

Last edited by Colonel Panic (2020-01-09 11:13:43)

Offline

#9 2020-01-09 11:26:50

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: [Solved] Trying to compile dwm from source in Debian

in config.h you modify

#define MODKEY Mod1Mask

to

#define MODKEY Mod4Mask

if you want the win key as mod key.

Last edited by clusterF (2020-01-09 11:27:30)

Offline

#10 2020-01-09 12:34:50

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,276

Re: [Solved] Trying to compile dwm from source in Debian

The status bar is standard in dwm and configured in config.h:

static const int showbar            = 1;        /* 0 means no bar */
static const int topbar             = 1;        /* 0 means bottom bar */

You can disable it by default in the config.h. There is also a pre-defined key binding to toggle it.

{ MODKEY,                       XK_b,      togglebar,      {0} },

There are patches for the status bar at suckless.org as well as some programs to pipe information to the status bar.

Read the Arch Wiki entry for dwm; it's pretty good.

Last edited by PackRat (2020-01-09 13:54:03)


You must unlearn what you have learned.
    -- yoda

Offline

#11 2020-01-09 14:59:02

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

Thanks to you both for your replies; looks like I'll need to learn how dwm patches work after all.

Sounds like the Arch Wiki about dwm is worth reading too. I'm thinking of starting a more general thread here about tiling window managers as it seems a few people use them (mostly dwm but I've seen a couple of others mentioned, such as i3 and bpswm).

Offline

#12 2020-01-09 15:54:08

damo
....moderator....
Registered: 2015-08-20
Posts: 6,268

Re: [Solved] Trying to compile dwm from source in Debian

Colonel Panic wrote:

.... I'm thinking of starting a more general thread here about tiling window managers as it seems a few people use them (mostly dwm but I've seen a couple of others mentioned, such as i3 and bpswm).

There was an epic thread by @2ManyDogs on the Crunchbang forums: 30 Window Managers in 30 days


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#13 2020-01-09 16:50:33

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,276

Re: [Solved] Trying to compile dwm from source in Debian

Thanks to you both for your replies; looks like I'll need to learn how dwm patches work after all.

Since you mentioned the fibonacci layout patch, I looked it up (I have never used it). Looks like you'll need to:

1. Apply the patch (with patch like clusterF pointed out)
2. Edit the config.h to include the fibonacci.c source and layouts.

Similar to what you would have to do for gapless grid layout.

What's missing though, is that the author doesn't indicate if you'll need to create key bindings to activate the fibonacci layouts. I doubt the patch will add those, so I suspect that's something you'll have to do in the " static Key keys[] " portion of the config.h - you'll see the other setlayout options.


You must unlearn what you have learned.
    -- yoda

Offline

#14 2020-01-09 19:04:36

beaker
Unverified Muppet
Registered: 2016-03-06
Posts: 162

Re: [Solved] Trying to compile dwm from source in Debian

I would recommend compiling from source rather than using the debian package.

If you run more than a couple of patches you'll need to learn how to patch by hand - I think I use about 5. I haven't had too much trouble with the patches in dwm. Read the diffs (they are human readable) - they tell you exactly which files need patching and where.

Offline

#15 2020-01-10 02:08:37

manyroads
Member
From: around here, somewhere
Registered: 2019-04-16
Posts: 63
Website

Re: [Solved] Trying to compile dwm from source in Debian

Did you look here for help and ideas?
https://wiki.debian.org/Dwm


Pax vobiscum,
Mark Rabideau - http://many-roads.com
dwm on Arch ~ Reg. Linux User #449130
"For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken

Offline

#16 2020-01-10 07:08:11

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

Yes.

Thanks again for the advice but my first attempt to compile dwm in Debian 10 (Buster) was unsuccessful. I'm going to try it in Mint Debian and maybe Slackware and Bunsen as well before deciding there's a problem.

Last edited by Colonel Panic (2020-01-10 07:08:43)

Offline

#17 2020-01-10 08:03:50

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: [Solved] Trying to compile dwm from source in Debian

Colonel Panic wrote:

Thanks again for the advice but my first attempt to compile dwm in Debian 10 (Buster) was unsuccessful.

What went wrong?


Postpone all your duties; if you die, you won't have to do them ..

Offline

#18 2020-01-11 12:32:52

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

iMBeCil wrote:
Colonel Panic wrote:

Thanks again for the advice but my first attempt to compile dwm in Debian 10 (Buster) was unsuccessful.

What went wrong?

Hi iMBeCiL, tanks for replying . This was the error message I got;



NOTICE: 'dwm' packaging is maintained in the 'Git' version control system at:
https://salsa.debian.org/hle/dwm.git
Please use:
git clone https://salsa.debian.org/hle/dwm.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 41.0 kB of source archives.
Get:1 http://deb.debian.org/debian stable/main dwm 6.1-5 (dsc) [1,464 B]
Get:2 http://deb.debian.org/debian stable/main dwm 6.1-5 (tar) [25.7 kB]
Get:3 http://deb.debian.org/debian stable/main dwm 6.1-5 (diff) [13.8 kB]
Fetched 41.0 kB in 0s (263 kB/s)
Skipping unpack of already unpacked source in dwm-6.1
W: Download is performed unsandboxed as root as file 'dwm_6.1-5.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
root@graham:/home/graham# mc

root@graham:/home/graham# cd /home/graham/dwm-6.1
root@graham:/home/graham/dwm-6.1# make install
dwm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.1" -DXINERAMA
LDFLAGS  = -s -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft
CC       = cc
CC drw.c
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from drw.c:2:
/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
In file included from drw.c:6:
/usr/include/X11/Xft/Xft.h:39:10: fatal error: ft2build.h: No such file or directory
#include <ft2build.h>
          ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:19: drw.o] Error 1

However, I managed to compile dwm in Slackware without any problems though (and that's where I'm posting this from), although I haven;t yet tried compiling it after I edited the config.h file.

If I can change config.h and still recompile it successfully in Slackware, I might just settle for that and use i3 when I need a tiling manager in Debian, Bunsen or any other Debian-based distro.

Last edited by Colonel Panic (2020-01-11 12:39:07)

Offline

#19 2020-01-11 13:05:38

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: [Solved] Trying to compile dwm from source in Debian

^ looks like you need to install this package if not installed already.

https://packages.debian.org/buster/libfreetype6-dev

Offline

#20 2020-01-11 16:18:42

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,276

Re: [Solved] Trying to compile dwm from source in Debian

Colonel Panic wrote:

However, I managed to compile dwm in Slackware without any problems though (and that's where I'm posting this from), although I haven;t yet tried compiling it after I edited the config.h file.

Because Slackware does not split out the header files into "file.dev" files that will be needed to compile from source.

Looks like you need to install the file @clusterF mentions.

Also, the command:

apt-get build-dep dwm 

will install all the dependencies you'll need to compile dwm (there aren't too many).

You can also clone the source from the suckless dwm git repository. That Debian repository appears to be a over a year old.

Last edited by PackRat (2020-01-11 19:50:46)


You must unlearn what you have learned.
    -- yoda

Offline

#21 2020-01-11 16:32:17

cog
Developer
From: The Southwest
Registered: 2015-10-27
Posts: 493
Website

Re: [Solved] Trying to compile dwm from source in Debian

^ that’s how I use to do it.


The worst day of fishing is better than the best day at work.

Offline

#22 2020-01-11 19:27:54

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

Thanks for the advice (and Pack Rat and Cluster F too). I'll get onto it soon. I hadn't even heard of build-dep but it sounds like a very useful option.

Last edited by Colonel Panic (2020-01-11 19:39:52)

Offline

#23 2020-01-14 17:54:16

Colonel Panic
Member
Registered: 2018-11-13
Posts: 181

Re: [Solved] Trying to compile dwm from source in Debian

Success at last! I followed the instructions given and finally managed to compile dwm, which I'm running now (in Crunchbang++). Thanks again to everyone who contributed.

For the status bar I'm using Joe Standring's utility dwm-bar, which I downloaded using github (to which I'm still quite new).

Last edited by Colonel Panic (2020-01-14 17:55:23)

Offline

#24 2020-01-14 18:13:07

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,276

Re: [Solved] Trying to compile dwm from source in Debian

Screenshot or it didn't happen.   monkey


You must unlearn what you have learned.
    -- yoda

Offline

#25 2020-01-14 20:09:53

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: [Solved] Trying to compile dwm from source in Debian

^ big_smile

Colonel Panic wrote:

I followed the instructions given and finally managed to compile dwm, which I'm running now (in Crunchbang++). Thanks again to everyone who contributed.

Which instructions in particular? It is always nice to explain how you solved your problem, for people visiting this topic ... for reference, and as a sort of give-back to other people who spend time to answer your questions.


Postpone all your duties; if you die, you won't have to do them ..

Offline

Board footer

Powered by FluxBB