<div dir="ltr">I have gdal 3.5.0 built using the new cmake system.<div>/chroot/src/build <- cmake build directory</div><div>/chroot/src/gdal <- src directory</div><div>/chroot/src/gdal/swig/python</div><div><br></div><div>My cmake is ran from the /chroot directory:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">cmake -B build -S gdal \<br></font></span><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">      -DCMAKE_BUILD_TYPE='None' \<br></font></span><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">      -DCMAKE_INSTALL_PREFIX='/usr' \<br></font></span><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">      -DBUILD_PYTHON_BINDINGS='OFF' \<br></font></span><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">      -Wno-dev<br></font></span><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)">cmake --build build</font></span></blockquote><div><span style="font-family:monospace"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></span></div><div><font color="#000000" face="arial, sans-serif">Then to make the python bindings via swig:</font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font color="#000000" face="monospace">cd gdal/swig/python<br></font><font color="#000000" face="monospace">python setup.py build</font></blockquote><div><font color="#000000" face="arial, sans-serif"><br></font></div><div><font color="#000000" face="arial, sans-serif">When the `python setup.py build` is running it can't find gdal-config with the following errors:</font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace"><span style="color:rgb(0,0,0)">running build<br>
</span></span><span style="font-family:monospace">running build_py<br>
</span><span style="font-family:monospace">running build_ext<br>
</span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 105, in fetch_config<br>
</span><span style="font-family:monospace">    p = subprocess.Popen([command, args], stdout=subprocess.PIPE)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__<br>
</span><span style="font-family:monospace">    self._execute_child(args, executable, preexec_fn, close_fds,<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child<br>
</span><span style="font-family:monospace">    raise child_exception_type(errno_num, err_msg, err_filename)<br>
</span><span style="font-family:monospace">FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 187, in get_gdal_config<br>
</span><span style="font-family:monospace">    return fetch_config(option, gdal_config=self.gdal_config)<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 108, in fetch_config<br>
</span><span style="font-family:monospace">    raise gdal_config_error(e)<br>
</span><span style="font-family:monospace">__main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 105, in fetch_config<br>
</span><span style="font-family:monospace">    p = subprocess.Popen([command, args], stdout=subprocess.PIPE)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__<br>
</span><span style="font-family:monospace">    self._execute_child(args, executable, preexec_fn, close_fds,<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child<br>
</span><span style="font-family:monospace">    raise child_exception_type(errno_num, err_msg, err_filename)<br>
</span><span style="font-family:monospace">FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 194, in get_gdal_config<br>
</span><span style="font-family:monospace">    return fetch_config(option)<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 108, in fetch_config<br>
</span><span style="font-family:monospace">    raise gdal_config_error(e)<br>
</span><span style="font-family:monospace">__main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 388, in <module><br>
</span><span style="font-family:monospace">    setup(**setup_kwargs)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup<br>
</span><span style="font-family:monospace">    return distutils.core.setup(**attrs)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup<br>
</span><span style="font-family:monospace">    return run_commands(dist)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands<br>
</span><span style="font-family:monospace">    dist.run_commands()<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands<br>
</span><span style="font-family:monospace">    self.run_command(cmd)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command<br>
</span><span style="font-family:monospace">    cmd_obj.run()<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run<br>
</span><span style="font-family:monospace">    self.run_command(cmd_name)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command<br>
</span><span style="font-family:monospace">    self.distribution.run_command(command)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 985, in run_command<br>
</span><span style="font-family:monospace">    cmd_obj.ensure_finalized()<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized<br>
</span><span style="font-family:monospace">    self.finalize_options()<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 257, in finalize_options<br>
</span><span style="font-family:monospace">    self.gdaldir = self.get_gdal_config('prefix')<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 200, in get_gdal_config<br>
</span><span style="font-family:monospace">    raise gdal_config_error(traceback_string + '\n' + msg)<br>
</span><span style="font-family:monospace">__main__.gdal_config_error: Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 105, in fetch_config<br>
</span><span style="font-family:monospace">    p = subprocess.Popen([command, args], stdout=subprocess.PIPE)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__<br>
</span><span style="font-family:monospace">    self._execute_child(args, executable, preexec_fn, close_fds,<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child<br>
</span><span style="font-family:monospace">    raise child_exception_type(errno_num, err_msg, err_filename)<br>
</span><span style="font-family:monospace">FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 187, in get_gdal_config<br>
</span><span style="font-family:monospace">    return fetch_config(option, gdal_config=self.gdal_config)<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 108, in fetch_config<br>
</span><span style="font-family:monospace">    raise gdal_config_error(e)<br>
</span><span style="font-family:monospace">gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 105, in fetch_config<br>
</span><span style="font-family:monospace">    p = subprocess.Popen([command, args], stdout=subprocess.PIPE)<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__<br>
</span><span style="font-family:monospace">    self._execute_child(args, executable, preexec_fn, close_fds,<br>
</span><span style="font-family:monospace">  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child<br>
</span><span style="font-family:monospace">    raise child_exception_type(errno_num, err_msg, err_filename)<br>
</span><span style="font-family:monospace">FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">During handling of the above exception, another exception occurred:
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Traceback (most recent call last):<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 194, in get_gdal_config<br>
</span><span style="font-family:monospace">    return fetch_config(option)<br>
</span><span style="font-family:monospace">  File "/build/gdal/src/gdal/swig/python/setup.py", line 108, in fetch_config<br>
</span><span style="font-family:monospace">    raise gdal_config_error(e)<br>
</span><span style="font-family:monospace">gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
</span><span style="font-family:monospace"><br></span><span style="font-family:monospace">Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.</span></blockquote><div><font color="#000000" face="arial, sans-serif"><br></font></div><div><font color="#000000" face="arial, sans-serif">It's searching for it in ../../apps/gdal-config which is /chroot/gdal/apps but could find it in /chroot/build/apps/gdal-config if it searched there instead. Any way to point `python setup.py build` to look for gdal-config in a custom path or the one that cmake built gdal in?</font></div><div><font color="#000000" face="arial, sans-serif"><br></font></div><div><font color="#000000" face="arial, sans-serif">saultdon</font></div></div>