*Solved* 2wm Make Install

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

*Solved* 2wm Make Install

Unread post by catfood » Sun Oct 30, 2016 10:45 pm

Trying to install 2wm from source. My 1st attempt at source code. Its becoming apparent I have no idea what I'm doing.

Tried stuff from 3 youtube videos on subject and various google searches. Tried stuff I found on here too, but no luck. Most instructions I've noticed seem to contain ./configure file within the tar once unzipped. Not included in 2wm, so maybe why those methods haven't worked.

Downloaded and unzipped 2wm to it's own new directory within Downloads. (folder contents visible on bottom left of scrot in MC)
Apt-got installed Make && Make-doc (though can't find the later now)

nano README (important parts visible in bottom right of scrot)

config.mk appeared generic, wasn't sure if anything needed changed. Seems just like personal preferences rather than necessity.

Made the (possibly poor) assumption I likely already have Xlib headers from one of the other 7 WM's I've installed via the repositories. Couldn't find out how to check which headers it wants or if I had them, so just tried to make and figured it would tell me required dependencies when I tried to run it...

Unsure if I need suckless-tools package?

Tried:
Sudo make clean install (per readme)
Make Install, Make, Make 2wm, etc. all from 2wm extracted directory terminal.
Tried:
./config
make
make install
(per forums here)

and a few other ways I can't remember off hand.

Attempts either don't recognize command, or give same error output. (Shown in top left of scrot). Unsure what any of that means whatsoever, lol.
Attachments
Make 2wm please.png
Last edited by catfood on Sat Nov 05, 2016 5:43 pm, edited 2 times in total.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: 2wm Make Install

Unread post by pidsley » Mon Oct 31, 2016 12:43 am

Installing window managers from the repos does not install build tools or header files required to build.

The rest of this post assumes you downloaded and extracted 2wm-0.1.tar.gz from here: http://dl.suckless.org/misc/
The instructions might work if you got the source from somewhere else, but might not.

To install the build tools (make, cpp, gcc, cc, and others), install the build-essential package:

Code: Select all

$ sudo apt install build-essential
Once you have the build tools installed, "make" should work in the 2wm-0.1 directory, but the build will fail because you are missing header files:

Code: Select all

$ make
2wm build options:
CFLAGS   = -g -Wall -O2 -I. -I/usr/include -I/usr/X11R6/include -DVERSION="0.1"
LDFLAGS  = -g -L/usr/lib -lc -L/usr/X11R6/lib -lX11
CC       = cc
CC client.c
In file included from client.c:4:0:
2wm.h:6:22: fatal error: X11/Xlib.h: No such file or directory
 #include <X11/Xlib.h>
                      ^
compilation terminated.
Makefile:18: recipe for target 'client.o' failed
make: *** [client.o] Error 1
To find the library you need, you can search using "apt-file" -- the first time you use this you will need to install the "apt-file" package, and then update the file cache:

Code: Select all

$ sudo apt install apt-file
$ sudo apt-file update
Then you can search for the package containing the missing library:

Code: Select all

$ apt-file search Xlib.h
In the output you will see that the libx11-dev package contains Xlib.h, so you need to install it:

Code: Select all

$ sudo apt install libx11-dev
Try "make" again -- it should now complete successfully. Don't run "make install" yet! The config.h included with the source uses uxterm as its default terminal, and unless you are using uxterm you will need to change this.

You need to edit config.h to change anything in 2wm. Find this line:

Code: Select all

{ MODKEY|ShiftMask,		XK_Return,	spawn, \
		{ .cmd = "exec uxterm -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*'" } }, \
And assuming you are using urxvt as your terminal, change it to:

Code: Select all

{ MODKEY|ShiftMask,		XK_Return,	spawn, \
		{ .cmd = "exec urxvt" } }, \
(You could also change it to "exec x-terminal-emulator" if you want to be fancy and use the Debian terminal redirect.)

Now run "make" again and make sure 2wm builds. If it does, you can install it:

Code: Select all

$ sudo make install
And add this line to start it at the end of your .xinitrc (make sure there is no other "exec" line before it):

Code: Select all

exec 2wm
Now when you run "startx", 2wm should start. The default keybindings are "Alt-Shift-Enter" to start a terminal and "Alt-p" to run dmenu.

You will probably now be more confused about the other keybindings in config.h and how to actually do anything with 2wm. Read the man page!

Code: Select all

$ man 2wm
Mod1 is the Alt key. To change these keybindings, you will need to edit config.h and rebuild and reinstall. MODKEY in config.h is the Alt key (MOD1MASK) ShiftMask is the shift key (duh) and the other keys are simple (XK_g is the "g" key, for example.)

Building other window managers can be more complicated because you may be missing other libraries and headers they need. You may need to use apt-file several times to find and install the required libraries.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: 2wm Make Install

Unread post by wuxmedia » Mon Oct 31, 2016 8:37 pm

wow, good work pidsley.
that is a general guide to building things from source, from what I can recall from my last brief dalliance with make.
not that I do it at all if i can help it :)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: 2wm Make Install

Unread post by ivanovnegro » Mon Oct 31, 2016 9:39 pm

Maybe in the future we could have something like that in a how-to.
Excellent post Pidsley.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: 2wm Make Install

Unread post by pidsley » Mon Oct 31, 2016 10:39 pm

^ I was thinking about making it a separate topic; maybe I will do that. Thanks guys.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: 2wm Make Install

Unread post by machinebacon » Mon Oct 31, 2016 10:42 pm

^ thanks for the post!

^^^^ catfood, you probably want to run "dkeger" and pick some nice color theme to get a less shiny terminal there ;)
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: 2wm Make Install

Unread post by GekkoP » Tue Nov 01, 2016 9:02 am

Superb instructions, Pidsley.

Now, catfood, you just can't get it wrong. :)

User avatar
vic
Godot
Posts: 2109
Joined: Wed Oct 17, 2012 10:11 am
Location: /bin

Re: 2wm Make Install

Unread post by vic » Wed Nov 02, 2016 9:13 am

I just wowed pidsley. Great stuff!
Sorry guys, no signature for a while, too busy with life. :|

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Thu Nov 03, 2016 8:50 pm

Thanks Pidsley. I don't feel so dumb knowing there were that many extra steps I couldn't have known :D

Ironically the default keybindings for 2wm seemed beginner proof... After reading the list once, everything felt natural and instinctive (hard to forget them), hence why I want this. Been a lot of fun playing with Bleuets, but I prefer Break's kernel. Also wanted a tiling window manager without it's own panel so I can continue to try custom tint2 or lemonbars. Custom choice xinitrc attempt after this installs :)
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Thu Nov 03, 2016 9:18 pm

While I'm here,
Can I change Dmenu to just [ Super ] key? or does that conflict with other BBQ keybindings?

What's the exact name for it? "SUPER"? or like Mod2 or something?

I'd like it that way accross all WM's if possible (My replacement "Whisker Start Menu") I tried changing it in another BBQ spin, but changes didn't seem to take effect even after restarting WM or comp. Wasn't sure which file had the final say in keybinds I guess.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Thu Nov 03, 2016 9:24 pm

machinebacon wrote:
^^^^ catfood, you probably want to run "dkeger" and pick some nice color theme to get a less shiny terminal there ;)
Is dkeger just a script that autowrites over .Xresources_colors?
Will 2wm install in whatever current terminal colors I'm using, or do I need to copy .Xresource color info into config somewhere?
Will these changes affect uxvrt and x-term or just one of them?

Also was curious, can I redit config.h later and have changes take effect? or do I have to like uninstall and then recompile 2wm anytime I want changes?
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: 2wm Make Install

Unread post by pidsley » Thu Nov 03, 2016 10:23 pm

catfood wrote:What's the exact name for it? "SUPER"? or like Mod2 or something?
It's called Mod4.

Any time you modify 2wm's config.h, you need to rebuild and reinstall 2wm to make the changes take effect. dwm and some other window managers work the same way. This is called a "compile-time config" -- it makes the source code simpler, and some people like this. You don't have to uninstall, just run "sudo make install" and install the new version over the old.

Other window managers (like spectrwm and openbox) have a "runtime config" where you can make changes and the window manager will reload the changes without recompiling. It makes the code more complex, but some people prefer this. It's all about tradeoffs and what you want.

Finally, if you like Bleuets but "prefer Break's kernel' there is nothing preventing you from using the Break kernel with Bleuets.

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Thu Nov 03, 2016 10:28 pm

^ Ok, thanks. I thought I read that about DWM, assumed its baby sibling would be the same but wanted to maske sure.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: 2wm Make Install

Unread post by machinebacon » Thu Nov 03, 2016 10:53 pm

wrt dkeger: it just copies the chosen color theme from ~/xcolors/xcolor_code to ~/.Xresources_colors, re-reads ~/.Xresources using xrdb and open a x-terminal-emulator (by default rxvt-unicode-256color)

It works for the terminal that is set a x-terminal-emulator (as long as it is not a terminal that run libvte9, like terminator, xfce4-terminal, sakura, mate-terminal, ... or st, as this needs patches and reconfiguration as pidsley wrote before). It also sets X11 application colors like xclock, xcal, etc.

So briefly: it works for *rxvt and xterm (or aterm or eterm IIRC, haven't used the latter for a few years so I can't guarantee), one of which is always a default terminal at the BBQ, set as x-terminal-emulator. If you manually open xterm and/or rxvt, they will also read ~/.Xresources.
..gnutella..

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Fri Nov 04, 2016 1:19 am

Okay, edited config.h for dmenu shortcut:
Removed MODKEY, (from *modifier column)
changed p -> Mod4 ("key column)
left function column and on

tried Make:
"config.h:32:8 error: 'Mod4' undeclared here (not in a function)
( Mod4, spawn, \

and then a bunch more warnings and errors, too much to type out

Is there a way to copy terminal text and paste into here? Im used to right click lazy way from XFCE4-terminal... Unsure how much more of the errors and warnings are relevant to post here for help...?
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: 2wm Make Install

Unread post by franksinistra » Fri Nov 04, 2016 3:41 am

Oh come on dude, why did you re-define SUPER/MODKEY outside its #define line? it's already set as Mod1 (ALT button).

change this line

Code: Select all

#define MODKEY Mod1Mask
to

Code: Select all

#define MODKEY Mod4Mask
if you want to send the log, just copy or redirect the output to a file and upload it to gist or pastebin.
rice no more.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: 2wm Make Install

Unread post by machinebacon » Fri Nov 04, 2016 5:54 am

^^ copy-paste: mark text in your terminal, move focus to browser window, left click to activate browser window, press alt-Ins or middle mouse key to paste. put [ code ] and [ /code ] around it.
send log (courtesy of pidsley):

Code: Select all

cat path_to_log.txt | curl -F 'sprunge=<-' http://sprunge.us
..gnutella..

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: 2wm Make Install

Unread post by pidsley » Fri Nov 04, 2016 2:34 pm

He's trying to start dmenu with *just* the mod4 key.
catfood wrote:Can I change Dmenu to just [ Super ] key? or does that conflict with other BBQ keybindings?
I have tried a couple of different ways, and I can't make this work (I can get 2wm to build, but the mod4 key alone doesn't start dmenu.) Even if it does work, I don't think it's a good idea -- this will eventually conflict with other keybinds somewhere. I am not going to put any more effort into trying to make it work.

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: 2wm Make Install

Unread post by catfood » Fri Nov 04, 2016 10:19 pm

pidsley wrote:...trying to start dmenu with *just* the mod4 key
I have tried a couple of different ways, and I can't make this work (I can get 2wm to build, but the mod4 key alone doesn't start dmenu.) Even if it does work, I don't think it's a good idea -- this will eventually conflict with other keybinds somewhere. I am not going to put any more effort into trying to make it work.
Thanks for trying! Some WMs/DEs accept SUPER as its own key, some only seem to accept it as a modifier for other keys, guess this is one of those instances...
I do plan on changing the kernel on my Bleuets USB as well, adding 2wm to Break just seemed like it would be the easier of the 2 options; or so I thought, lol.

Reverted Dmenu shortcut to normal. So everything in config.h is stock now except change to URXVT as terminal choice.
Had to get xclip (alt-INS, ^+alt INS, etc don't seem to paste for some reason. No middle click on netbook either). Weird how I can install xclip and modify 2 scripts for it without an issue, but can't make this.

Error codes on Make 2wm now:

Code: Select all

 break@grill:~/Downloads/2wm-0.1$ make
2wm build options:
CFLAGS   = -g -Wall -O2 -I. -I/usr/include -I/usr/X11R6/include -DVERSION="0.1"
LDFLAGS  = -g -L/usr/lib -lc -L/usr/X11R6/lib -lX11
CC       = cc
CC event.c
In file included from 2wm.h:5:0,
                 from event.c:4:
config.h:43:30: error: ‘tag’ undeclared here (not in a function)
  { MODKEY|ShiftMask,  XK_0,  tag,  { .i = -1 } }, \
                              ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:53:41: error: ‘toggletag’ undeclared here (not in a function)
  { MODKEY|ControlMask|ShiftMask, XK_1,  toggletag, { .i = 0 } }, \
                                         ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:63:24: error: ‘togglemode’ undeclared here (not in a function)
  { MODKEY,   XK_space, togglemode, { 0 } }, \
                        ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:65:21: error: initializer element is not constant
  { MODKEY,   XK_0,  view,  { .i = -1 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:65:21: note: (near initialization for ‘key[31].func’)
  { MODKEY,   XK_0,  view,  { .i = -1 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:66:21: error: initializer element is not constant
  { MODKEY,   XK_1,  view,  { .i = 0 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:66:21: note: (near initialization for ‘key[32].func’)
  { MODKEY,   XK_1,  view,  { .i = 0 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:67:21: error: initializer element is not constant
  { MODKEY,   XK_2,  view,  { .i = 1 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:67:21: note: (near initialization for ‘key[33].func’)
  { MODKEY,   XK_2,  view,  { .i = 1 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:68:21: error: initializer element is not constant
  { MODKEY,   XK_3,  view,  { .i = 2 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:68:21: note: (near initialization for ‘key[34].func’)
  { MODKEY,   XK_3,  view,  { .i = 2 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:69:21: error: initializer element is not constant
  { MODKEY,   XK_4,  view,  { .i = 3 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:69:21: note: (near initialization for ‘key[35].func’)
  { MODKEY,   XK_4,  view,  { .i = 3 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:70:21: error: initializer element is not constant
  { MODKEY,   XK_5,  view,  { .i = 4 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:70:21: note: (near initialization for ‘key[36].func’)
  { MODKEY,   XK_5,  view,  { .i = 4 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:71:21: error: initializer element is not constant
  { MODKEY,   XK_6,  view,  { .i = 5 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:71:21: note: (near initialization for ‘key[37].func’)
  { MODKEY,   XK_6,  view,  { .i = 5 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:72:21: error: initializer element is not constant
  { MODKEY,   XK_7,  view,  { .i = 6 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:72:21: note: (near initialization for ‘key[38].func’)
  { MODKEY,   XK_7,  view,  { .i = 6 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:73:21: error: initializer element is not constant
  { MODKEY,   XK_8,  view,  { .i = 7 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:73:21: note: (near initialization for ‘key[39].func’)
  { MODKEY,   XK_8,  view,  { .i = 7 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:74:21: error: initializer element is not constant
  { MODKEY,   XK_9,  view,  { .i = 8 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
config.h:74:21: note: (near initialization for ‘key[40].func’)
  { MODKEY,   XK_9,  view,  { .i = 8 } }, \
                     ^
event.c:18:1: note: in expansion of macro ‘KEYS’
 KEYS
 ^~~~
event.c: In function ‘keypress’:
event.c:209:2: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
  keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
  ^~~~~~
In file included from 2wm.h:6:0,
                 from event.c:4:
/usr/include/X11/Xlib.h:1687:15: note: declared here
 extern KeySym XKeycodeToKeysym(
               ^~~~~~~~~~~~~~~~
Makefile:18: recipe for target 'event.o' failed
make: *** [event.o] Error 1
Attempted to send to sprunge.us, but unsure if it did anything...? Figured I'd paste here as well in case. Sorry for the length.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: 2wm Make Install

Unread post by pidsley » Fri Nov 04, 2016 10:44 pm

You broke something in config.h. You can make sure by copying config.default.h to config.h, and then making the urxvt change in the copied file. It should build then.

Or you can let us look. To do this, post the output of this command (in your 2wm source code directory):

Code: Select all

cat config.h | curl -F 'sprunge=<-' http://sprunge.us
This will paste the config.h file to sprunge and give you a link. The link will let us see the config file. Like this:

Code: Select all

2wm-0.1 $ cat config.h | curl -F 'sprunge=<-' http://sprunge.us
http://sprunge.us/PjMD
Or you can install the "pastebinit" package and use this command:

Code: Select all

pastebinit config.h
This will also return a link to the pasted code. Post the link here.

Every time you make a change to config.h, you should save a backup copy first. That way you can revert the change if it breaks.

Post Reply