0

I started using Cygwin to build my projects, but I don't know how to set it up to find my third party libraries. For example, I placed my directx-headers where they can be found in the system path, but Cygwin, does not seem to search the system path variable.

How can I setup Cygwin to find libraries outside its container in a third party folder, or in my system path on a Windows OS?

Jillinger
  • 172
  • 2
  • 11
  • what program are you trying to build and with which tool ? You can always add any specific directory to the search , but the PATH is not the methode to use – matzeri Mar 12 '21 at 06:33
  • How do I add a specific directory to the search? I would prefer that actually, since I believe Cygwin packages could conflict with other libraries. – Jillinger Mar 12 '21 at 11:34
  • you need to provide more info. What tools are you using ? – matzeri Mar 12 '21 at 11:39
  • I'm on a Windows pc, using Cygwin with all the required packages, trying to build mesa from source. Meson looks for python, cmake, and uses gcc, from what I gathered from the build so far. All of these are available in Cygwin. I'll edit the OP to show this. – Jillinger Mar 12 '21 at 12:56
  • Mesa is already built as Cygwin package, see https://cygwin.com/packages/summary/mesa-src.html . The best way to replicate the build is to download the cygwin source package and build using the `cygport` tool. But it seems you are not building for Cygwin but for Mingw – matzeri Mar 12 '21 at 13:02
  • I'm new to these tools, so I don't understand what you mean. What do you mean by replicate the build, and why is that something I want to do? What am I building? What do you mean by building for Mingw and not Cygwin? I thought I was just building the libraries for mesa, so that i can use them, as they are required by a tool i want to use. Thanks for the link. I did not know it was so readily available. I was searching for the egl libraries and was coming up empty - except from building the source. – Jillinger Mar 12 '21 at 13:12
  • You said I can always add any specific directory to the search. can you show me how to do that? that was the purpose of the post. – Jillinger Mar 12 '21 at 13:20

2 Answers2

0

as reported on Meson manual

https://mesonbuild.com/Commands.html

$ meson configure [-h] [--prefix PREFIX] [--bindir BINDIR]
                  [--datadir DATADIR] [--includedir INCLUDEDIR]
                  [--infodir INFODIR] [--libdir LIBDIR]
                  [--libexecdir LIBEXECDIR] [--localedir LOCALEDIR]
 .....

you can use the --includedir INCLUDEDIRfor the includes and --libdir LIBDIR for the import libraries

matzeri
  • 8,062
  • 2
  • 15
  • 16
  • Thanks. So rather than use configure, I can use setup as well, right? meson setup [-h] [--prefix PREFIX] [--bindir BINDIR] [--datadir DATADIR] [--includedir INCLUDEDIR] [--infodir INFODIR] [--libdir LIBDIR] [--libexecdir LIBEXECDIR] – Jillinger Mar 12 '21 at 15:35
  • it appears the commands --bindir --libdir etc., are all associated with where the libraries will be built, rather than where the libraries will be searched for during a build. meson.build:21:0: ERROR: The value of the 'includedir' option is '/cygdrive/e/ThirdParty/Windows/DirectX/Include' which must be a subdir of the prefix '/cygdrive/c/dev/mesa'. Note that if you pass a relative path, it is assumed to be a subdir of prefix. Which is not what I want. – Jillinger Mar 12 '21 at 20:16
0

I believe the answer is with using PKG_CONFIG_PATH, as defined here, and in the answer given here.

I also found this on the github page of the directx-headers...

Pkg-config: Use Meson to build this project, and the resulting installed package can be found via pkg-config.

Found this answer, also useful.

Finally, I found this, which was useful, and provided the information I wanted to know regarding Cygwin searching the PATH.

Significantly Edited [SOLVED] - The solution : Guide to pkg-config

On a typical Unix system, it will search in the directories /usr/lib/pkgconfig and /usr/share/pkgconfig. This will usually cover system installed modules. However, some local modules may be installed in a different prefix such as /usr/local. In that case, it's necessary to prepend the search path so that pkg-config can locate the .pc files.

$ pkg-config --modversion hello 

Package hello was not found in the pkg-config search path. Perhaps you should add the directory containing `hello.pc' to the PKG_CONFIG_PATH environment variable No package 'hello' found

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 
$ pkg-config --modversion hello 

1.0.0

What was required is using export VAR=value(or path-to-directory) After this, the path will be found successfully.

So to find Third-Party libraries etc., simply use the export variable command.

Jillinger
  • 172
  • 2
  • 11