mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Link executables using system frameworks on Darwin (#3075)
* Link test executables using system frameworks on Darwin
On an M1 MBP, running `cmake . && make test` yields the error
```
[ 69%] Linking CXX executable tc.t
Undefined symbols for architecture arm64:
"_CFRelease", referenced from:
_$LT$iana_time_zone..platform..system_time_zone..SystemTimeZone$u20$as$u20$core..ops..drop..Drop$GT$::drop::hcd3964de9573de30 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_CFStringGetBytes", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFStringGetCStringPtr", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::as_utf8::h8bb5c2c0d091ded1 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFStringGetLength", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFTimeZoneCopySystem", referenced from:
iana_time_zone::platform::system_time_zone::SystemTimeZone:🆕:hc42d30609914d79d in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_CFTimeZoneGetName", referenced from:
iana_time_zone::platform::system_time_zone::SystemTimeZone::name::h44947ee6deb3339a in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_SecRandomCopyBytes", referenced from:
ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
"_kSecRandomDefault", referenced from:
ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test/tc.t] Error 1
make[2]: *** [test/CMakeFiles/tc.t.dir/all] Error 2
make[1]: *** [test/CMakeFiles/test.dir/rule] Error 2
```
This change resolves the error by updating the targets in
test/CMakeLists.txt to link against the CoreFoundation and Security
frameworks when building under Mac OS.
* Link executables against CoreFoundation and Security frameworks on Mac OS
* Rename test_osx.sh to test_macos.sh
---------
Co-authored-by: Dathan Bennett <dathanb@netflix.com>
This commit is contained in:
parent
7f68441916
commit
a7bb0c9ba0
4 changed files with 43 additions and 9 deletions
37
.github/workflows/tests.yaml
vendored
37
.github/workflows/tests.yaml
vendored
|
@ -3,9 +3,9 @@
|
||||||
name: tests
|
name: tests
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
# OSX tests do not run in Docker, and use the actions-rs Rust installaction
|
# MacOS tests do not run in Docker, and use the actions-rs Rust installaction
|
||||||
tests-osx:
|
tests-macos-12:
|
||||||
name: tests (Mac OS X latest)
|
name: tests (Mac OS 12.latest)
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -27,8 +27,35 @@ jobs:
|
||||||
toolchain: "stable"
|
toolchain: "stable"
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: Test OSX
|
- name: Test MacOS
|
||||||
run: bash test/scripts/test_osx.sh
|
run: bash test/scripts/test_macos.sh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tests-macos-13:
|
||||||
|
name: tests (Mac OS 13.latest)
|
||||||
|
runs-on: macos-13
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-stable-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: "stable"
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Test MacOS
|
||||||
|
run: bash test/scripts/test_macos.sh
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,11 @@ add_executable (lex_executable lex.cpp)
|
||||||
target_link_libraries (task_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
target_link_libraries (task_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
||||||
target_link_libraries (calc_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
target_link_libraries (calc_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
||||||
target_link_libraries (lex_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
target_link_libraries (lex_executable task tc tc-rust commands tc columns libshared task libshared ${TASK_LIBRARIES})
|
||||||
|
if (DARWIN)
|
||||||
|
target_link_libraries (task_executable "-framework CoreFoundation -framework Security")
|
||||||
|
target_link_libraries (calc_executable "-framework CoreFoundation -framework Security")
|
||||||
|
target_link_libraries (lex_executable "-framework CoreFoundation -framework Security")
|
||||||
|
endif (DARWIN)
|
||||||
|
|
||||||
set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task")
|
set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task")
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ add_custom_target (build_tests DEPENDS ${test_SRCS}
|
||||||
foreach (src_FILE ${test_SRCS})
|
foreach (src_FILE ${test_SRCS})
|
||||||
add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp)
|
add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp)
|
||||||
target_link_libraries (${src_FILE} task tc commands columns libshared task tc tc-rust commands columns libshared task commands columns libshared ${TASK_LIBRARIES})
|
target_link_libraries (${src_FILE} task tc commands columns libshared task tc tc-rust commands columns libshared task commands columns libshared ${TASK_LIBRARIES})
|
||||||
|
if (DARWIN)
|
||||||
|
target_link_libraries (${src_FILE} "-framework CoreFoundation -framework Security")
|
||||||
|
endif (DARWIN)
|
||||||
endforeach (src_FILE)
|
endforeach (src_FILE)
|
||||||
|
|
||||||
configure_file(run_all run_all COPYONLY)
|
configure_file(run_all run_all COPYONLY)
|
||||||
|
|
1
test/scripts/test_osx.sh → test/scripts/test_macos.sh
Normal file → Executable file
1
test/scripts/test_osx.sh → test/scripts/test_macos.sh
Normal file → Executable file
|
@ -1,6 +1,5 @@
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
export LDFLAGS="-framework Foundation -framework Security"
|
|
||||||
brew install cmake
|
brew install cmake
|
||||||
brew install libfaketime
|
brew install libfaketime
|
||||||
git clean -dfx
|
git clean -dfx
|
Loading…
Add table
Add a link
Reference in a new issue