the hash sum that identifies the build. The list separator is semicolon on
Windows systems and colon on other systems.
-*hard_link* (*CCACHE_HARDLINK* or *CCACHE_NOHARDLINK*, see <<_boolean_values,Boolean values>> above)::
-
- If true, ccache will attempt to use hard links from the cache directory
- when creating the compiler output rather than using a file copy. Hard links
- are never made for compressed cache files. This means that you should not
- enable compression if you want to use hard links. The default is false.
-+
-WARNING: Do not enable this option unless you are aware of the consequences.
-Using hard links may be slightly faster in some situations, but there are
-several pitfalls since the resulting object file will share i-node with the
-cached object file:
-+
-1. If the resulting object file is modified in any way, the cached object file
- will be modified as well. For instance, if you run `strip object.o` or `echo
- >object.o`, you will corrupt the cache.
-2. Programs that rely on modification times (like ``make'') can be confused
- since ccache updates the cached files' modification times as part of the
- automatic cache size management. This will affect object files in the build
- tree as well, which can retrigger the linking step even though nothing
- really has changed.
-
*hash_dir* (*CCACHE_HASHDIR* or *CCACHE_NOHASHDIR*, see <<_boolean_values,Boolean values>> above)::
If true (which is the default), ccache will include the current working
conditions should to be met:
* Use the same cache directory.
-* Make sure that the configuration setting *hard_link* is false (which is the
- default).
* Make sure that all users are in the same group.
* Set the configuration setting *umask* to 002. This ensures that cached files
are accessible to everyone in the group.
----
--
-The reason to avoid the hard link mode is that the hard links cause unwanted
-side effects, as all links to a cached file share the file's modification
-timestamp. This results in false dependencies to be triggered by
-timestamp-based build systems whenever another user links to an existing file.
-Typically, users will see that their libraries and binaries are relinked
-without reason.
-
You may also want to make sure that a base directory is set appropriately, as
discussed in a previous section.
environment["CCACHE_COMPILERCHECK"] = options.compilercheck
if options.compression:
environment["CCACHE_COMPRESS"] = "1"
- if options.hardlink:
- environment["CCACHE_HARDLINK"] = "1"
if options.nostats:
environment["CCACHE_NOSTATS"] = "1"
" files (default: %s)" % DEFAULT_DIRECTORY
),
)
- op.add_option("--hardlink", help="use hard links", action="store_true")
op.add_option(
"--hit-factor",
help=(
)
print("Compilercheck:", options.compilercheck)
print("Compression:", on_off(options.compression))
- print("Hardlink:", on_off(options.hardlink))
print("Nostats:", on_off(options.nostats))
tmp_dir = "%s/perfdir.%d" % (abspath(options.directory), getpid())
args_add(args, "-o");
args_add(args, output_obj);
- if (conf->hard_link) {
- x_unlink(output_obj);
- }
-
if (generating_diagnostics) {
args_add(args, "--serialize-diagnostics");
args_add(args, output_dia);
conf->direct_mode = true;
conf->disable = false;
conf->extra_files_to_hash = x_strdup("");
- conf->hard_link = false;
conf->hash_dir = true;
conf->ignore_headers_in_manifest = x_strdup("");
conf->keep_comments_cpp = false;
ok &= print_item(conf, "direct_mode", printer, context);
ok &= print_item(conf, "disable", printer, context);
ok &= print_item(conf, "extra_files_to_hash", printer, context);
- ok &= print_item(conf, "hard_link", printer, context);
ok &= print_item(conf, "hash_dir", printer, context);
ok &= print_item(conf, "ignore_headers_in_manifest", printer, context);
ok &= print_item(conf, "keep_comments_cpp", printer, context);
bool direct_mode;
bool disable;
char *extra_files_to_hash;
- bool hard_link;
bool hash_dir;
char *ignore_headers_in_manifest;
bool keep_comments_cpp;
direct_mode, ITEM(direct_mode, bool)
disable, ITEM(disable, bool)
extra_files_to_hash, ITEM(extra_files_to_hash, env_string)
-hard_link, ITEM(hard_link, bool)
hash_dir, ITEM(hash_dir, bool)
ignore_headers_in_manifest, ITEM(ignore_headers_in_manifest, env_string)
keep_comments_cpp, ITEM(keep_comments_cpp, bool)
DISABLE, "disable"
EXTENSION, "cpp_extension"
EXTRAFILES, "extra_files_to_hash"
-HARDLINK, "hard_link"
HASHDIR, "hash_dir"
IGNOREHEADERS, "ignore_headers_in_manifest"
LIMIT_MULTIPLE, "limit_multiple"
debug_prefix_map
split_dwarf
masquerading
-hardlink
direct
direct_gcc
depend
+++ /dev/null
-SUITE_hardlink_PROBE() {
- touch file1
- if ! ln file1 file2 >/dev/null 2>&1; then
- echo "file system doesn't support hardlinks"
- fi
-}
-
-SUITE_hardlink() {
- # -------------------------------------------------------------------------
- TEST "CCACHE_HARDLINK"
-
- generate_code 1 test1.c
-
- $REAL_COMPILER -c -o reference_test1.o test1.c
-
- $CCACHE_COMPILE -c test1.c
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_stat 'files in cache' 1
- expect_equal_object_files reference_test1.o test1.o
-
- CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c
- expect_stat 'cache hit (preprocessed)' 1
- expect_stat 'cache miss' 1
- expect_stat 'files in cache' 1
- expect_equal_object_files reference_test1.o test1.o
-
- local obj_in_cache
- obj_in_cache=$(find $CCACHE_DIR -name '*.o')
- if [ ! $obj_in_cache -ef test1.o ]; then
- test_failed "Object file not hard-linked to cached object file"
- fi
-
- # -------------------------------------------------------------------------
- TEST "Overwrite assembler"
-
- generate_code 1 test1.c
- $REAL_COMPILER -S -o test1.s test1.c
-
- $REAL_COMPILER -c -o reference_test1.o test1.s
-
- CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 1
- expect_stat 'files in cache' 1
-
- generate_code 2 test1.c
- $REAL_COMPILER -S -o test1.s test1.c
-
- CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s
- expect_stat 'cache hit (preprocessed)' 0
- expect_stat 'cache miss' 2
- expect_stat 'files in cache' 2
-
- generate_code 1 test1.c
- $REAL_COMPILER -S -o test1.s test1.c
-
- CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s
- expect_stat 'cache hit (preprocessed)' 1
- expect_stat 'cache miss' 2
- expect_stat 'files in cache' 2
- expect_equal_object_files reference_test1.o test1.o
-
- # -------------------------------------------------------------------------
- TEST "Automake depend move"
-
- unset CCACHE_NODIRECT
-
- generate_code 1 test1.c
-
- CCACHE_HARDLINK=1 CCACHE_DEPEND=1 $CCACHE_COMPILE -c -MMD -MF test1.d.tmp test1.c
- expect_stat 'cache hit (direct)' 0
- mv test1.d.tmp test1.d || test_failed "first mv failed"
-
- CCACHE_HARDLINK=1 CCACHE_DEPEND=1 $CCACHE_COMPILE -c -MMD -MF test1.d.tmp test1.c
- expect_stat 'cache hit (direct)' 1
- mv test1.d.tmp test1.d || test_failed "second mv failed"
-
-}
#include "framework.h"
#include "util.h"
-#define N_CONFIG_ITEMS 34
+#define N_CONFIG_ITEMS 33
static struct {
char *descr;
char *origin;
CHECK(conf->direct_mode);
CHECK(!conf->disable);
CHECK_STR_EQ("", conf->extra_files_to_hash);
- CHECK(!conf->hard_link);
CHECK(conf->hash_dir);
CHECK_STR_EQ("", conf->ignore_headers_in_manifest);
CHECK(!conf->keep_comments_cpp);
"direct_mode = false\n"
"disable = true\n"
"extra_files_to_hash = a:b c:$USER\n"
- "hard_link = true\n"
"hash_dir = false\n"
"ignore_headers_in_manifest = a:b/c\n"
"keep_comments_cpp = true\n"
CHECK(!conf->direct_mode);
CHECK(conf->disable);
CHECK_STR_EQ_FREE1(format("a:b c:%s", user), conf->extra_files_to_hash);
- CHECK(conf->hard_link);
CHECK(!conf->hash_dir);
CHECK_STR_EQ("a:b/c", conf->ignore_headers_in_manifest);
CHECK(conf->keep_comments_cpp);
false,
true,
"efth",
- true,
.hash_dir = false,
"ihim",
true,
CHECK_STR_EQ("direct_mode = false", received_conf_items[n++].descr);
CHECK_STR_EQ("disable = true", received_conf_items[n++].descr);
CHECK_STR_EQ("extra_files_to_hash = efth", received_conf_items[n++].descr);
- CHECK_STR_EQ("hard_link = true", received_conf_items[n++].descr);
CHECK_STR_EQ("hash_dir = false", received_conf_items[n++].descr);
CHECK_STR_EQ("ignore_headers_in_manifest = ihim",
received_conf_items[n++].descr);