* Support i686-linux builds directly on x86_64-linux Nix
installations. This is implemented using the personality() syscall, which causes uname to return "i686" in child processes.
This commit is contained in:
		
							parent
							
								
									8e39d9bdb3
								
							
						
					
					
						commit
						c504d90c11
					
				
					 2 changed files with 24 additions and 2 deletions
				
			
		|  | @ -100,12 +100,17 @@ AC_CHECK_HEADERS([sys/mount.h], [], [], | ||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Check for <locale> | # Check for <locale>. | ||||||
| AC_LANG_PUSH(C++) | AC_LANG_PUSH(C++) | ||||||
| AC_CHECK_HEADERS([locale], [], [], []) | AC_CHECK_HEADERS([locale], [], [], []) | ||||||
| AC_LANG_POP(C++) | AC_LANG_POP(C++) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | # Check whether we have the personality() syscall, which allows us to | ||||||
|  | # do i686-linux builds on x86_64-linux machines. | ||||||
|  | AC_CHECK_HEADERS([sys/personality.h]) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| AC_DEFUN([NEED_PROG], | AC_DEFUN([NEED_PROG], | ||||||
| [ | [ | ||||||
| AC_PATH_PROG($1, $2) | AC_PATH_PROG($1, $2) | ||||||
|  |  | ||||||
|  | @ -40,6 +40,12 @@ | ||||||
| #define CHROOT_ENABLED HAVE_CHROOT && HAVE_UNSHARE && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(CLONE_NEWNS) | #define CHROOT_ENABLED HAVE_CHROOT && HAVE_UNSHARE && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(CLONE_NEWNS) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | #if HAVE_SYS_PERSONALITY_H | ||||||
|  | #include <sys/personality.h> | ||||||
|  | #define CAN_DO_LINUX32_BUILDS | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| namespace nix { | namespace nix { | ||||||
| 
 | 
 | ||||||
| using std::map; | using std::map; | ||||||
|  | @ -1474,7 +1480,11 @@ void DerivationGoal::startBuilder() | ||||||
|         format("building path(s) %1%") % showPaths(outputPaths(drv.outputs))) |         format("building path(s) %1%") % showPaths(outputPaths(drv.outputs))) | ||||||
|      |      | ||||||
|     /* Right platform? */ |     /* Right platform? */ | ||||||
|     if (drv.platform != thisSystem) |     if (drv.platform != thisSystem  | ||||||
|  | #ifdef CAN_DO_LINUX32_BUILDS | ||||||
|  |         && !(drv.platform == "i686-linux" && thisSystem == "x86_64-linux") | ||||||
|  | #endif | ||||||
|  |         ) | ||||||
|         throw BuildError( |         throw BuildError( | ||||||
|             format("a `%1%' is required to build `%3%', but I am a `%2%'") |             format("a `%1%' is required to build `%3%', but I am a `%2%'") | ||||||
|             % drv.platform % thisSystem % drvPath); |             % drv.platform % thisSystem % drvPath); | ||||||
|  | @ -1806,6 +1816,13 @@ void DerivationGoal::startBuilder() | ||||||
|              |              | ||||||
|             initChild(); |             initChild(); | ||||||
| 
 | 
 | ||||||
|  | #ifdef CAN_DO_LINUX32_BUILDS | ||||||
|  |             if (drv.platform == "i686-linux" && thisSystem == "x86_64-linux") { | ||||||
|  |                 if (personality(PER_LINUX32_3GB) == -1) | ||||||
|  |                     throw SysError("cannot set i686-linux personality"); | ||||||
|  |             } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|             /* Fill in the environment. */ |             /* Fill in the environment. */ | ||||||
|             Strings envStrs; |             Strings envStrs; | ||||||
|             for (Environment::const_iterator i = env.begin(); |             for (Environment::const_iterator i = env.begin(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue