use k8s deepcopy-gen generate code failed - go

I am going to use k8s code-generator to generator deepcopy file and my project under GOPATH/src, but i seems not work and got a problem about GOROOT.
deepcopy-gen command is deepcopy-gen -i k8s_customize_controller/pkg/apis -p k8s_customize_controller/pkg/client -v 10
output blow:
[root#centos72-k8s code-generator]# deepcopy-gen -i k8s_customize_controller/pkg/apis -p k8s_customize_controller/pkg/client -v 10
I0122 02:51:04.609157 17278 parse.go:383] importPackage k8s_customize_controller/pkg/apis
I0122 02:51:04.609359 17278 parse.go:330] addDir k8s_customize_controller/pkg/apis
I0122 02:51:04.730397 17278 parse.go:404] unable to import "k8s_customize_controller/pkg/apis": package k8s_customize_controller/pkg/apis is not in GOROOT (/usr/local/go/src/k8s_customize_controller/pkg/apis)
I0122 02:51:04.730701 17278 main.go:82] Completed successfully.
unable to import "k8s_customize_controller/pkg/apis": package k8s_customize_controller/pkg/apis is not in GOROOT
it seems this problem about GOROOT?
how to resolve this problem?

I had similar issue with an error like this:
Generating deepcopy funcs
F1018 10:51:28.259741 74132 main.go:80] Error: Failed making a parser: unable to add directory "github.com/[my-git-account]/[repo-name]/pkg/apis/v1": No files for pkg "github.com/[my-git-account]/[repo-name]/pkg/apis/v1"
The problem was that I recently moved my github golang projects folders out of the $GOPATH/src folder (which is in my case is ~/go/src), because it worked well on vanilla Ubuntu and WSL Ubuntu, but it has challenges to update packages on MacOS - I moved all my project from the folder ~/go/src/github.com/[my-git-account]
(where the code-generator expected them) to the folder ~/dev/[my-git-account].
Solution I use to fix the error above - to create a symbolic link on my current github projects folder to the $GOPATH/src/github.com:
ln -s ~/dev/[my-git-account] $GOPATH/src/github.com
This way there is a folder $GOPATH/src/github.com/[my-git-account] (provided by the sym-link) with golang projects, where code-generator can find them.
Faced one drawback of this trick - in the IDE navigation to the method can move to the linked source (within SDK package by the link - not to the source code, opened in the IDE).

Related

Error while generating grpc files (--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.)

I’m trying to run the following command to generate grpc files:
protoc --proto_path=$PROTO_PATH --plugin=protoc-gen-grpc=$PLUGIN_GRPC --grpc_out=$OUT/grpc $PROTO_FILES
This results in the following error:
/Users/MYUSERNAME/Downloads/protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
I made sure the file from the error message is located at that path and has also the correct permissions.
-rwxrwxrwx# 1 MYUSERNAME staff 6334176 10 Aug 00:03 protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe
I also tried running the command as sudo.
Generating java or kotlin files with --java_out=$OUT/java --kotlin_out=$OUT/kotlin
works perfectly fine, so the problem is --grpc_out=$OUT/grpc
I also downloaded multiple versions of the protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe file but it always results in the same error. I also tried replacing all path variables (e.g. $PROTO_PATH) with their corresponding values, without any effect. I’m using MacBook with M1Pro chip.
The problem is that M1 Macs aren't supported. They have copied over the osx-x86_64 binary and renamed it for osx-aarch_64 as a workaround to make it easier to run with Rosetta. See here for where that change was made and here for the full conversation about supporting M1 Macs.

How to install Dirac (a Chrome DevTools fork for ClojureScript) on macOS Monterey 12.5 if error: "Could not locate clojure/data/ files" appears?

I am trying to install Dirac on a Macbook Air M1 running Monterey 12.5.
I am following the documentation which indicates:
curl -s https://raw.githubusercontent.com/binaryage/dirac/master/install > /tmp/dirac.install && sudo bash /tmp/dirac.install
The installation seems to have worked out since it exists on binaries:
Pedros-MacBook-Air:bin pedro$ pwd
/usr/local/bin
Pedros-MacBook-Air:bin pedro$ ls -1
dirac
lein
Unfortunately, when I go to the 2nd step on manual which is running dirac, the error below is retrieved:
Pedros-MacBook-Air:bin pedro$ dirac
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes.uniquify, being replaced by: #'clojure.tools.analyzer.utils/update-vals
Execution error (FileNotFoundException) at dirac.nrepl.compilation.direct/eval15283$loading (direct.clj:1).
Could not locate clojure/data/json__init.class, clojure/data/json.clj or clojure/data/json.cljc on classpath.
Full report at:
/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/clojure-1010884132545121253.edn
Initially, I tried running it at home folder. I thought it would work out fine.
Then, I decided to run it inside a project folder that had the file clojure/data/json.clj
included in the the project.clj file. Unfortunately, even this approach did not work out.
Below you see a simplified version of the project.clj file:
(defproject abcd ; Should be copied from shadow-cljs.edn
:description "xxxx"
:url "xxxx"
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.339"]
[org.clojure/tools.nrepl "RELEASE"]
[binaryage/devtools ~devtools-version]
[binaryage/dirac ~dirac-version]
[org.clojure/data.json "2.4.0"]
[figwheel ~figwheel-version]
;; Selmer for templating of .json config files
[selmer "1.12.50"]]
... (omitted content because it seems irrelevant) ...
:profiles {:repl
{:repl-options {:port 8230
:nrepl-middleware [dirac.nrepl/middleware]
:init (do
(require 'dirac.agent)
(dirac.agent/boot!))
}}})
1 - I thought Dirac would work out even outside of the project folder. Is it necessary to be in the project folder?
2 - Why is Dirac complaining about the Json library even though it is listed as a dependency?
Is there any difference between clojure/data/json.clj (error message retrieved) and org.clojure/data.json (my dependency)?
You've received a workaround on dirac/issues/98: adding {:deps {org.clojure/data.json {:mvn/version "2.4.0"}}} to ~/.clojure/deps.edn.
The local launcher script has a dependency on the release version of ClojureScript, that no longer includes clojure/data.json. A better workaround is changing the /usr/local/bin/dirac file line 119 by adding clojure.data.json there as well (or pinning to a ClojureScript version before 1.11.51):
DEPS="{:deps {\
$DIRAC_CLI_DEPS_COORDINATE \
org.clojure/clojurescript {:mvn/version \"RELEASE\"} \
org.clojure/data.json {:mvn/version \"2.4.0\"} \
clj-logging-config/clj-logging-config {:mvn/version \"1.9.12\"} \
}}"
Explanation
The dependency org.clojure/data.json was removed from ClojureScript in version 1.11.51 of May 13th 2022. See release notes:
Vendorization of tools.reader, data.json, and transit-clj (...) After conferring with the Clojure Team, we decided to vendorize all these dependencies. This way we can AOT everything and be confident that we won’t create a conflict that can’t easily be fixed via normal dependency management. (...) The dependance on data.json has been removed.

OpenDDS - Solution builds fine, examples run, but IDL exes crash

I have successfully built OpenDDS 3.13.2 from source. Here is my environment:
Windows 10
Visual Studio 2017 (re-targeted Solution to SDK 10.0.17763.0)
Tried all Configuration/Platform combinations
I successfully used the configure script from the VS command prompt, built everything by opening the generated solution in the same command prompt, and finally ran the Messenger example (publisher and subscriber), and even configured it to use RTPS successfully.
However, when I try to create my own IDL and use the tao_idl, it crashes. Here's my test (using the proper environment from setenv.cmd):
> tao_idl (no args)
IDL: No input files
Second test:
> tao_idl Test.idl (crashes)
I get no error message, and am unable to locate logs or any indication of what went wrong. The same thing happens when I used opendds_idl.
What is the best approach to debug this, and/or are there pre-built binaries available for the IDL compiler(s) (both TAO and OpenDDS)?
After about a day of troubleshooting, I have determined a solution. Despite being able to call tao_idl and opendds_idl yourself, you should basically never do it. There are a good amount of command-line arguments needed to get both to work, and if they're not present, each exe will crash without the proper reasoning why.
I will add my steps below to create a new basic two-exe pub/sub project using OpenDDS:
Create your own IDL file.
Starting with the DCPS Messenger example, modify the .mpc file, replacing Messenger.idl with your IDL file name.
Create a new file called <your project>.mwc, and add the following contents:
workspace {
// the -relative and -include cmdlines make it so this workspace
// does not have to be in the $DDS_ROOT directory tree.
// tell MPC to substitute our DDS_ROOT environment variables for relative paths
cmdline += -relative DDS_ROOT=$DDS_ROOT
// tell the projects where to find the DDS base projects (*.mpb)
cmdline += -include $DDS_ROOT/MPC/config
}
Open a new VS command-line terminal and run $DDS_ROOT/setenv.cmd, or open a regular terminal if you have those environment variables set via Windows settings.
Navigate to your project directory and call: mwc.pl -type vs2017, replacing "vs2017" as needed for your build tool/IDE.
Open up the generated solution, and retarget it as necessary for your Windows SDK version.
Build the <your project>_IDL project first. If you notice in the output window, it is invoking the tao_idl and opendds_idl commands automatically. You can view the .vcxproj files to see the full command-line arguments that were the original problem.
Modify the publisher.cpp, subscriber.cpp, and DataReaderListenerImpl.cpp files to match your new IDL. Run the example as usual and ta-da!
For completeness, the full commands for both tao_idl and opendds_idl are as follows:
> opendds_idl -Sa -St "<your file>.idl"
> tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -I$(DDS_ROOT) "<your file>.idl"
> tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -I$(DDS_ROOT) "<your file>TypeSupport.idl"

How to find interface/ftdi/esp32_devkitj_v1.cfg in procedure 'script'?

I'm trying to debug esp32 with ft2232d debugger , however at the openocd running script i'm getting this below mentioned error.
./openocd -s share/openocd/scripts -f ../interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg
Open On-Chip Debugger 0.10.0+dev-00703-g21687eb (2019-03-04-16:30)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:63: Error: Can't find ../interface/ftdi/esp32_devkitj_v1.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 63
Now, i understand that my interface directory is not finding the esp32 cfg file but i searched and there is no such file.
Also Building openocd from the scatch has let to no bin files present in the main directory but these files are found in src folder.
Thanks for your help.
If you're using Eclipse, try wrapping the file path of your config in double quotes. I had a similar error, and changing the argument to -f "interface/stm32f429.cfg" seemed to fix that error for me.

Git dependency errors when using Composer with private VCS repository on IBM i

More details below, but I'm running into the following error when I issue a composer install or composer update command on a project which uses a custom VCS repository for an included project. This is on an IBM i v7r3 system via SSH session. I've run out of ideas on how to troubleshoot further, so here I am. Has anyone ever seen this error or have any ideas on how to troubleshoot further?
Error:
bash-4.4$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 113 installs, 0 updates, 0 removals
- Installing sshUser/myPackage (v1.0.26): Cloning a2db0666b1
[RuntimeException]
Failed to clone gitUser:/opt/git/myPackage.git, git was not found, check that
it is installed and in your PATH env.
Could not load program git:
Dependent module /usr/local/zendphp7/lib/libz.so.1(shr_64.o) could not be loaded.
File /usr/local/zendphp7/lib/libz.so.1 is not an
archive or the file could not be read properly.
System error: Exec format error
I have a remote IBM i server which has two users. The first user "gitUser" is used for my private Git repositories (headless). I then have another user "sshUser" which is used to SSH in with and do my typical work. I have SSH keys configured to simplify connections for both users and the "gitUser" ssh key doesn't require a password, so I can use it for automated scripting.
I have a private VCS repository included in my composer.json file for a project. So long as I have the entry in the "repository" section I'm getting the above error. This occurs even if I'm not requireing a package from the repository.
Repository Entry:
"repositories": [
{
"type": "vcs",
"url": "gitUser:/opt/git/myPackage.git"
}
]
Composer on the IBM i is up to date at 1.7.2.
It's clear the issue lies with git and the inability to find a dependency in libz.so.1.
However, if I follow the chain of dependencies for the version of Git in my path, all the appropriate files exist with adequate permissions:
bash-4.4$ which git
/QOpenSys/pkgs/bin/git
bash-4.4$ dump -X64 -H /QOpenSys/pkgs/bin/git
/QOpenSys/pkgs/bin/git:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x000000df 0x0000433f 0x0000009d
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000006 0x00044910 0x00000a18 0x000449ad
***Import File Strings***
INDEX PATH BASE MEMBER
0 /QOpenSys/pkgs/lib:/QOpenSys/usr/lib
1 libz.so.1 shr_64.o
2 libiconv.so.2 shr_64.o
3 libcrypto.so.1.0.0 shr_64.o
4 libpthread.a shr_xpg5_64.o
5 libc.a shr_64.o
bash-4.4$
I can confirm there are no permission failures through out all of this. So this doesn't seem to be the result of inadequate permissions. Also, I do not think the issue lies within the user profile gitUser as if I issue a composer install or composer update from another machine (with appropriate keys), everything works flawlessly. So it seems to be specific to the IBM i and the sshUser profile.
I'm starting to think Composer is using a different git executable and the dependencies of that executable do not exist. Though I assume Composer would just use my path.
Note*: I tried specifying my LIBPATH in my ./.profile with the following. But it doesn't seem to make any difference:
LIBPATH=/usr/local/zendphp7/lib
LIBPATH=$LIBPATH:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
export LIBPATH
When echoing:
bash-4.4$ echo $LIBPATH
/usr/local/zendphp7/lib:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
bash-4.4$
If I don't add the above to my ./.profile, then echo $LIBPATH prints a blank line to screen.
Solution:
I just changed the symlink in the ZENDPHP7 directory structure to the repo version. Alternatively you can manipulate your library path, but I couldn't figure out the proper way to do it on IBM i.
bash-4.4$ pwd
/usr/local/zendphp7/lib
bash-4.4$ ln -s /QOpenSys/pkgs/lib/libz.so.1 ./libz.so.1
bash-4.4$ ls -la /usr/local/zendphp7/lib/libz.so.1
lrwxrwxrwx 1 dl 0 56 Oct 11 14:21 /usr/local/zendphp7/lib/libz.so.1 -> /QOpenSys/pkgs/lib/libz.so.1
bash-4.4$
I'm guessing something is off with your path when you do the install. Is it maybe looking at the Zend PHP libraries rather than the expected ones in /usr/lib?
Notice that the errors shows a path of /usr/local/zendphp7/lib/ libz.so.1(shr_64.o) while your git dump instead shows /QOpenSys/pkgs/lib:/QOpenSys/usr/lib.

Resources