<div dir="ltr"><div></div><div>QUESTION / PROBLEM<br>--------------------------------------------------<br>Hello, I'm running into issues setting up a project to use GLFW as an<br>unpackaged dependency.<br><br>I'm a complete beginner at using build2. This is the first project I'm<br>trying to setup. I have used C++ for a few years, but have never gotten<br>very comfortable with all the C++ toolchains.<br><br>Any form of help would be greatly appreciated.<br><br>(Since the documentation became larger than anticipated I made a copy<br>as a gist <a href="https://gist.github.com/CairX/3e9704c00d8709b8baea664ad53bf508">https://gist.github.com/CairX/3e9704c00d8709b8baea664ad53bf508</a>)<br><br><br>INFORMATION<br>--------------------------------------------------<br>The information I have used to try and get the project setup is based on<br>the official documentation:<br><a href="https://www.build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-unpackaged-deps">https://www.build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-unpackaged-deps</a><br><br>And an earlier mailing list I found here:<br><a href="https://lists.build2.org/archives/users/2018-December/000547.html">https://lists.build2.org/archives/users/2018-December/000547.html</a><br><br><br>SETUP<br>--------------------------------------------------<br>$ pwd<br>/tmp/workspace<br>$ mkdir unpkg-gcc<br><br>$ git clone <a href="https://github.com/glfw/glfw.git">https://github.com/glfw/glfw.git</a><br>$ cd glfw<br>$ git checkout 3.3.2<br>$ mkdir build<br>$ cd build<br>$ cmake -DCMAKE_INSTALL_PREFIX=/tmp/workspace/unpkg-gcc /tmp/workspace/glfw<br>$ make install<br><br>$ cd /tmp/workspace<br>$ tree unpkg-gcc<br>unpkg-gcc<br>├── include<br>│   └── GLFW<br>│       ├── glfw3.h<br>│       └── glfw3native.h<br>└── lib<br>    ├── cmake<br>    │   └── glfw3<br>    │       ├── glfw3Config.cmake<br>    │       ├── glfw3ConfigVersion.cmake<br>    │       ├── glfw3Targets.cmake<br>    │       └── glfw3Targets-noconfig.cmake<br>    ├── libglfw3.a<br>    └── pkgconfig<br>        └── glfw3.pc<br><br>6 directories, 8 files<br><br>$ bdep new -t exe -l c++ hello<br>$ cd hello<br>$ bdep init -C ../hello-gcc @gcc cc config.cxx=g++ config.cc.poptions=-I/tmp/workspace/unpkg-gcc/include config.cc.loptions=-L/tmp/workspace/unpkg-gcc/lib<br>initializing in project /tmp/workspace/hello/<br>created configuration @gcc /tmp/workspace/hello-gcc/ 1 default,forwarded,auto-synchronized<br>synchronizing:<br>  new hello/0.1.0-a.0.19700101000000<br><br>$ b<br>mkdir ../hello-gcc/hello/fsdir{hello/}<br>c++ hello/cxx{hello}@../hello-gcc/hello/hello/<br>ld ../hello-gcc/hello/hello/exe{hello}<br>ln ../hello-gcc/hello/hello/exe{hello} -> hello/<br>$ hello/hello World<br>Hello, World!<br><br><br>ADJUSTMENT NR 1<br>--------------------------------------------------<br>In the documentation it mentions:<br>    "Once this is done, adjust your buildfile to import the library:<br>     import libs += libextra%lib{extra}"<br><br>I took this to mean /tmp/workspace/hello/buildfile<br><br>$ cat buildfile<br>./: {*/ -build/} doc{README.md} manifest<br>import libs += GLFW%lib{glfw3}<br><br>And adjusted main file to use GLFW.<br><br>$ cat hello/hello.cxx<br>#include <GLFW/glfw3.h><br><br>int main(int argc, char * argv[])<br>{<br>    glfwInit();<br>    glfwInitHint(GLFW_CLIENT_API, GLFW_NO_API);<br>    GLFWwindow * window = glfwCreateWindow(800, 600, "Hello", NULL, NULL);<br><br>    while (!glfwWindowShouldClose(window))<br>    {<br>        glfwPollEvents();<br>    }<br><br>    glfwDestroyWindow(window);<br>    glfwTerminate();<br><br>    return 0;<br>}<br><br>$ b<br>c++ hello/cxx{hello}@../hello-gcc/hello/hello/<br>ld ../hello-gcc/hello/hello/exe{hello}<br>/usr/bin/ld: ../hello-gcc/hello/hello/hello.o: in function `main':<br>hello.cxx:(.text+0x10): undefined reference to `glfwInit'<br>/usr/bin/ld: hello.cxx:(.text+0x1f): undefined reference to `glfwInitHint'<br>/usr/bin/ld: hello.cxx:(.text+0x40): undefined reference to `glfwCreateWindow'<br>/usr/bin/ld: hello.cxx:(.text+0x50): undefined reference to `glfwWindowShouldClose'<br>/usr/bin/ld: hello.cxx:(.text+0x5e): undefined reference to `glfwPollEvents'<br>/usr/bin/ld: hello.cxx:(.text+0x6c): undefined reference to `glfwDestroyWindow'<br>/usr/bin/ld: hello.cxx:(.text+0x71): undefined reference to `glfwTerminate'<br>collect2: error: ld returned 1 exit status<br>info: failed to update ../hello-gcc/dir{hello/}<br><br><br>ADJUSTMENT NR 2<br>--------------------------------------------------<br>The documentation mentions that the -L option alone should be enough if<br>there the packages include a .pc file. Since this one does I thought<br>it might reduce the number of moving parts to remove the -I option.<br><br>So reset config.cc.poptions = [null] in<br>/tmp/workspace/hello-gcc/build/config.build<br><br>$ b<br>error: header 'GLFW/glfw3.h' not found and cannot be generated<br>  info: re-run with --verbose=4 for more information<br>  info: while extracting header dependencies from hello/cxx{hello}@../hello-gcc/hello/hello/<br>  info: while applying rule cxx.compile to update ../hello-gcc/hello/hello/obje{hello}<br>  info: while applying rule cxx.link to update ../hello-gcc/hello/hello/exe{hello}<br>  info: while applying rule alias to update ../hello-gcc/hello/dir{hello/}<br>  info: while applying rule alias to update ../hello-gcc/dir{hello/}<br>info: failed to update ../hello-gcc/dir{hello/}<br><br>Which made me think that the -I option was just giving me a false<br>positive. After searching a looking around a lot I remembered seeing a<br>commented out import line in /tmp/workspace/hello/hello/buildfile.<br>Decided to try moving my import there instead.<br><br>$ b<br>error: package 'xproto', required by 'x11', not found<br>  info: while applying rule cxx.link to update ../hello-gcc/hello/hello/exe{hello}<br>  info: while applying rule alias to update ../hello-gcc/hello/dir{hello/}<br>  info: while applying rule alias to update ../hello-gcc/dir{hello/}<br>error: package 'kbproto', required by 'x11', not found<br>  info: while applying rule cxx.link to update ../hello-gcc/hello/hello/exe{hello}<br>  info: while applying rule alias to update ../hello-gcc/hello/dir{hello/}<br>  info: while applying rule alias to update ../hello-gcc/dir{hello/}<br>info: failed to update ../hello-gcc/dir{hello/}<br><br>Which seems to have moved me in the right direction as it seems to be<br>trying to incorporate GLFW into the build this time.<br><br>ADJUSTMENT NR 3<br>--------------------------------------------------<br>I have been investigating a lot into why the packages might not be found.<br><br>Checking that the correct packages are installed which should be<br>x11proto-core-dev which is a dependency of xorg-dev.<br><br>$ apt info xorg-dev<br>Package: xorg-dev<br>Version: 1:7.7+19<br>Priority: optional<br>Section: x11<br>Source: xorg<br>Maintainer: Debian X Strike Force <<a href="mailto:debian-x@lists.debian.org">debian-x@lists.debian.org</a>><br>Installed-Size: 47.1 kB<br>Depends: libdmx-dev, libfontenc-dev, libfs-dev, libice-dev, libsm-dev, libx11-dev, libxau-dev, libxaw7-dev, libxcomposite-dev, libxcursor-dev, libxdamage-dev, libxdmcp-dev, libxext-dev, libxfixes-dev, libxfont-dev, libxft-dev, libxi-dev, libxinerama-dev, libxkbfile-dev, libxmu-dev, libxmuu-dev, libxpm-dev, libxrandr-dev, libxrender-dev, libxres-dev, libxss-dev, libxt-dev, libxtst-dev, libxv-dev, libxvmc-dev, libxxf86dga-dev, libxxf86vm-dev, x11proto-bigreqs-dev, x11proto-composite-dev, x11proto-core-dev, x11proto-damage-dev, x11proto-dmx-dev, x11proto-fixes-dev, x11proto-fonts-dev, x11proto-gl-dev, x11proto-input-dev, x11proto-kb-dev, x11proto-randr-dev, x11proto-record-dev, x11proto-render-dev, x11proto-resource-dev, x11proto-scrnsaver-dev, x11proto-video-dev, x11proto-xcmisc-dev, x11proto-xext-dev, x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86dri-dev, x11proto-xf86vidmode-dev, x11proto-xinerama-dev, xserver-xorg-dev, xtrans-dev<br>Homepage: <a href="http://www.x.org/">http://www.x.org/</a><br>Tag: devel::library, role::devel-lib, role::metapackage<br>Download-Size: 38.2 kB<br>APT-Manual-Installed: yes<br>APT-Sources: <a href="http://deb.debian.org/debian">http://deb.debian.org/debian</a> buster/main amd64 Packages<br>Description: X.Org X Window System development libraries<br> This metapackage provides the development libraries for the X.Org X Window<br> System.<br> .<br> X Window System design documentation, manual pages, library reference<br> works, static versions of the shared libraries, and C header files are<br> supplied by the packages depended on by this metapackage.<br> .<br> Note that this is a convenience package for users and is not a package for<br> Debian developers to have their package depend on.<br><br><br>That the .pc-files exists:<br>$ ls -l /usr/share/pkgconfig/kbproto.pc<br>-rw-r--r-- 1 root root 173 Apr  3  2018 /usr/share/pkgconfig/kbproto.pc<br>$ ls -l /usr/share/pkgconfig/xproto.pc<br>-rw-r--r-- 1 root root 203 Apr  3  2018 /usr/share/pkgconfig/xproto.pc<br><br>That pkg-config looks in the correct location:<br>$ pkg-config --variable pc_path pkg-config<br>/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig<br><br>And made sure that the path is in the environmental variable:<br>$ echo $PKG_CONFIG_PATH<br>/usr/share/pkgconfig<br><br>This is where I'm at a loss.<br><br>Best regards,<br>Thomas Cairns<br><br></div></div>