Swift build for linux/amd64 fails with strange error - swift

I have a swift app with the following dependencies:
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.41.1")),
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "2.1.0"))
Building it locally to run in a docker container works. This is the command I use for that:
docker build -t <image-name>:v1 .
Given I am building on an M1 macbook, deploying the above to azure does not work, since it is built for arm64 arch. However, when I attempt to build for linux/amd64, the code fails. This is the docker command I am using:
docker build --platform=linux/amd64 -t <image-name>:v1 .
I have tried with buildx, but the failure is similar:
docker buildx build --platform=linux/amd64 -t <image-name>:v1 .
The command I use to build the app for production is this:
RUN swift build -c release --static-swift-stdlib
Here is a snippet of the error message I am getting:
#0 35.45 warning: 'build': 'Build' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version 5.4.0 executable targets should be declared as 'executableTarget()'
#0 35.67 Building for production...
#0 36.08 [0/422] Compiling _AtomicsShims.c
#0 36.28 [1/422] Compiling CNIOWindows shim.c
#0 36.48 [2/422] Compiling CNIOWindows WSAStartup.c
#0 36.51 error: command Compiling CNIOLinux shim.c failed: failed to poll (Interrupted system call)
...
#0 44.33 remark: Incremental compilation has been disabled: it is not compatible with
whole module optimization
#0 44.34 error: command Compiling Swift Module 'NIOConcurrencyHelpers' (5 sources) failed: failed to poll (Interrupted system call)
#0 47.29 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_skey.c failed: failed to poll (Interrupted system call)
#0 47.64 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_purp.c failed: failed to poll (Interrupted system call)

Related

After upgrade from Flutter 2 to Flutter 3 on running automation, my app immediately crash after launch

We try to run Automation with Webdriver.io, Appium and appium flutter driver.
After upgrade from Flutter 2 to Flutter 3 app is crash immediately after launch. It's happen on both Android and iOS (physical and simulator devices).
App release with Flutter 2 is work correctly.
Build command:
flutter build apk --debug --target=./test_driver/build.dart
Run command:
npx wdio config/wdio.android.flutter.conf.js --spec tests/flutter_specs/app.test.spec.js
In Output get an error:
DEBUG webdriver: request failed due to response error: unknown error
ERROR webdriver: Request failed with status 500 due to unknown error: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined
ERROR webdriver: unknown error: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined
I cleaned npm node modules and package.lock and it didn't help.
My dependencies from package.json:
"dependencies":
"#wdio/appium-service": "^6.1.16",
"#wdio/cli": "^6.1.24",
"#wdio/jasmine-framework": "^6.1.23",
"#wdio/junit-reporter": "^7.5.3",
"#wdio/local-runner": "^6.1.24",
"#wdio/sauce-service": "^6.1.16",
"#wdio/spec-reporter": "^6.1.23",
"#wdio/sync": "^6.1.14",
"appium": "^1.21.0",
"appium-flutter-driver": "0.0.4",
"appium-flutter-finder": "^0.1.0",
"babel-eslint": "^10.1.0",
"node-fetch": "^2.6.0",
"webdriverio": "^6.1.24"
},
"devDependencies": {
"npm-bundle": "^3.0.3"
},
"bundledDependencies": [
"#wdio/appium-service",
"#wdio/cli",
"#wdio/jasmine-framework",
"#wdio/junit-reporter",
"#wdio/local-runner",
"#wdio/sauce-service",
"#wdio/spec-reporter",
"#wdio/sync",
"babel-eslint",
"node-fetch",
"webdriverio"
]
### Update!!
We clone small flutter project with minimum dependencies: https://github.com/bitrise-dev/flutter-sample-app-hello-world
Before update to flutter 3 all works fine, but after it we get the same error mention before
Any help to solve the issue...

Indexing a java 17 project using sourcegraph's scip-java

I am following the method given at:
https://sourcegraph.github.io/scip-java/docs/getting-started.html
From the root directory of a project I am running :
docker run -v $(pwd):/home/gradle sourcegraph/scip-java:latest scip-java index --build-tool=gradle
But on running this command I am getting the following errors:
Exception in thread "main" java.lang.IllegalAccessError: class com.sourcegraph.semanticdb_javac.SemanticdbPlugin (in unnamed module #0x1794d431) cannot access class com.sun.tools.javac.api.BasicJavacTask (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.api to unnamed module #0x1794d431
In the getting started guide it says that Java 17 requires custom --add-exports (https://sourcegraph.github.io/scip-java/docs/getting-started.html#java)
For Java 17 and newer versions, the following JVM options are required:
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
I have tried various ways to add these options but have not been able to do it correctly
(Following are some things I tried and the corresponding error I got)
docker run -e JAVA_OPTS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" -v $(pwd):/home/gradle sourcegraph/scip-java:latest scip-java index --build-tool=gradle
Using JVM version 'temurin:17'
Unrecognized option: --add-exports
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: --add-exports
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
docker run -e JAVA_OPTS="jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" -v $(pwd):/home/gradle sourcegraph/scip-java:latest scip-java index --build-tool=gradle
Using JVM version 'temurin:17'
Error: Could not find or load main class jdk.compiler.com.sun.tools.javac.api=ALL-UNNAMED
Error: Could not find or load main class jdk.compiler.com.sun.tools.javac.api=ALL-UNNAMED
I don't have very basic experience with Java programming, and currently, my main objective is to index a repository and test the Sourcegraph precise code intelligence tool.
(I am trying to index: https://github.com/spring-projects/spring-framework)
How can I add these JVM options?
Edit:
I tried using Holdger's way(from the comments) but still getting the same errors.
docker run -e JDK_JAVA_OPTIONS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" -v $(pwd):/home/gradle sourcegraph/scip-java:latest scip-java index --build-tool=gradle
The error message I got was(It is just the part where the task fails):
NOTE: Picked up JDK_JAVA_OPTIONS: --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
Exception in thread "main" java.lang.IllegalAccessError: class com.sourcegraph.semanticdb_javac.SemanticdbPlugin (in unnamed module #0x1794d431) cannot access class com.sun.tools.javac.api.BasicJavacTask (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.api to unnamed module #0x1794d431
at com.sourcegraph.semanticdb_javac.SemanticdbPlugin.init(SemanticdbPlugin.java:19)
at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugin(BasicJavacTask.java:255)
at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(BasicJavacTask.java:229)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:292)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
I left a comment but didn't get a response. Hopefully, this works.
This should be fixed with this PR: https://github.com/sourcegraph/scip-java/pull/464
Try re-running
$ docker run -v $(pwd):/home/gradle sourcegraph/scip-java:latest scip-java index --build-tool=gradle

How can I run executable release build in phoenix?

We are using distillery to create an executable build release in our
phoenix application. We are using docker to deploy our application on Digital Ocean. Since we don't want to share code with the other machine we want to execute the build compiled file as executable which we can run on some remote machine through command line.
So after some research we found that distillery plugin build executable release which creates a build using
mix release --executable
We are able to create the release. It provides three command to run these
punitjain#apple:project$ _build/dev/rel/project/bin/project foreground
punitjain#apple:project$ _build/dev/rel/project/bin/project start
punitjain#apple:project$ _build/dev/rel/project/bin/project console
I am getting following error after running foreground command
> $ _build/dev/rel/project/bin/project foreground [info] Application
> project exited: Project.start(:normal, []) returned an error:
> shutdown: failed to start child: Project.Endpoint
> ** (EXIT) shutdown: failed to start child: Phoenix.CodeReloader.Server
> ** (EXIT) an exception was raised:
> ** (UndefinedFunctionError) function Mix.Project.config/0 is undefined (module Mix.Project is not available)
> Mix.Project.config()
> (phoenix) lib/phoenix/code_reloader/server.ex:29: Phoenix.CodeReloader.Server.init/1
> (stdlib) gen_server.erl:328: :gen_server.init_it/6
> (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 {"Kernel pid
> terminated",application_controller,"{application_start_failure,project,{{shutdown,{failed_to_start_child,'Elixir.Project.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.CodeReloader.Server',{undef,[{'Elixir.Mix.Project',config,[],[]},{'Elixir.Phoenix.CodeReloader.Server',init,1,[{file,\"lib/phoenix/code_reloader/server.ex\"},{line,29}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}}},{'Elixir.Project',start,[normal,[]]}}}"}
>
> Crash dump is being written to: erl_crash.dump...done Kernel pid
> terminated (application_controller)
> ({application_start_failure,project,{{shutdown,{failed_to_start_child,'Elixir.Project.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.Code
Can you please help me how to resolve this error?
I would also be very happy to hear if anyone is having any better approach to create an executable release file. Which I can use in any Linux based system to deploy without exposing my source code using Docker.
Please let me know if I need to provide more information or do any amendments in question asked.
thanks
The problem is that you are building a release with MIX_ENV=dev, with Phoenix this will mean that the code reloader is included, and the code reloader does not work within a release. You should either build the release with MIX_ENV=prod or disable the code reloader in dev.

Swift Perfect Docker Debugging the build process

I am woking on Swift Perfect server programming. My code is compiling on MacOS successfully and able to run on localhost. But, when I try with Linux build in Perfect Assistant, it is giving following error
unable to execute command: Killed
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
Failed: systemError(1, "sh: no job control in this shell\n<unknown>:0: error: build had 1 command failures\nswift-build: error: exit(1): /swift-3.0.2-RELEASE-ubuntu16.04/usr/bin/swift-build-tool -f /perfectbuild/.build_lin/release.yaml\n")
Tired of figuring out where the problem is and how to debug it. I'm new to docker as well. Please guide me regarding this.
When I try making linux executable I'm getting the following error
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \".build_lin/debug/S-server\": stat .build_lin/debug/S-server: no such file or directory".

CTS_ERROR >>> Failed to execute shell command am instrument

Using the Android 2.2, API-8, SDK-r7 along with CTS-2.2_r4 suite.
Updated the SDK_ROOT environment variable with SDK_r7 tools in “android-cts/tools/startcts” script and the “SDK_ROOT/tools” also included in PATH environment variable.
Ran the “android” and created a new virtual device and started the same. This invokes the emulator named as “emulator-5554”.
Now, started the cts using the below command:
bash android-cts/tools/startcts.
start –plan android
Above command failed with:
Test package: android.app
install met failure [install_failed_insufficient_storage]
CTS_ERROR >>> Failed to execute shell command am instrument -w -r -e package android com.android.cts.app/android.test.InstrumentationCtsTestRunner on device emulator-5554
com.android.ddmlib.ShellCommandUnresponsiveException.
A few more issues are:
CTS_ERROR >>> Got exception while processing command
CTS_ERROR >>> Installing met timeout due to Unknown reason
CTS_ERROR >>> Timeout: ReferenceAppTest
CTS_ERROR >>> Timeout: getDeviceInfo
Any hint to avoid the above timeout issues? Thank you very much for anticipating a quick response from you.
I did not got this error on the CTS 2.1 r5. But I am not running the SDK test that Android but my own tests instead. There for I will use the CTS 2.1 for a while.