botan icon indicating copy to clipboard operation
botan copied to clipboard

FIX: ./configure.py --with-build-dir=

Open reneme opened this issue 1 year ago • 5 comments

Running ./configure.py --with-build-dir=mybuild didn't work properly, because it produced a Makefile/ninja.build with paths relative to the base-directory of the configure.py invocation (i.e. argv[0]). It did work when invoking it like that: $(pwd)/configure.py --with-build-dir=mybuild.

For instance, problems arise when trying to package Botan with a script like this:

$~/pkg_tmp> git clone https://github.com/randombit/botan.git botan_src
[ ... ]
$~/pkg_tmp> botan_src/configure.py --with-build-dir=botan_build
[ ... ]
$~/pkg_tmp> make -C botan_build
make: Entering directory '.../botan_build'
make: *** No rule to make target 'botan/src/lib/asn1/alg_id.cpp', needed by 'botan_build/build/obj/lib/asn1_alg_id.o'.  Stop.
make: Leaving directory '.../botan_build'

The idea behind this patch is to always produce absolute paths from the Makefile/ninja.build into the source tree that may be located somewhere else. As a side effect, this allows us to remove a mingw workaround. Also, I cleaned up the ninja.build of botan_bogo_shim and botan_ct_selftest that both dropped their intermediate object files in the top-level build directory.

Closes #4232 Closes #4342

reneme avatar Jul 22 '24 15:07 reneme

Coverage Status

coverage: 90.668% (-0.003%) from 90.671% when pulling d39aa9190b1508fcd411df3866cb82ecf0bb7b05 on Rohde-Schwarz:fix/configure_paths into 14e54e7a15ae2392fc4f010bb39830cc9d50365d on randombit:master.

coveralls avatar Jul 22 '24 16:07 coveralls

Rebased to master (to resolve a conflict with #4336).

reneme avatar Sep 10 '24 06:09 reneme

Turns out that listing all the object files with their absolute path can overwhelm Windows' upper limit on command lengths. I'll have a look into that as soon as I can.

reneme avatar Sep 10 '24 09:09 reneme

Rebased after #4350 was merged.

reneme avatar Oct 07 '24 11:10 reneme

Turns out that listing all the object files with their absolute path can overwhelm Windows' upper limit on command lengths. I'll have a look into that as soon as I can.

... okay. One year later. 🫨 That slipped, big time. Anyway, I recently needed --with-build-dir= for some Conan shenanigans and realized that it still doesn't work as expected on master. So here we are.

@randombit This should now finally be ready to go in. I added one more commit that uses relative paths for object files, relative to the Makefile or build.ninja. That should hopefully fix the remaining "path too long" issues on Windows.

reneme avatar Sep 29 '25 12:09 reneme