This semester I got this new subject where we get to work with Discovery STM32 F4, and we are still in the phase of setting it up. But I have this problem in the beginning.
When I try to compile this «blink» code I get this error:
So, as I got it so far, we are using this shortcut command «make» to compile code, and we were given instruction to set it up as it’s shown in images below:
Can anyone see what’s the problem here?
Paolo
19.4k6 gold badges35 silver badges65 bronze badges
asked Apr 1, 2016 at 20:59
4
Error 127
means one of two things:
- file not found: the path you’re using is incorrect. double check that the program is actually in your
$PATH
, or in this case, the relative path is correct — remember that the current working directory for a random terminal might not be the same for the IDE you’re using. it might be better to just use an absolute path instead. - ldso is not found: you’re using a pre-compiled binary and it wants an interpreter that isn’t on your system. maybe you’re using an x86_64 (64-bit) distro, but the prebuilt is for x86 (32-bit). you can determine whether this is the answer by opening a terminal and attempting to execute it directly. or by running
file -L
on/bin/sh
(to get your default/native format) and on the compiler itself (to see what format it is).
if the problem is (2), then you can solve it in a few diff ways:
- get a better binary. talk to the vendor that gave you the toolchain and ask them for one that doesn’t suck.
- see if your distro can install the multilib set of files. most x86_64 64-bit distros allow you to install x86 32-bit libraries in parallel.
- build your own cross-compiler using something like crosstool-ng.
- you could switch between an x86_64 & x86 install, but that seems a bit drastic ;).
answered Apr 2, 2016 at 1:02
Mike FrysingerMike Frysinger
2,7991 gold badge21 silver badges26 bronze badges
2
I am trying to teach myself gnuMake after learning the basics of C++
I am running Ubuntu 14.04 equivalent (elementary os)
And I am getting the error (full output of make run):
g++ ./main.o -w -o test
This is a test!
/bin/sh: 1: This: not found
make: *** [exe] Error 127
My Makefile:
CC=g++
SRC=$(shell find -name '*.cpp')
OBJS= $(SRC:.cpp=.o)
EXEC=test
FLAGS= -w
LINKS=
%.o: %.cpp
$(CC) -c $*.cpp -o $*.o
$(EXEC): $(OBJS)
$(CC) $(OBJS) $(FLAGS) $(LINKS) -o $(EXEC)
all: $(EXEC)
exe:
$(shell ./$(EXEC))
run: all exe
clean:
rm -rf *.o $(EXEC)
This is a combination of taking basic make tutorials and reading Makefiles in github
main.cpp:
#include <iostream>
using namespace std;
int main()
{
cout << "This is a test!" << endl;
return 0;
}
Pretty Basic, but will be extending it to help learn to use and extend my Makefile. Now I can see the program compiles and runs, but I get the error after the run.
I searched for Make error 127 and that seems to output that error for many things, but I did not see a definition for the error, or a similar issue to mine.
I am trying to install shc on Ubuntu 18.04
wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
tar xvfz shc-3.8.9.tgz
cd shc-3.8.9
make
But receive the following error:
cc -Wall shc.c -o shc
make: cc: Command not found
makefile:31: recipe for target 'shc' failed
make: *** [shc] Error 127
The makefile:
# Makefile
#
INSTALL_PATH = /usr/local
# For SCO
CFLAGS = -b elf -O -D_SVID
# For IRIX
CFLAGS = -xansi -fullwarn -O3 -g0
# For Solaris
CFLAGS = -fast -xO4 -s -v -Xa
# For HPUX
CFLAGS = -Wall -O -Ae
# For OSF1
CFLAGS = -w -verbose -fast -std1 -g0
# For GNU C compiler
CFLAGS = -Wall # -O6 -pedantic
#SHELL = /bin/sh
SHCFLAGS = -v -T # Add -T option to allow binary to be traceable
all: shc ask_for_test
shc: shc.c
$(CC) $(CFLAGS) $@.c -o $@
ask_for_test:
@echo '*** �Do you want to probe shc with a test script?'
@echo '*** Please try... make test'
test: make_the_test ask_for_strings
make_the_test: match.x
@echo '*** Running a compiled test script!'
@echo '*** It must show files with substring "sh" in your PATH...'
./match.x sh
match.x: shc match
@echo '*** Compiling script "match"'
CFLAGS="$(CFLAGS)" ./shc $(SHCFLAGS) -f match
ask_for_strings:
@echo '*** �Do you want to see strings in the generated binary?'
@echo '*** Please try... make strings'
strings: make_the_strings ask_for_expiration
make_the_strings: match.x
@echo '*** Running: "strings -n 5 'match.x'"'
@echo '*** It must show no sensible information...'
strings -n 5 match.x
ask_for_expiration:
@echo '*** �Do you want to probe expiration date?'
@echo '*** Please try... make expiration'
expiration: til_yesterday ask_for_install
til_yesterday: shc match
@echo '*** Compiling "match" to expired date'
CFLAGS="$(CFLAGS)" ./shc $(SHCFLAGS) -vv -e `date "+%d/%m/%Y"` -f match
@echo '*** Running a compiled test script!'
@echo '*** It must fail showing "./match.x: has expired!"'
./match.x
ask_for_install:
@echo '*** �Do you want to install shc?'
@echo '*** Please try... make install'
install: shc
@echo '*** Installing shc and shc.1 on '$(INSTALL_PATH)
@echo -n '*** �Do you want to continue? '; read ANS; case "$$ANS" in y|Y|yes|Yes|YES) ;; *) exit 1;; esac;
install -c -s shc $(INSTALL_PATH)/bin/
install -c -m 644 shc.1 $(INSTALL_PATH)/man/man1/
clean:
rm -f *.o *~ *.x.c
cleanall: clean
rm -f shc *.x
I have no idea how to fix this error. Can anyone help?
slava
3,7679 gold badges30 silver badges65 bronze badges
asked Nov 22, 2018 at 17:24
2
cc is an alias for the GNU C compiler (gcc). You can install it as follows:
sudo apt install gcc
If, for some reason, the gcc compiler is already installed, but the symbolic link /usr/bin/cc
is missing, you can also do:
make CC=gcc
answered Nov 22, 2018 at 18:07
1
sudo apt install build-essential
This will install a C compiler (providing the cc
command) as well as other tools that you may need for building software from source.
answered Nov 22, 2018 at 19:39
moomoo
6656 silver badges14 bronze badges
Terminals are very powerful, regardless of what operating system you’re using. This means that while you can perform just about any OS task with a few commands, you need to know these commands to take advantage of them. Of course, different operating systems use different languages in their terminals as well, meaning you need to decide to have mastery over one or use multiple.
In this article, we’re talking about Make error 127, its causes and what you can do to fix the problem.
What causes Make error 127?
The Make error 127 generally occurs when you’re working with a Go operator-sdk project cloned from Github as the command doesn’t generate the bin directory with the required files to run the Make installation.
As for code 127, it simply indicates a “command not found” error. Since the initial command hasn’t generated the files required, the Make installation fails as the system can’t find the source files to run or read the command.
Also read: How to fix ‘wget command not found’ issue in Bash?
Depending on what’s causing your error, here are two fixes you can try out.
Reinstall a different version of the Operator-SDK
First up, if the problem is being caused by operator-sdk, we can try either rolling back to version 18.0.0 or pushing forward to the latest version available (assuming the latest version has fixed the bug.
All you have to do is uninstall operator-sdk using brew or apt-get or whatever package manager you’re using. Once that’s done, we reinstall a different version (either version 18.0.0 or the latest one) as well as the latest version of Go. Keep in mind that if you’re using version 18.0.0 of operator-sdk, we recommend installing version 1.17.6 of Go.
Finally, check if the bin folder has now been created and if it has, you can go ahead and run your Make installation without any errors.
Check your PATH variables
Since error 127 also indicates that a command or file required to run a command is missing, try checking your PATH variable to see if the command exists there. Alternatively, a simpler way of doing this is opening a terminal in the root directory of whatever command you want to run and then run the problematic command.
Also read: Fix: Error:03000086:digital envelope routines::initialization error
Maybe you will get the following error when you try to work with a go operator-sdk
project you cloned from GitHub.
Here we see that simply the bin
directory with the needed controller-gen
, kustomize
and setup-envtest
files, wasn’t created by operator-sdk commands.
This blog post does address that topic for a macOS
operating system and is structured in following sections:
- Fast solution
- Reproduce the problem
- Fix the problem
1. Fast solution
In short words we need just to copy the
bin
directory from an existing operator-sdk project we have on our machine and past it into the cloned project and it will work for our cloned project.
But we will have problems, when we create new projects with that installation setup using brew install operator-sdk
.
(even when this is my preferred way 😦 because I want to avoid FATA[0009] failed to create API: unable to run post-scaffold tasks of “base.go.kubebuilder.io/v3”: exit status 2)
I created a GitHub issue.
2. Reproduce the problem
We are using the currently available operator SDK version 19.1.0 which we installed using brew as described in the operator-sdk documentation.
Step 1: Clone a GO operator-sdk project from GitHub
git clone https://github.com/thomassuedbroecker/multi-tenancy-frontend-operator.git cd multi-tenancy-frontend-operator/frontendOperator
Step 2: Run make generate and get the error
- Example output:
As we will see, there are files and bin folder missing.
bin/controller-gen: No such file or directory
... go: added sigs.k8s.io/yaml v1.3.0 /multi-tenancy-frontend-operator/frontendOperator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." bash: /Users/thomassuedbroecker/Downloads/dev/verify/multi-tenancy-frontend-operator/frontendOperator/bin/controller-gen: No such file or directory make: *** [generate] Error 127
Step 3: Verify operator-sdk version
- Example output:
Ensure you have operator-sdk version: "v1.19.1"
installed.
operator-sdk version: "v1.19.1", commit: "079d8852ce5b42aa5306a1e33f7ca725ec48d0e3", kubernetes version: "v1.23", go version: "go1.18.1", GOOS: "darwin", GOARCH: "amd64"
3. Fix the problem for now
We are using an Operator SDK version that worked before, in my case I used 18.0.0 successfully some time ago. As far as I remember, golang version 1.17.6 was related to operator-sdk 18.0.0 version.
Note: If you want to install an older Operator SDK version with brew, that won’t work as there is only one brew formulae, as I found out. I hope that the brew installation will be fixed in the future.
So, we will do the following sequence to fix the problem:
- Uninstall the
operator-sdk
we installed with brew - Install
operator-sdk 18.0.0
using the binaries and install golang in versiongo 1.17.6
- Verify does the creation of a new operator project now include the
bin
and the related files
Step 1: Uninstall operator-sdk
we installed with brew
Follow the steps outlined in one of my blog posts, but only for uninstalling. The current version of the operator-sdk in brew is 1.19.1
.
YOUR_USER=YOUR_USER sudo go clean -cache brew uninstall operator-sdk brew uninstall go sudo rm -rf /usr/local/Cellar/go sudo rm -rf /usr/local/go sudo rm -rf /Users/$YOUR_USER/go
Step 2: Install operator-sdk 18.0.0
and goland 1.17.6 using the binaries¶
Here we follow the related operator-sdk documentation.
1. Create a folder for your downloads
mkdir operator-sdk cd operator-sdk
2. Set platform information
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac) export OS=$(uname | awk '{print tolower($0)}')
3. Download the binary for your platform
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.18.0 curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
4. Install the release binary in your PATH
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
5. Download go 1.17.6
https://go.dev/dl/go1.17.6.darwin-amd64.pkg
6. Install go 1.17.6
using the downloaded file
7. Verify the installed operator-sdk and golang version
- Example output:
operator-sdk version: "v1.18.0", commit: "c9c61b6921b29d731e64cd3cc33d268215fb3b25", kubernetes version: "1.21", go version: "go1.17.7", GOOS: "darwin", GOARCH: "amd64"
3. Confirm that creating a new operator project now contains the bin and associated files
Let us just create an example project problemfix
.
Step 1: Create a new empty folder outside the cloned project¶
cd .. mkdir fixproblem cd fixproblem
Step 2: Run operator-sdk init
operator-sdk init --domain myproblemfix.net --repo github.com/myproblemfix/myproblemfix
- Example output:
... go: downloading github.com/kr/text v0.2.0 go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 go: downloading github.com/cespare/xxhash v1.1.0 Next: define a resource with: $ operator-sdk create api
Step 2: Create an API¶
operator-sdk create api --group myproblemfix --version v1alpha1 --kind Myproblemfix --resource --controller
- Example output:
... Next: implement your new API and generate the manifests (e.g. CRDs,CRs) with: $ make manifests
Step 3: Run make generate
make generate make manifest make build
Step 3: Verify the bin folder
and the needed files were created¶
fixproblem % tree . ├── Dockerfile ├── Makefile ├── PROJECT ├── api │ └── v1alpha1 │ ├── groupversion_info.go │ ├── myproblemfix_types.go │ └── zz_generated.deepcopy.go ├── bin │ ├── controller-gen │ ├── kustomize │ └── manager ├── config │ ├── crd │ │ ├── bases │ │ │ └── myproblemfix.myproblemfix.net_myproblemfixes.yaml │ │ ├── kustomization.yaml │ │ ├── kustomizeconfig.yaml │ │ └── patches │ │ ├── cainjection_in_myproblemfixes.yaml │ │ └── webhook_in_myproblemfixes.yaml │ ├── default │ │ ├── kustomization.yaml │ │ ├── manager_auth_proxy_patch.yaml │ │ └── manager_config_patch.yaml │ ├── manager │ │ ├── controller_manager_config.yaml │ │ ├── kustomization.yaml │ │ └── manager.yaml │ ├── manifests │ │ └── kustomization.yaml │ ├── prometheus │ │ ├── kustomization.yaml │ │ └── monitor.yaml │ ├── rbac │ │ ├── auth_proxy_client_clusterrole.yaml │ │ ├── auth_proxy_role.yaml │ │ ├── auth_proxy_role_binding.yaml │ │ ├── auth_proxy_service.yaml │ │ ├── kustomization.yaml │ │ ├── leader_election_role.yaml │ │ ├── leader_election_role_binding.yaml │ │ ├── myproblemfix_editor_role.yaml │ │ ├── myproblemfix_viewer_role.yaml │ │ ├── role.yaml │ │ ├── role_binding.yaml │ │ └── service_account.yaml │ ├── samples │ │ ├── kustomization.yaml │ │ └── myproblemfix_v1alpha1_myproblemfix.yaml │ └── scorecard │ ├── bases │ │ └── config.yaml │ ├── kustomization.yaml │ └── patches │ ├── basic.config.yaml │ └── olm.config.yaml ├── controllers │ ├── myproblemfix_controller.go │ └── suite_test.go ├── go.mod ├── go.sum ├── hack │ └── boilerplate.go.txt └── main.go
Summary¶
With that we ensure you have a working version. Now you can try to install different operator-sdk binaries if they work with the golang 1.17.6 related to operator development.
I hope this was useful to you and let’s see what’s next?
Greetings,
Thomas
#operatorsdk, #macos, #golang, #operators