Build error in WinDRBD 1.2.1

I compiled WinDRBD 1.2.1 from source, I doubt /windrbd/drbd-utils/user/shared/drbd_buildtag.h has trouble.

The steps are as follows.

1.pull docker image from registry.

user@ubuntu:~/windrbd$ make pull-docker
docker pull quay.io/johannesthoma/windrbd-devenv
Using default tag: latest
latest: Pulling from johannesthoma/windrbd-devenv
... skip ...
Digest: sha256:edecd1283bb39e826ecfcee0e074fb45a191ca5b84356d020aac60e4812c3959
Status: Downloaded newer image for quay.io/johannesthoma/windrbd-devenv:latest
quay.io/johannesthoma/windrbd-devenv:latest
docker tag quay.io/johannesthoma/windrbd-devenv windrbd-devenv

2.make package-in-docker gets error.

user@ubuntu:~/windrbd$ make package-in-docker
DOCKER  windrbd-devenv
make: Entering directory '/windrbd'
... skip ...
MAKE    generate-cat-file (see generate-cat-file-make.log for build logs)
GENCAT  windrbd.cat-unsigned
SIGN    windrbd.cat
Succeeded
AUTOGEN drbd-utils (see drbd-utils-autogen.log for logs)
CONF    drbd-utils (see drbd-utils-configure.log for logs)
MAKE    drbd-utils (see drbd-utils-make.log for logs)
make[1]: Entering directory '/windrbd/drbd-utils'
make[2]: Entering directory '/windrbd/drbd-utils/user/shared'
flex -s -odrbdmeta_scanner.c drbdmeta_scanner.fl
./drbd_buildtag.sh drbd_buildtag.h
fatal: not a git repository: /home/user/windrbd/.git/modules/drbd-utils
/windrbd/drbd-utils/user/shared/drbd_buildtag.h not found.
git did not work, but this looks like a git checkout?
./drbd_buildtag.sh: line 18: Install git and try again.: command not found
Your DRBD source tree is broken. Unpack again.
make[2]: *** [Makefile:69: drbd_buildtag.h] Error 1
make[2]: Leaving directory '/windrbd/drbd-utils/user/shared'
make[1]: *** [Makefile:85: tools] Error 2
make[1]: Leaving directory '/windrbd/drbd-utils'
make: *** [Makefile:345: drbd-utils] Error 1
make: Leaving directory '/windrbd'
Makefile:143: recipe for target 'package-in-docker' failed
make: *** [package-in-docker] Error 2

3.check drbd_build.sh

user@ubuntu:~/windrbd/drbd-utils$ cd ./drbd-utils/user/shared/
user@ubuntu:~/windrbd/drbd-utils$ vi drbd_buildtag.sh

I think drbd_buildtag.sh gets .git file from path. check .git files:

user@ubuntu:~/windrbd/drbd-utils$ find /home/user/windrbd -name *.git -type f
/home/user/windrbd/drbd-9.1/drbd/drbd-headers/.git
/home/user/windrbd/drbd-9.1/.git
/home/user/windrbd/drbd-9.0/drbd/drbd-headers/.git
/home/user/windrbd/drbd-9.0/.git
/home/user/windrbd/generate-cat-file/.git
/home/user/windrbd/drbd-utils/drbd-headers/.git
/home/user/windrbd/drbd-utils/.git
/home/user/windrbd/drbd-9.3/drbd/drbd-headers/.git
/home/user/windrbd/drbd-9.3/.git
/home/user/windrbd/drbd-9.2/drbd/drbd-headers/.git
/home/user/windrbd/drbd-9.2/.git

user@ubuntu:~/windrbd/drbd-utils/user/shared$ file ../../.git
../../.git: ASCII text

user@ubuntu:~/windrbd/drbd-utils/user/shared$ cat ../../.git
gitdir: /home/user/windrbd/.git/modules/drbd-utils
-> no line have GITHEAD and GITDIFF

4.build drbd-utils on windows, and get drbd_build.sh.
on linux side, glone drbd-utils from git,and compress them.

$ cd ~
$ git clone https://github.com/LINBIT/drbd-utils.git drbd-utils-windrbd
$ tar cvzf ./drbd-utils-windrbd.tar.gz ./drbd-utils-windrbd/

on windows side(cygwin environment), uncompress archive and make, get drbd_buildtag.h.

$ tar xvzf drbd-utils-windrbd.tar.gz
$ cd ./drbd-utils-windrbd
$ ./autogen.sh
$ ./configure --without-84support --without-drbdmon --with-windrbd --without-manual --prefix=/cygdrive/c/windrbd/usr --localstatedir=/cygdrive/c/windrbd/var --sysconfdir=/cygdrive/c/windrbd/etc
    
$ make
   ... skip ...
   Userland tools build was successful.
   ... skip ...

$ cat ./user/shared/drbd_buildtag.h
/* automatically generated. DO NOT EDIT. */
#define GITHASH "75a475425bb5989a25b2770d7f0491cea7f69b54"
#define GITDIFF ""

5.copy drbd_buildtag.h from windows side, paste it on linux side, try make

user@ubuntu:~$ copy ./drbd_buildtag.h ./windrbd/drbd-utils/user/shared

user@ubuntu:~$ cat ./windrbd/drbd-utils/user/shared/drbd_buildtag.h
/* automatically generated. DO NOT EDIT. */
#define GITHASH "75a475425bb5989a25b2770d7f0491cea7f69b54"
#define GITDIFF ""

user@ubuntu:~$ cd ./windrbd/

user@ubuntu:~/windrbd$ make package-in-docker
DOCKER  windrbd-devenv
make: Entering directory '/windrbd'
... skip ....
tail -n 2 inno-setup.log
Successful compile (24.827 sec). Resulting Setup program filename is:
Z:\windrbd\inno-setup\install-windrbd-1.2.1-drbd-9.2-x86_64.exe
make: Leaving directory '/windrbd'
DOCKER  (fixup ownership)

user@ubuntu:~/windrbd$ ls ./inno-setup/*.exe
./inno-setup/install-windrbd-1.2.1-drbd-9.2-x86_64.exe
-> success!!

Hi, how did you check out the WinDRBD repository originally? Also could you please post the .gitmodules file? You will find it in the project’s root directory.

Also, which git version did you use for cloning the WinDRBD repository?

Hi, clone from github.

.gitmodules has no url line.

user@ubuntu:~/windrbd$ cat ./.gitmodules
[submodule "generate-cat-file"]
        path = generate-cat-file
        url = ../generate-cat-file
[submodule "drbd-utils"]
        path = drbd-utils
        url = ../drbd-utils.git
        fetchRecurseSubmodules = true
[submodule "drbd-9.1"]
        path = drbd-9.1
        url = ../drbd.git
        fetchRecurseSubmodules = true
[submodule "drbd-9.2"]
        path = drbd-9.2
        url = ../drbd.git
        branch = drbd-9.2
        fetchRecurseSubmodules = true
[submodule "drbd-9.0"]
        path = drbd-9.0
        url = ../drbd.git
        branch = drbd-9.0
        fetchRecurseSubmodules = true
[submodule "drbd-9.3"]
        path = drbd-9.3
        url = ../drbd

very old… I’ll try latest git from update.

user@ubuntu:~/windrbd$ LANG=C apt list --installed | grep -i ^git
git/now 1:2.7.4-0ubuntu1.9 amd64 [installed,upgradable to: 1:2.7.4-0ubuntu1.10]
git-man/now 1:2.7.4-0ubuntu1.9 all [installed,upgradable to: 1:2.7.4-0ubuntu1.10]

user@ubuntu:~/windrbd$ LANG=C git --version
git version 2.7.4

In Ubuntu 24.04 Environment, the build going well.
Thanks Johannes :))

Previous environment is Ubuntu 16.04, so old…

In Ubuntu Server 24.04LTS Environment , to make full build up environment, I’ve done as follows.

1.apply proxy setting for apt, if you need

$ sudo cat /etc/apt/apt.conf.d/90curtin-aptproxy
Acquire::http::Proxy "http://xx.xx.xx.xx:yyyy/";
Acquire::https::Proxy "http://xx.xx.xx.xx:yyyy/";  

2.install additional packages

$ sudo apt-get install build-essential
$ sudo apt-get install coccinelle
$ sudo apt-get install flex autotools-dev automake

3.remove old docker packages

$ for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
$ sudo apt autoremove

4.install packages for Docker installation

$ sudo apt update
$ sudo apt install ca-certificates curl

5.install Docker Official GPG Key

$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -x http://xx.xx.xx.xx:yyyy/ -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
  (if your environment is not under proxy, no -x)
$ sudo chmod a+r /etc/apt/keyrings/docker.asc

6.add Docker Official repository

$ echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
    $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list

update repository index

$ sudo apt-get update

7.install Docker CE

$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

check docker version

$ sudo docker -v

check service

$ sudo systemctl status docker

set permission for docker socket

$ sudo chmod 666 /var/run/docker.sock

8.if your environment is under proxy, set proxy information for docker

make proxy configure file

$ sudo mkdir /etc/systemd/system/docker.service.d
$ cd /etc/systemd/system/docker.service.d
$ sudo touch http-proxy.conf

write your proxy information

$ sudo cat http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://xx.xx.xx.xx:yyyy/"
Environment="HTTPS_PROXY=http://xx.xx.xx.xx:yyyy/"
Environment="NO_PROXY="localhost,127.0.0.1,::1"

restart docker

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ cd ~  

9.build WinDRBD

if your environmet is under proxy, set proxy information for git

$ git config --global http.proxy http://xx.xx.x.x:yyyy/
$ git config -l

build source

$ cd ~
$ git clone --branch windrbd-1.2 --recursive https://github.com/LINBIT/windrbd.git
$ cd ./windrbd
$ make pull-docker
$ make package-in-docker
  ... skip ...
  Successful compile (24.250 sec). Resulting Setup program filename is:
  Z:\windrbd\inno-setup\install-windrbd-1.2.1-drbd-9.2-x86_64.exe
  make: Leaving directory '/windrbd'
  DOCKER  (fixup ownership)

check installable file

$ ls ./inno-setup/install*
  ./inno-setup/install-windrbd-1.2.1-drbd-9.2-x86_64.exe

Hi thanks for sharing your findings, I am not sure if all of the above steps are necessary but I didn’t try it on a Ubuntu 24 yet. And yes Ubuntu 16 is probably too old, I am using Ubuntu 18 and come to the limits there (I am using Fedora 42 for newer builds, there it even works without a docker image).

Hi.

The GIT documentation doesn’t have any instructions how to create a build environment. So I was looking into that.
ttps://github.com/LINBIT/windrbd/blob/stable/README.md

Ubuntu 16.04LTS was too old, it’s my mistake.
I’m impressed with the idea of generating Windows binaries in a Docker image.However, I was struggled because this wasn’t mentioned in the build instructions :frowning:

I hope it helps someone doing the same thing.