building dwl fails with c99: illegal option -- p

im trying to build dwl and get this error when i run make

c99: illegal option -- p

i know there is a dwl package but i dont want to use that because dwl is something you usually compile
and the package also installs the foot terminal and bemenu-run

clone dwl with git

Code:
git clone https://codeberg.org/dwl/dwl.git

install required dependencies

i installed these packages following the list of dependencies from the dwl git page and the freebsd port

Code:
sudo pkg install evdev-proto wayland-protocols gmake pkgconf libxcb libinput wayland wlroots libxkbcommon xcb-util-wm

i copied the config.def.h to config.h

Code:
cp config.def.h config.h

then ran make

Code:
make

and got this error

Code:
make
c99  `pkg-config --cflags wlroots wayland-server xkbcommon libinput ` -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"`git describe --tags --dirty 2>/dev/null || echo 0.5`\"  -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion -O -c dwl.c
c99: illegal option -- p
usage: c99 [-cEgs] [-D name[=value]] ... [-I directory] ... [-L directory] ...
       [-o outfile] [-O optlevel] [-U name] ... operand ...
*** Error code 1

Stop.

on the dwl port page on freshports
i noticed this

USES:
compiler:c11 gmake pkgconfig xorg

i tried using gmake but got the same error

is the error related to the compiler
when i run make i see mentions of c99 and the ports page mentions c11

anyone got any ideas what the issue could be

these are the dependencies listed on the dwl git page

libinput
wayland
wlroots (compiled with the libinput backend)
xkbcommon
wayland-protocols (compile-time only)
pkg-config (compile-time only)

and these are the dependencies listed on the dwl freebsd port

Build dependencies:

evdev-proto>0 : devel/evdev-proto
wayland-protocols>0 : graphics/wayland-protocols
gmake>=4.3 : devel/gmake
pkgconf>=1.3.0_1 : devel/pkgconf
xcb.pc : x11/libxcb

Runtime dependencies:

foot : x11/foot
bemenu-run : x11/bemenu
xcb.pc : x11/libxcb

Library dependencies:

libwayland-server.so : graphics/wayland
libwlroots.so : x11-toolkits/wlroots
libinput.so : x11/libinput
libxkbcommon.so : x11/libxkbcommon
libxcb-icccm.so : x11/xcb-util-wm
 
By all means use the port for building. The initial reason ports exist is to port non-portable parts of code and build systems....

Edit: Looking at the port now, so this is one of these braindead projects claiming runtime configuration was "bloat" ... well anyways, of course the port supports building with your own config.h, just read what it prints (and then set DWL_CONF):
Code:
pre-everything::
    @${ECHO_MSG} "To build ${PORTNAME} with your own config.h set ${PORTNAME:tu}_CONF variable"
    @${ECHO_MSG} "either in ${.CURDIR:T}/Makefile.local, make.conf(5), environ(7) or command line e.g.,"
    @${ECHO_MSG} "\$$ make install clean ${PORTNAME:tu}_CONF=/path/to/${PORTNAME}/config.h"
    @${ECHO_MSG}
    @${ECHO_MSG} "To apply your own patches set ${PORTNAME:tu}_PATCHES (like ${PORTNAME:tu}_CONF)"
    @${ECHO_MSG} "to a list of files separated by space with optional -pX suffix e.g.,"
    @${ECHO_MSG} "\$$ make install clean ${PORTNAME:tu}_PATCHES='/path/to/foo.patch:-p1'"
 
I can build it by mimicking ports.
But then I think you should use ports.
Code:
git clone https://codeberg.org/dwl/dwl.git
cd dwl
cp config.def.h config.h
sed -i'' -e s/_POSIX_C_SOURCE=200809L/_XOPEN_SOURCE=700/ Makefile
gmake CC=cc CFLAGS+='-std=c11' XWAYLAND="-DXWAYLAND" XLIBS="xcb xcb-icccm"
 
I can build it by mimicking ports.
But then I think you should use ports.
Code:
git clone https://codeberg.org/dwl/dwl.git
cd dwl
cp config.def.h config.h
sed -i'' -e s/_POSIX_C_SOURCE=200809L/_XOPEN_SOURCE=700/ Makefile
gmake CC=cc CFLAGS+='-std=c11' XWAYLAND="-DXWAYLAND" XLIBS="xcb xcb-icccm"

Managed to build dwl with charlies tip, cheers mate

i must have missed that code charlie where did it come from,
probably didnt look hard enough but it was late at night

i installed the dwlb bar with pkg and started dwl with

Code:
exec dbus-launch --exit-with-session dwl -s 'dwlb -font "monospace:size=16"'

i was having lots of crashes with wayfire recently so hopefully dwl works better

i may have a look at using the dwl and building it with poudriere
to disable foot and bmenu-run, im using alacritty and tofi

i didnt know you could use your own config.h with the port
however at this stage its probably easy to get the config.h working properly first before adding another layer of complexity

i just need to go through the config and figure out stuff like specifying the screen layout,
key binding etc

if anyone one has any dwl tips or tricks that might be useful let me know

and big up the freebsd forum
 
Back
Top