Skip to content

Commit

Permalink
Merge pull request #1051 from alexcrichton/fix-apple
Browse files Browse the repository at this point in the history
Fix OSX builders on CI
  • Loading branch information
alexcrichton authored Aug 1, 2018
2 parents e1ebfaf + e6bc44b commit 5090477
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 27 deletions.
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ matrix:
- env: TARGET=i686-unknown-linux-gnu
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
osx_image: xcode8.3
osx_image: xcode9.4
- os: osx
env: TARGET=i686-apple-darwin
osx_image: xcode8.3
osx_image: xcode9.4
- env: TARGET=arm-linux-androideabi
- env: TARGET=aarch64-linux-android
# FIXME(#826) should reenable
Expand All @@ -59,14 +59,14 @@ matrix:
# FIXME(#856)
rust: 1.22.1
- os: osx
osx_image: xcode8.2
osx_image: xcode9.4
env: TARGET=i386-apple-ios
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
before_install:
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
- os: osx
osx_image: xcode8.2
osx_image: xcode9.4
env: TARGET=x86_64-apple-ios
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
Expand All @@ -91,15 +91,15 @@ matrix:
rust: beta
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
osx_image: xcode8.3
osx_image: xcode9.4
rust: beta

# nightly
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
rust: nightly
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
osx_image: xcode8.3
osx_image: xcode9.4
rust: nightly
# not available on stable
# without --release the build fails
Expand All @@ -109,6 +109,13 @@ matrix:

# QEMU based targets that compile in an emulator
- env: TARGET=x86_64-unknown-freebsd
allow_failures:
- env: TARGET=i386-apple-ios
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
- env: TARGET=x86_64-apple-ios
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0

notifications:
email:
Expand Down
1 change: 1 addition & 0 deletions ci/ios/deploy_and_run_on_ios_simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ fn run_app_on_simulator() {
.arg("com.rust.unittests")
.output());

println!("status: {}", output.status);
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));

Expand Down
67 changes: 56 additions & 11 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn main() {
let linux = target.contains("unknown-linux");
let android = target.contains("android");
let apple = target.contains("apple");
let ios = target.contains("apple-ios");
let emscripten = target.contains("asm");
let musl = target.contains("musl") || emscripten;
let uclibc = target.contains("uclibc");
Expand Down Expand Up @@ -84,8 +85,10 @@ fn main() {
cfg.header("sys/socket.h");
}
cfg.header("net/if.h");
cfg.header("net/route.h");
cfg.header("net/if_arp.h");
if !ios {
cfg.header("net/route.h");
cfg.header("net/if_arp.h");
}
cfg.header("netdb.h");
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
Expand Down Expand Up @@ -113,7 +116,7 @@ fn main() {
cfg.header("pwd.h");
cfg.header("grp.h");
cfg.header("sys/utsname.h");
if !solaris {
if !solaris && !ios {
cfg.header("sys/ptrace.h");
}
cfg.header("sys/mount.h");
Expand Down Expand Up @@ -175,19 +178,22 @@ fn main() {
cfg.header("util.h");
cfg.header("xlocale.h");
cfg.header("sys/xattr.h");
cfg.header("sys/sys_domain.h");
cfg.header("net/if_utun.h");
cfg.header("net/bpf.h");
if target.starts_with("x86") {
if target.starts_with("x86") && !ios {
cfg.header("crt_externs.h");
}
cfg.header("net/route.h");
cfg.header("netinet/if_ether.h");
cfg.header("netinet/in.h");
cfg.header("sys/proc_info.h");
cfg.header("sys/kern_control.h");
cfg.header("sys/ipc.h");
cfg.header("sys/shm.h");

if !ios {
cfg.header("sys/sys_domain.h");
cfg.header("net/if_utun.h");
cfg.header("net/bpf.h");
cfg.header("net/route.h");
cfg.header("netinet/if_ether.h");
cfg.header("sys/proc_info.h");
cfg.header("sys/kern_control.h");
}
}

if bsdlike {
Expand Down Expand Up @@ -449,6 +455,17 @@ fn main() {
// header conflicts when including them with all the other structs.
"termios2" => true,

// Present on historical versions of iOS but missing in more recent
// SDKs
"bpf_hdr" |
"proc_taskinfo" |
"proc_taskallinfo" |
"proc_bsdinfo" |
"proc_threadinfo" |
"sockaddr_inarp" |
"sockaddr_ctl" |
"arphdr" if ios => true,

_ => false
}
});
Expand Down Expand Up @@ -594,6 +611,30 @@ fn main() {
// shouldn't be used in code anyway...
"AF_MAX" | "PF_MAX" => true,

// Present on historical versions of iOS, but now removed in more
// recent SDKs
"ARPOP_REQUEST" |
"ARPOP_REPLY" |
"ATF_COM" |
"ATF_PERM" |
"ATF_PUBL" |
"ATF_USETRAILERS" |
"AF_SYS_CONTROL" |
"SYSPROTO_EVENT" |
"PROC_PIDTASKALLINFO" |
"PROC_PIDTASKINFO" |
"PROC_PIDTHREADINFO" |
"UTUN_OPT_FLAGS" |
"UTUN_OPT_IFNAME" |
"BPF_ALIGNMENT" |
"SYSPROTO_CONTROL" if ios => true,
s if ios && s.starts_with("RTF_") => true,
s if ios && s.starts_with("RTM_") => true,
s if ios && s.starts_with("RTA_") => true,
s if ios && s.starts_with("RTAX_") => true,
s if ios && s.starts_with("RTV_") => true,
s if ios && s.starts_with("DLT_") => true,

_ => false,
}
});
Expand Down Expand Up @@ -736,6 +777,10 @@ fn main() {
// FIXME: mincore is defined with caddr_t on Solaris.
"mincore" if solaris => true,

// These were all included in historical versions of iOS but appear
// to be removed now
"system" | "ptrace" if ios => true,

_ => false,
}
});
Expand Down
12 changes: 2 additions & 10 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,16 +765,8 @@ pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
pub const VM_FLAGS_USER_ALLOCATE: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
VM_FLAGS_PURGABLE |
VM_FLAGS_RANDOM_ADDR |
VM_FLAGS_NO_CACHE |
VM_FLAGS_OVERWRITE |
VM_FLAGS_SUPERPAGE_MASK |
VM_FLAGS_ALIAS_MASK;
pub const VM_FLAGS_USER_MAP: ::c_int = VM_FLAGS_USER_ALLOCATE |
VM_FLAGS_RETURN_4K_DATA_ADDR |
VM_FLAGS_RETURN_DATA_ADDR;
pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401b;
pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401b;
pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
VM_FLAGS_RANDOM_ADDR |
VM_FLAGS_OVERWRITE |
Expand Down
1 change: 1 addition & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ extern {
pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
pub fn closelog();
pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "nice$UNIX2003")]
Expand Down

0 comments on commit 5090477

Please sign in to comment.