Building my app on Linux get an error:
$ swift build
Compile Swift Module 'finder' (1 sources)
main.swift:24:15: error: use of unresolved identifier 'URLSession'
let session = URLSession.shared
$ swiftc main.swift
main.swift:24:15: error: use of unresolved identifier 'URLSession'
let session = URLSession.shared
It's working in XCODE 8 on my Mac.
I'm trying Swift on Ubuntu:
$ swift --version
Swift version 3.0 (swift-3.0-PREVIEW-2)
Target: x86_64-unknown-linux-gnu
Two issues:
1: On Linux, even up to 3.0-PREVIEW-2, the "NS" prefix hasn't been dropped in Foundation yet. You still need to use NSURLSession, rather than URLSession. This will change in Foundation with 3.0-PREVIEW-3 based on the GitHub branches.
2: And this is a showstopper, URLSession/NSURLSession doesn't work on Linux. It hasn't been implemented yet. If you look at the source code for URLSession right now:
https://github.com/apple/swift-corelibs-foundation/blob/93d0018a0891f876065651c3ee8c63f256a38de4/Foundation/NSURLSession/NSURLSession.swift#L200
You'll see that calling sharedSession() returns NSUnimplemented()
At some point, URLSession will come to Linux - but it hasn't been implemented yet.
I believe the reason is that on OS X, URLSession for Swift simply a bridge to the Objective C implementation that already existed. On Linux, Foundation is being implemented entirely in Swift and they just haven't got around to re-writing this yet.
Related
I need to install simplescalar on windows 7. For that reason, I installed cygwin. I need to use simplescalar because I need to do a lab about Benchmarks.
I already installed SimpleScalar on Debian and I compiled it using the alpha configuration without any problem. However, when I try to do the same on windows using cygwin, I'm having issues.
I am trying to compile simplescalar using alpha configuration. since I'm using windows 7, cygwin and I used the following steps:
make config-alpha
make
When I run the make command to compile the simulator, it shows me a lot of errors.
syscall.c: 805:25: error: 'TCP_NODELAY' undeclared here (not in a function); did you mean 'O_NDEALY'?
804 { OSF_TCP_NODELAY, TCP_NODELAY},
O_NDEALY
syscall.c: 805:25: error: 'TCP_MAXSEG' undeclared here (not in a function); did you mean 'TMP_MAX'?
804 { OSF_TCP_MAXSEG, TCP_MAXSEG},
TMP_MAX
syscall.c:2636:56 error: invalid use of undefined type 'struct dirent' i++, cnt < regs -> regs_R[MD_REG_V0] && p->d_reclen > 0;
syscall.c:2637:35 error: invalid use of undefined type 'struct dirent' i++, cnt = p->d_reclen, p=(struct dirent *)(buf+cn 2637)
However, if I use pisa configuration, I can compile the simulator without any problem.
Is there any additional steps I need to do or any additional packages I need to download in cygwin in order to compile simplescala using alpha configuration?
Some of the packages that I have downloaded to do my lab in cygwin have been wget, nano and devel.
Title says it all - I am attempting to run a very basic Rust program using hyper_wasi, and everything compiles seemingly ok using cargo wasi run. Unfortunately when it actually executes, I get:
Error: failed to run main module `target/wasm32-wasi/debug/<my project name here>.wasm`
Caused by:
0: failed to instantiate "target/wasm32-wasi/debug/<my project name here>.wasm"
1: unknown import: `wasi_snapshot_preview1::sock_setsockopt` has not been defined
Execution environment is a rather older Mac (2013 MBP with Big Sur), clang version:
Homebrew clang version 15.0.3
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
If anyone can point me at what I might be missing I'd appreciate it.
I'm trying to set up Bevy 0.7.0 for the first time on Ubuntu 20.04, following the official guide on their website, and as soon as I configured it for fast compiles, it stopped compiling altogether. At first, it didn't find the clang linker, even though I had installed lld as instructed, but I solved that by installing the entire clang package. Then, after switching to the nightly channel, cargo run gave me this output:
Compiling bevy-crevice-derive v0.7.0
error: Metal API enabled on non-Apple OS. If your project is not using resolver="2" in Cargo.toml, it should.
--> /home/lenerdv/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.12.5/src/lib.rs:51:1
|
51 | compile_error!("Metal API enabled on non-Apple OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: DX12 API enabled on non-Windows OS. If your project is not using resolver="2" in Cargo.toml, it should.
--> /home/lenerdv/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.12.5/src/lib.rs:53:1
|
53 | compile_error!("DX12 API enabled on non-Windows OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
followed by a bunch of cannot find ___ and undeclared crate ___ type errors (hundreds of them), and a final type annotations needed error (full output). It's mainly complaining about mtl, so I'm guessing it might be a missing dependency, but I'm not sure as I'm quite new to rust.
mtl stands for "Metal" which is an Apple API. So your problem isn't a missing dependency but a wrong configuration. This should be fixed by adding resolver="2" in your Cargo.toml as per the compiler suggestion.
For more details, see: https://doc.rust-lang.org/cargo/reference/features.html#feature-resolver-version-2
I'm integrating C check framework for my project and I was able to run
autoreconf --install
successfully without any errors.
But when I integrate the C check framework, I'm getting an error and warnings that doesn't make sense.
Here is the error I'm getting
src/Makefile.am:7: warning: variable 'main_LDADD' is defined but no program or
src/Makefile.am:7: library has 'main' as canonical name (possible typo)
tests/Makefile.am:2: error: 'SHELLTESTS_PROGRAMS' is used but 'SHELLTESTSdir' is undefined
tests/Makefile.am:3: warning:variable 'ShellTests_SOURCES' is defined but no program or
tests/Makefile.am:3: library has 'ShellTests' as canonical name (possible typo)
tests/Makefile.am:5: warning: variable ShellTests_LDADD' is defined but no program or
tests/Makefile.am:5:library has 'ShellTests' as canonical name (possible typo)
autoreconf:automake failed with exit status: 1
I've followed the C check example source code, the difference between that and my project is that my class uses other class' methods.
Anyways, this is the Makefile.am under my tests/ that is causing 'havoc' on building the project
TESTS = shelltests
SHELLTESTS_PROGRAMS = shelltests
ShellTests_SOURCES = ShellTests.c $(top_builddir)/src/Shell.h $(top_builddir)/src/Parser.h $(top_builddir)/src/JobControl.h
ShellTests_CFLAGS = #CHECK_CFLAGS#
ShellTests_LDADD = $(top_builddir)/src/libshell.la #CHECK_LIBS#
This is the file structure for my project
src -
Parser.h, Parser.c, Shell.h, Shell.c, Job.h, Job.c, Makefile.am
tests -
ShellTests.c Makefile.am
And this is the code in Makefile.am under src.
lib_LTLIBRARIES = libshell.la
libshell_la_SOURCES = Shell.c Shell.h Parser.h Parser.c JobControl.h JobControl.c
bin_programs = main
main_sources = Main.c
main_LDADD = libshell.la
I followed this user's advice to see if it removes the error: What directory should I use for "error: 'extra_PROGRAMS' is used but 'extradir' is undefined"?
Alas, it does not.
I've tried building the example project - the one that you get when you download under examples, to see if I'm missing anything. But it's not able to build on my machine.
I'm on Mac OS X Mavericks (10.9)
Autoconf 2.69
Automake 1.15
Libtool 2.4.6
Check 0.9.14
I did a couple of things to build this project successfully. I first followed what I outlined here: Check framework example giving me error when running './configure'
Then I followed c check frameworks' naming conventions for the tests source files.
Thanks for the help guys, it gave me some ideas on what the cause of compilation errors.
I'm trying to create the Facebook DLL with following bindings: https://github.com/mono/monotouch-bindings/tree/master/facebook
When I use "make", I'm getting following errors:
error: invalid deployment target '5.0.0' for architecture 'arm64' (requires
'7.0.0' or later)
And
** BUILD FAILED **
The following build commands failed: ProcessPCH
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/com.apple.DeveloperTools/5.0-5A1413/Xcode/SharedPrecompiledHeaders/facebook_ios_sdk_Prefix-eeghlwplbbpvmudycetfsuytcqmf/facebook_ios_sdk_Prefix.pch.pch
facebook_ios_sdk_Prefix.pch normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler (1 failure) make[1]: *
[libFacebook-arm64.a] Error 65 make: * [build-binding] Error 2
Any ideas?
Ok, finally found the answer myself and posting it here in case others have the same problem.
The make file downloads the Facebook Obj C project automatically
The "BASE SDK" of this project is set to iOS7, the 64bit deployment targets are also set to iOS7, the 32bit deployment targets are set to iOS5
It then builds the Monotouch DLL with the binding project
This targets 64bit, which is not supported on iOS5
So basically, the "make" will not work. You first need to change all deployments targets in the project to iOS7. See screenshot below.
Probably there is a better solution that also supports earlier versions then iOS7, because the Obj C project is using different targets for 32bit (iOS5) and 64bit (iOS7) and my solution now only targets iOS7.