about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2017-02-08T18·35+0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2017-02-08T19·51+0200
commit2cd468874fe512387820bd47d23fa6351d069da2 (patch)
treec164b754bfee98cc719f4468ef496d9a76419b96 /src/libutil
parent81c53fe8e56f4a4ce10088fe2d7b6a524a6dc126 (diff)
Include config.h implicitly with '-include config.h' in CFLAGS
Because config.h can #define things like _FILE_OFFSET_BITS=64 and not
every compilation unit includes config.h, we currently compile half of
Nix with _FILE_OFFSET_BITS=64 and other half with _FILE_OFFSET_BITS
unset. This causes major havoc with the Settings class on e.g. 32-bit ARM,
where different compilation units disagree with the struct layout.

E.g.:

diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
@@ -166,6 +166,8 @@ void Settings::update()
     _get(useSubstitutes, "build-use-substitutes");
+    fprintf(stderr, "at Settings::update(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes);
     _get(buildUsersGroup, "build-users-group");
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -138,6 +138,8 @@ void RemoteStore::initConnection(Connection & conn)
 void RemoteStore::setOptions(Connection & conn)
 {
+    fprintf(stderr, "at RemoteStore::setOptions(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes);
     conn.to << wopSetOptions

Gave me:

at Settings::update(): &useSubstitutes = 0xb6e5c5cb
at RemoteStore::setOptions(): &useSubstitutes = 0xb6e5c5c7

That was not a fun one to debug!
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/archive.cc2
-rw-r--r--src/libutil/hash.cc2
-rw-r--r--src/libutil/types.hh1
-rw-r--r--src/libutil/util.cc2
4 files changed, 0 insertions, 7 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index fbba7f853f95..e0e6f5dfd73c 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -1,5 +1,3 @@
-#include "config.h"
-
 #include <cerrno>
 #include <algorithm>
 #include <vector>
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index aa50fceb9e3e..f447c80c5d81 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -1,5 +1,3 @@
-#include "config.h"
-
 #include <iostream>
 #include <cstring>
 
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index b9a93d27d2ad..97d79af9b5d6 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -1,6 +1,5 @@
 #pragma once
 
-#include "config.h"
 
 #include "ref.hh"
 
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 6c4c5c969d86..336599368009 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1,5 +1,3 @@
-#include "config.h"
-
 #include "util.hh"
 #include "affinity.hh"
 #include "sync.hh"