Rejected go_darwin_arm64 mismatching values: x86_64 - go

I'm trying to get a Bazel build working on my MacBook Pro M1 on Monterey, and I'm having a difficult time. When I try to build a docker image, I get go toolchain errors (with --toolchain_resolution_debug='go') that look like this:
INFO: ToolchainResolution: Type #io_bazel_rules_go//go:toolchain: target platform #local_config_platform//:host: Rejected toolchain #go-auto//:go_darwin_amd64-impl; mismatching values: x86_64
INFO: ToolchainResolution: Type #io_bazel_rules_go//go:toolchain: target platform #local_config_platform//:host: Rejected toolchain #go-auto//:go_darwin_arm-impl; mismatching values: arm
INFO: ToolchainResolution: Type #io_bazel_rules_go//go:toolchain: execution platform #local_config_platform//:host: Rejected toolchain #go-auto//:go_darwin_arm64-impl; mismatching values: x86_64
Why does it say it rejects an arm64 implementation because it's not x86_64? It seems like there's something broken here.
For reference, here's bazel version:
Bazelisk version: development
Build label: 5.2.0
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:11:09 2022 (1654618269)
Build timestamp: 1654618269
Build timestamp as int: 1654618269
And some relevant bits from my WORKSPACE:
http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)
...
load("#bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "io_bazel_rules_k8s",
remote = "https://github.com/bazelbuild/rules_k8s.git",
# branch = "master",
commit = "fee80eb69e1921c076167ebebcf5eea3d2e9c707",
shallow_since = "1655492445 -0700",
)
load("#io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_repositories")
k8s_repositories()
load("#io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()
go_download_sdk(
name = "go-auto",
)

If you'd like to build for linux x86_64 on arm, --platforms=#io_bazel_rules_go//go/toolchain:linux_amd64 works for me. The x86 container will run in emulation on the arm machine.
You could probably target an arm linux container with toolchain:linux_arm64

Related

Pulling Neo4j docker image for Mac M1 chip

I would like to pull the neo4j image on my Mac Book M1 machine.
The dockerfile is something like this
FROM neo4j:3.5.30-community
....
If I don't specify the target platform it gave me an error on pull :
=> ERROR [internal] load metadata for docker.io/library/neo4j:3.5.30-community 0.6s
------
> [internal] load metadata for docker.io/library/neo4j:3.5.30-community:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:a3c8ec959f11ecac3e90c6c032afb217718128366b6ba3d59cf55ad6320be8d1: not found
ERROR: Service 'designer-neo4j' failed to build: Build failed
I google it a bit and I found that I need to do a:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
This works and image is pulled and it runs - slow and with a lot of crashes...
Inside my docker dashboard, it warns me with a red exclamation mark: amd64: Image may have poor performance.... If I google it tells me, that I should have arm64 architecture images...
So how to pull the neo4j image on mac m1, so that it will work?
You need to use a more recent version of Neo4j, 3.5 is EOL already.
If you do use 4.3 or 4.4 you will be able to simply pull arm64 compatible images.
Check on docker hub https://hub.docker.com/_/neo4j?tab=tags&page=1 , you will see immediately the image tags compatible with arm64 architectures.

OS X or home-brew? How do I check

Seems like someone is playing a prank on me. My computer settings change between days and I'm certain that this version is a home-brew and not the original OS X.
Recovery/re-installation doesn't work because it restores itself after a day. How do I check if this is the original operating system?
messing around with the terminal raises a few red flags. For example:
master.passwd contains this:
nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false
root:*:0:0::0:0:System Administrator:/var/root:/bin/sh
daemon:*:1:1::0:0:System Services:/var/root:/usr/bin/false
_uucp:*:4:4::0:0:Unix to Unix Copy Protocol:/var/spool/uucp:/usr/sbin/uucico
_taskgated:*:13:13::0:0:Task Gate Daemon:/var/empty:/usr/bin/false
_networkd:*:24:24::0:0:Network Services:/var/networkd:/usr/bin/false
_installassistant:*:25:25::0:0:Install Assistant:/var/empty:/usr/bin/false
_lp:*:26:26::0:0:Printing Services:/var/spool/cups:/usr/bin/false
_postfix:*:27:27::0:0:Postfix Mail Server:/var/spool/postfix:/usr/bin/false
_scsd:*:31:31::0:0:Service Configuration Service:/var/empty:/usr/bin/false
_ces:*:32:32::0:0:Certificate Enrollment Service:/var/empty:/usr/bin/false
_appstore:*:33:33::0:0:Mac App Store Service:/var/empty:/usr/bin/false
_mcxalr:*:54:54::0:0:MCX AppLaunch:/var/empty:/usr/bin/false
_appleevents:*:55:55::0:0:AppleEvents Daemon:/var/empty:/usr/bin/false
_geod:*:56:56::0:0:Geo Services Daemon:/var/db/geod:/usr/bin/false
_devdocs:*:59:59::0:0:Developer Documentation:/var/empty:/usr/bin/false
_sandbox:*:60:60::0:0:Seatbelt:/var/empty:/usr/bin/false
_mdnsresponder:*:65:65::0:0:mDNSResponder:/var/empty:/usr/bin/false
_ard:*:67:67::0:0:Apple Remote Desktop:/var/empty:/usr/bin/false
_www:*:70:70::0:0:World Wide Web Server:/Library/WebServer:/usr/bin/false
_eppc:*:71:71::0:0:Apple Events User:/var/empty:/usr/bin/false
_cvs:*:72:72::0:0:CVS Server:/var/empty:/usr/bin/false
_svn:*:73:73::0:0:SVN Server:/var/empty:/usr/bin/false
_mysql:*:74:74::0:0:MySQL Server:/var/empty:/usr/bin/false
_sshd:*:75:75::0:0:sshd Privilege separation:/var/empty:/usr/bin/false
_qtss:*:76:76::0:0:QuickTime Streaming Server:/var/empty:/usr/bin/false
_cyrus:*:77:6::0:0:Cyrus Administrator:/var/imap:/usr/bin/false
_mailman:*:78:78::0:0:Mailman List Server:/var/empty:/usr/bin/false
_appserver:*:79:79::0:0:Application Server:/var/empty:/usr/bin/false
_clamav:*:82:82::0:0:ClamAV Daemon:/var/virusmails:/usr/bin/false
_amavisd:*:83:83::0:0:AMaViS Daemon:/var/virusmails:/usr/bin/false
_jabber:*:84:84::0:0:Jabber XMPP Server:/var/empty:/usr/bin/false
_appowner:*:87:87::0:0:Application Owner:/var/empty:/usr/bin/false
_windowserver:*:88:88::0:0:WindowServer:/var/empty:/usr/bin/false
_spotlight:*:89:89::0:0:Spotlight:/var/empty:/usr/bin/false
_tokend:*:91:91::0:0:Token Daemon:/var/empty:/usr/bin/false
_securityagent:*:92:92::0:0:SecurityAgent:/var/db/securityagent:/usr/bin/false
_calendar:*:93:93::0:0:Calendar:/var/empty:/usr/bin/false
_teamsserver:*:94:94::0:0:TeamsServer:/var/teamsserver:/usr/bin/false
_update_sharing:*:95:-2::0:0:Update Sharing:/var/empty:/usr/bin/false
_installer:*:96:-2::0:0:Installer:/var/empty:/usr/bin/false
_atsserver:*:97:97::0:0:ATS Server:/var/empty:/usr/bin/false
_ftp:*:98:-2::0:0:FTP Daemon:/var/empty:/usr/bin/false
_unknown:*:99:99::0:0:Unknown User:/var/empty:/usr/bin/false
_softwareupdate:*:200:200::0:0:Software Update Service:/var/db/softwareupdate:/usr/bin/false
_coreaudiod:*:202:202::0:0:Core Audio Daemon:/var/empty:/usr/bin/false
_screensaver:*:203:203::0:0:Screensaver:/var/empty:/usr/bin/false
_locationd:*:205:205::0:0:Location Daemon:/var/db/locationd:/usr/bin/false
_trustevaluationagent:*:208:208::0:0:Trust Evaluation Agent:/var/empty:/usr/bin/false
_timezone:*:210:210::0:0:AutoTimeZoneDaemon:/var/empty:/usr/bin/false
_lda:*:211:211::0:0:Local Delivery Agent:/var/empty:/usr/bin/false
_cvmsroot:*:212:212::0:0:CVMS Root:/var/empty:/usr/bin/false
_usbmuxd:*:213:213::0:0:iPhone OS Device Helper:/var/db/lockdown:/usr/bin/false
_dovecot:*:214:6::0:0:Dovecot Administrator:/var/empty:/usr/bin/false
_dpaudio:*:215:215::0:0:DP Audio:/var/empty:/usr/bin/false
_postgres:*:216:216::0:0:PostgreSQL Server:/var/empty:/usr/bin/false
_krbtgt:*:217:-2::0:0:Kerberos Ticket Granting Ticket:/var/empty:/usr/bin/false
_kadmin_admin:*:218:-2::0:0:Kerberos Admin Service:/var/empty:/usr/bin/false
_kadmin_changepw:*:219:-2::0:0:Kerberos Change Password Service:/var/empty:/usr/bin/false
expected a command to set a master password...
There's a "VM" mounted disk hidden in /private/var/vm
it contains this file
$ cat sleepimage
and it returns:
Model: MBP121
EFI Version: 186.0.0.0.0
Built by: root#xapp160
Date: Fri Jun 14 09:21:38 PDT 2019
Revision: 186 (B&I)
ROM Version: F000_B00
Build Type: Official Build, Release
Compiler: Apple LLVM version 5.0 (clang-500.0.68) (based on LLVM 3.3svn)
Model: MBP121
EFI Version: 186.0.0.0.0
Built by: root#xapp160
Date: Fri Jun 14 09:21:38 PDT 2019
Revision: 186 (B&I)
ROM Version: F000_B00
Build Type: Official Build, Release
Compiler: Apple LLVM version 5.0 (clang-500.0.68) (based on LLVM 3.3svn)
garbled text
EFI Version: 186.0.0.0.0
Built by: root#xapp160
Date: Fri Jun 14 09:21:38 PDT 2019
Revision: 186 (B&I)
ROM Version: F000_B00
Build Type: Official Build, Release
Compiler: Apple LLVM version 5.0 (clang-500.0.68) (based on LLVM 3.3svn)

Why do I get undeclared inclusion error when using the lib as external library?

I am trying to include an external library (glm) in my bazel build, but I get undeclared inclusion the thing is I don't understand how to fix it and why, Because if I use the same BUILD script when I extract manually the library it builds fine.
I managed to make a very small repro of this problem, both the working case and the not working.
The not working example
My folder structure
glmExtBuild
WORKSPACE
externals
glm.BUILD
This is my WORKSPACE file
new_http_archive(
name = "glmExt",
url = "https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz",
sha256 = "514dea9ac0099dc389cf293cf1ab3d97aff080abad55bf79d4ab7ff6895ee69c",
strip_prefix = "glm-0.9.9.0",
build_file = "externals/glm.BUILD",
)
This is my glm.BUILD file
package(default_visibility = ["//visibility:public"])
cc_library(
name= "glm",
defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS",
"GLM_FORCE_DEPTH_ZERO_TO_ONE"],
srcs=glob(["glm/**/*.cpp"]) + ["glm/detail/_fixes.hpp"],
hdrs=glob(["glm/**/*.hpp"])+glob(["glm/**/*.h"]),
includes = ["glm"],
textual_hdrs = glob(["glm/**/*.inl"]),
visibility = ["//visibility:public"],
)
And this is the errors that I get when I run
bazel build #glmExt//:glm --verbose_failures --sandbox_debug
ERROR: C:/users/...../external/glmExt/BUILD.bazel:121:1: undeclared inclusion(s) in rule '#glmExt//:glm':
this rule is missing dependency declarations for the following files included by 'external/glmExt/glm/detail/glm.cpp':
'external/glmext/glm/detail/_fixes.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/simd/platform.h'
'external/glmext/glm/fwd.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_int.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_float.hpp'
...
The working example:
My folder structure
glmBuild2
WORKSPACE
BUILD
glmSrc
https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz extracted here
My WORKSPACE file is empty
And this is my BUILD file
package(default_visibility = ["//visibility:public"])
cc_library(
name= "glm",
defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS", "GLM_FORCE_DEPTH_ZERO_TO_ONE"],
srcs=glob(["glmSrc/glm/**/*.cpp"]) + ["glmSrc/glm/detail/_fixes.hpp"],
hdrs=glob(["glmSrc/glm/**/*.hpp"])+glob(["glmSrc/glm/**/*.h"]),
includes = ["glmSrc"],
textual_hdrs = glob(["glmSrc/glm/**/*.inl"]),
visibility = ["//visibility:public"],
)
Then when running the build command it finished successfully.
PS D:\......\glmBuild2> bazel build :glm --verbose_failures --sandbox_debug
INFO: Analysed target //:glm (1 packages loaded).
INFO: Found 1 target...
INFO: From Compiling glmSrc/glm/detail/glm.cpp:
glmSrc/glm/detail/glm.cpp(4): warning C4005: 'GLM_ENABLE_EXPERIMENTAL': macro redefinition
glmSrc/glm/detail/glm.cpp(4): note: command-line arguments: see previous definition of 'GLM_ENABLE_EXPERIMENTAL'
Target //:glm up-to-date:
C:/users/.../execroot/__main__/bazel-out/x64_windows-fastbuild/bin/libglm.a
INFO: Elapsed time: 1.830s, Critical Path: 1.30s
INFO: 3 processes, local.
INFO: Build completed successfully, 4 total actions
Does anybody have an idea?
Thanks
Update:
bazel version
Build label: 0.14.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jun 1 13:06:29 2018 (1527858389)
Build timestamp: 1527858389
Build timestamp as int: 1527858389
Bazel issue:
https://github.com/bazelbuild/bazel/issues/5485
I tried the first example on linux, with bazel 0.15.0, and all worked once I added "." into includes attribute of glm. Do you have a possibility to test it on linux? Is it windows-only issue then? Which bazel version do you use?
Thanks for clarifications.

"Symbol not found" error, (possibly) due to recent upgrade to R2017b?

I'm getting an error when I try to use imerode() from the command line, e.g.
test=magic([100 100])>200;
imclose(test,strel('disk',10,0));
I get this error:
Error using images.internal.morphmex Invalid MEX-file
'/Applications/MATLAB_R2017b.app/toolbox/images/images/+images/+internal/morphmex.mexmaci64':
dlopen(/Applications/MATLAB_R2017b.app/toolbox/images/images/+images/+internal/morphmex.mexmaci64,
6): Symbol not found: _OSAtomicDecrement32Barrier Referenced from:
/Applications/MATLAB_R2017b.app/bin/maci64/./libcudart.8.0.dylib
Expected in: /usr/lib/libSystem.B.dylib in
/Applications/MATLAB_R2017b.app/bin/maci64/./libcudart.8.0.dylib.
Error in images.internal.morphop (line 103)
B = images.internal.morphmex(mex_method, B, nhood, height, unpacked_M);
Error in imdilate (line 135) B =
images.internal.morphop(A,se,'dilate',mfilename,varargin{:});
Error in imclose (line 82)
outputImage = imerode(imdilate(inputImage,se,packopt,M),se,packopt,M);
I'm on OS X 10.9.5, with MATLAB R2017b.
I've checked that morphmex.mexmaci64 is there in the given path (above).
Not sure where /./ refers to, but libcudart.8.0.dylib is in maci64 folder.
Not sure where /usr/lib/... is.
EDIT
I have uninstalled R2017b and installed R2017a (why not, just in case...) and when trying to run the same code, I now get this error (which seems worse...)
Segmentation violation detected at Mon Nov 13 13:44:29 2017
Configuration: Crash Decoding : Disabled - No sandbox or build
area path Crash Mode : continue (default) Current
Graphics Driver: Unknown hardware Current Visual : Quartz
Default Encoding : ISO-8859-1 Deployed : false Host
Name : eduroam-206-52.nomadic.bris.ac.uk MATLAB
Architecture : maci64 MATLAB Entitlement ID: 1803495 MATLAB Root
: /Applications/MATLAB_R2017a.app MATLAB Version : 9.2.0.556344
(R2017a) OpenGL : hardware Operating System :
Darwin 13.4.0 Darwin Kernel Version 13.4.0: Mon Jan 11 18:17:34 PST
2016; root:xnu-2422.115.15~1/RELEASE_X86_64 x86_64 Processor ID
: x86 Family 6 Model 69 Stepping 1, GenuineIntel Virtual Machine
: Java 1.7.0_75-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit
Server VM mixed mode Window System : Quartz
Fault Count: 2
Abnormal termination: Trace trap
Can upload error file for rest of message (too long to paste here).
Thanks in advance.
Looks like an installation problem or maybe it is due to the update.
Try to run the following commands in your console:
restoredefaultpath();
rehash toolboxcache;
If everything works without errors, then run:
savepath();
Turns out R2017a, b not compatible with OS Mavericks.
Rolled back to R2016a.

compiling SyntaxNet on OS X fails with "error loading package '#jpeg//': Extension file not found"

I can't get SyntaxNet compiled on my MacBook Pro.
I followed the SyntaxNet installation steps here: https://github.com/tensorflow/models/tree/master/syntaxnet#installation
the bazel test --linkopt=-headerpad_max_install_names syntaxnet/... util/utf8/... line fails with this output:
Joachims-MacBook-Pro:syntaxnet joachim$ bazel test --linkopt=-headerpad_max_install_names syntaxnet/... util/utf8/...
ERROR: /private/var/tmp/_bazel_joachim/2d6c6b79fd5d2f10f2fd8d8e3457de30/external/org_tensorflow/tensorflow/core/platform/default/build_config/BUILD:108:1: error loading package '#jpeg//': Extension file not found. Unable to load package for '//third_party:common.bzl': BUILD file not found on package path and referenced by '#org_tensorflow//tensorflow/core/platform/default/build_config:jpeg'.
ERROR: Analysis of target '//syntaxnet:test_main' failed; build aborted.
INFO: Elapsed time: 4.823s
ERROR: Couldn't start the build. Unable to run tests.
Here's some system info:
Joachims-MacBook-Pro:syntaxnet joachim$ bazel version
Build label: 0.4.3-homebrew
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 15:20:22 2016 (1482420022)
Build timestamp: 1482420022
Build timestamp as int: 1482420022
Joachims-MacBook-Pro:syntaxnet joachim$ python --version
Python 2.7.11
I pulled the sources as follows:
Joachims-MacBook-Pro:workspace joachim$ git clone --recurse-submodules https://github.com/tensorflow/models.git
Cloning into 'models'
...
'aab099711d7e04034cf742ddb9b00dd15edbe99c'
I encountered a similar problem when compiling on Ubuntu.
Find the file tensorflow/third_party/jpeg/jpeg.BUILD
Then, change the code load("#//third_party:common.bzl", "template_rule")
to
load("#org_tensorflow//third_party:common.bzl", "template_rule")

Resources