Linux无法执行二进制文件

问题描述:在Cygwin下,执行shell脚本发现,wav文件无法执行,一直报:无法执行二进制文件: Exec format error。换了cyswin的位数也不行

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
大神们 求教 无法执行 二进制文件

为什么我用gcc编译生成的二进制文件 ./xxx bash: xxx无法执行二进制文件 这是怎么回事?求教 ubantu 是32位

golang无法执行二进制文件:Exec格式错误

<div class="post-text" itemprop="text"> <p>my go env</p> <pre><code>GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GO15VENDOREXPERIMENT="" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0" CXX="g++" CGO_ENABLED="1" </code></pre> <p>I compiled and successfully executed the binary on my mac and then copied it to the ubuntu machine whose go env is show above. When I call myprog binary, I get</p> <pre><code>bash: /usr/local/go/bin/myprog: cannot execute binary file: Exec format error </code></pre> </div>

使用cygwin配置交叉编译失败,提示无法执行二进制文件?(第一次配置,学网上很多的教程还是没解决)

提问前提:已经在网上,CSDN 以前都是搞单片机,对linux只会点命令,现在要做一个arm-none-eabi-gcc的交叉编译环境,别人提供cygwin软件和交叉编译工具包。我拿到后, 首先安装cygwin,按照网上装了些软件包后,把交叉编译包解压在 home/arm-tool下,然后用tar解压,再去/home下修改.bashrc文件,把解压后的bin路径包含进去,重启终端,执行 arm-none-eabi-gcc -v,提示执行二进制文件无法执行。 ![图片说明](https://img-ask.csdn.net/upload/201903/21/1553156531_152723.png) ![图片说明](https://img-ask.csdn.net/upload/201903/21/1553156570_786170.png) (给工具包的人联系不上了,里面只有简单的几部安装步骤,没什么错误) 网上说,一是权限问题,我直接chmod 777 -R arm-tool目录,la -l查看确认是全部权限后再次尝试,还是刚才的错误提示。二是说将该程序二进制包拷贝过来,重新编译程序。我只有别人给的压缩包,不懂怎么拷二进制包过来,寻思是不是重新make一遍交叉工具,但是找完解压后的交叉工具文件也没有Makefile,几天过去了,卸了又重新装几次,实在没办法了,第一次提问,谢谢!

“执行构建”命令后无法找到可执行文件/二进制文件

<div class="post-text" itemprop="text"> <p>I am new to golang and I have a single package go file "hello_world.go" which I am compiling via "go build hello_world.go". After this I expect to see executable "hello_world". But I donot see it.</p> <p>I tried options -x and -v with "go build " and below is the output</p> <pre><code>go build -x -v hello_world.go WORK=/tmp/go-build697702511 command-line-arguments mkdir -p $WORK/command-line-arguments/_obj/ mkdir -p $WORK/ cd /home/vignesh/exercism/go/hello-world /usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/command-line- arguments.a -trimpath $WORK -goversion go1.9.2 -p command-line-arguments -complete -buildid 1d40767f999b0c5cb646b061911455ddde0101d2 -D _/home/vignesh/exercism/go/hello-world -I $WORK -pack ./hello_world.go </code></pre> <p>below is the content of my working directory after above two "go build" operations</p> <pre><code>-rw------- 1 vignesh vignesh 208 Jul 17 20:50 .solution.json -rw-rw-r-- 1 vignesh vignesh 1451 Jul 17 20:50 README.md -rw-rw-r-- 1 vignesh vignesh 1311 Jul 17 20:50 hello_test.go_bkp drwxr-xr-x 4 vignesh vignesh 4096 Jul 18 18:27 .. -rw-rw-r-- 1 vignesh vignesh 1311 Jul 18 20:27 hello_test.go -rw-rw-r-- 1 vignesh vignesh 684 Jul 18 20:29 hello_world.go drwxr-xr-x 2 vignesh vignesh 4096 Jul 18 20:57 . </code></pre> <p>I then tried "go build -o aaa hello_world.go" which generated binary file "aaa", which on execution gave following errors:</p> <pre><code>./aaa: line 1: syntax error near unexpected token `newline' ./aaa: line 1: `!&lt;arch&gt;' </code></pre> <p>below is the output of "go env "</p> <pre><code>GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/vignesh/exercism/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build845978294=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" </code></pre> <p>Kindly help me with a fix or any sugestions to debug this issue.</p> <p>Thanks in advance</p> </div>

无法在Docker容器中执行二进制文件,但从主机执行

<div class="post-text" itemprop="text"> <p>I have a docker container based on <code>composer:1.8</code>(based on <code>php:7-alpine</code>).</p> <p>Inside the container I download a <code>tar.gz</code> via php, decompress it and extract it which works fine. This contains a Go binary I want to execute. When executing the binary inside the docker container I get this error message: <code>./bin/&lt;binary&gt;: No such file or directory</code>. On my host machine I can execute this binary downloaded inside the docker container perfectly fine.</p> <p>If it is important I start the docker container with: <code>docker run -it --rm --volume=$PWD:/usr/src/myapp -u $(id -u):$(id -g) --name ec ec /bin/bash</code></p> <p>I also tried to run <code>readelf -a &lt;binary&gt;</code> after installing it, but that doesn't have any effect.</p> <pre><code>bash-4.4$ ls -l &lt;binary&gt; &amp;&amp; echo userid: $(id -u) &amp;&amp; echo groupid: $(id -g) &amp;&amp; uname -om &amp;&amp; ./&lt;binary&gt; -rwxr-xr-x 1 1000 985 7582050 Mar 15 17:09 &lt;binary&gt; userid: 1000 groupid: 985 x86_64 Linux bash: ./&lt;binary&gt;: No such file or directory </code></pre> <p>What can I do to make this work?</p> </div>

从树莓派虚拟机上用qt编译好的可执行文件,放到目标机上运行却显示无法执行二进制文件?

![图片说明](https://img-ask.csdn.net/upload/201902/20/1550651180_701497.jpg) 我是直接把debug的文件移过去的,但也无法执行。

cURL下载二进制文件“双打”文件

<div class="post-text" itemprop="text"> <p>We are using cURL to download files from one of our servers to our workflow server. I'm using the simple code pasted below, but my files are "doubling up" - twice the size, twice the length. Would seem the file is saved, then appended again, but I can't figure out why in the world that is happening.</p> <p>Below is test code on my local machine behaving exact same way:</p> <pre><code> $file_name = 'test.mp3'; $copy_to_dir = 'C:/test_files/'; $file_url = 'C:/source_files/test.mp3'; $fp = fopen ($copy_to_dir. '/' . $file_name, 'w'); $ch = curl_init($file_url); curl_setopt_array($ch, array( CURLOPT_URL =&gt; $file_url, CURLOPT_RETURNTRANSFER =&gt; 1, CURLOPT_FILE =&gt; $fp, CURLOPT_TIMEOUT =&gt; 50 )); $results = curl_exec($ch); if(curl_exec($ch) === false) { //echo 'Curl error: ' . curl_error($ch); return false; } curl_close($ch); fclose($fp); </code></pre> <p>Original file is 9MB, copy is 18MB every time</p> <p>EDIT: let this be a lesson to you not copy/paste code when you're in a hurry, to "save time". The second curl_exec() should be a curl_errno() or other error handling strategy - even just using fwrite() meant I would be downloading everything twice, so you don't want to just quit once you get a workaround</p> </div>

C语言写入数据到二进制文件失败

# 相关代码如下 # 我在add()调用lessondatewrite()写进去了 #但是lessondateltater()调用lessondatewrite()没写进去 # 调试结果![图片说明](https://img-ask.csdn.net/upload/201811/02/1541169947_50238.png) #运行结果 英语行的 40 应该变成39 ![图片说明](https://img-ask.csdn.net/upload/201811/02/1541169992_687847.png) ``` typedef struct //定义一个Lesson类型的结构体 { char name[50]; char techer[50]; char location[50]; char time[50]; int number; }LESSON; /*课程结构体参数 课程名 char 50字节 授课老师 char 50字节 位置 char 50字节 开课时间 char 50字节 座位数 int 4字节 结构体大小总计 204字节*/ LESSON lessondatewrite(FILE *fl,LESSON date)//这是一个结构体类型的函数,它可以写入课程数据,接受一个文件指针 { fflush(fl);//刷新缓存区 使将要输入的数据写入硬盘 一次性输入大量数据时使用 避免输入失败 fwrite(&date,sizeof(LESSON),1,fl); } void add()//添加一个课程数据 { FILE *lessondate; LESSON lesson={0};// 声明一个LESSON类型的变量为lesson if((lessondate=fopen("lessondate","rb+"))==NULL)//若文件不存在,则建立文件 { lessondate=fopen("lessondate","wb+"); //rb+打开二进制文本文件,允许读写,若不存在返回空 //wb+新建二进制文本文件,允许读写。如果文件存在则删除文件重建 } printf("请依次输入如下数据,课程名,授课老师,教室位置,开课时间(xx月xx日xx:xx),座位数(各数据以空格隔开,回车结束)\n"); scanf("%s %s %s %s %d",&lesson.name,&lesson.techer,&lesson.location,&lesson.time,&lesson.number); //scanf在接收字符串时 不会接收空白符(空格与回车) 逗号或其他都能接收 //%s不能使用char 而是char[] fseek(lessondate,0L,SEEK_END); lessondatewrite(lessondate,lesson); fclose(lessondate); system("cls"); admin(); } void lessondatelater(int choose) { FILE *lessondate; LESSON lesson={0}; int i; lessondate=fopen("lessondate","rb+"); for(i=0;i<choose;i++) { lesson=lessondateread(lessondate);//给读取函数传递一个文件指针 假定有是三个结构体A B C 循环结束后光标在C前面B后面 } fseek(lessondate,-204L,SEEK_CUR);//后退到上一个结构体 此时光标在B前面 lesson=lessondateread(lessondate);//读取这个结构体数据 读取B的数据 此时光标前进到C前面 lesson.number--;//修改结构体数据 fseek(lessondate,-204L,SEEK_CUR);//后退到上一个结构体 此时光标在B前面 lessondatewrite(lessondate,lesson);//写入修改后结构体数据 覆盖B } ```

虚拟机执行xampp包,执行后出错

本人在虚拟机下上传了一个xampp软件集成包名字为xampp-linux-x64-1.8.2-6-installer.run,切换到文件所在目录之后,给了文件777的权限,在对应目录执行 ./xampp-linux-x64-1.8.2-6-installer.run竟然会报错,报错如下 ![图片说明](https://img-ask.csdn.net/upload/201703/30/1490805065_549494.png) 不能执行二进制文件,这是什么问题?我的电脑系统是windows的,用的虚拟机是vmware10,虚拟机系统是centos6.4

将带有库的可执行二进制文件嵌入到golang应用程序中并运行它

<div class="post-text" itemprop="text"> <p>I have a binary executable file with libraries and I need to embed them all to a golang app, and run the binary via <code>os/exec</code> as a new process from the app. The app runs on Linux with all necessary rights. </p> <p>How to launch the binary itself, with libraries and arguments, and create a new process? The best, without creating any temporary files.</p> </div>

golang exec.Command无法运行C二进制文件

<div class="post-text" itemprop="text"> <p>I executing a C executable using exec.Command and exec.Start(). My C executable is in the current directory and this is my code</p> <pre><code>cmd := exec.Command("./a.out") // stdout,err := cmd.StderrPipe() stderr,_ := cmd.StderrPipe() err := cmd.Start() if err != nil { log.Fatal(err) } log.Printf("Waiting for command to finish...") s,err := ioutil.ReadAll(stderr) log.Printf(string(s)) err = cmd.Wait() log.Printf("Command finished with error: %v", err) </code></pre> <p>When i run this code, this is the output i get </p> <pre><code>2014/12/10 07:49:39 Waiting for command to finish... 2014/12/10 07:49:39 Command finished with error: exit status 11 </code></pre> <p>My C hello world program is</p> <pre><code>#include &lt;stdio.h&gt; int main(){ printf("hello world"); } </code></pre> <p>The C code is compiled with gcc version 4.8.2 and executable is a.out.</p> <p>The C executable a.out is a simple hello world program, i am getting the correct output, but i can't understand why exec.Wait() is exiting with status code 11 and not with 0.</p> <p>The executable('a.out') is running normally when i run on a linux terminal without any faults or errors</p> </div>

Go编译的二进制文件不会在Ubuntu主机上的高山Docker容器中运行

<div class="post-text" itemprop="text"> <p>Given a binary, compiled with Go using <code>GOOS=linux</code> and <code>GOARCH=amd64</code>, deployed to a <code>docker</code> container based on <code>alpine:3.3</code>, the binary will not run if the docker engine host is Ubuntu (15.10):</p> <pre><code>sh: /bin/artisan: not found </code></pre> <p>This same binary (compiled for the same OS and arch) will <strong>run just fine</strong> if the docker engine host is <code>busybox</code> (which is the base for <code>alpine</code>) deployed within a VirtualBox VM on Mac OS X.</p> <p>This same binary will also run perfectly fine if the container is based on one of Ubuntu images.</p> <p><strong>Any idea what this binary is missing?</strong></p> <p>This is what I've done to reproduce (successful run in VirtualBox/busybox on OS X not shown):</p> <p>Build (building explicitly with flags even though the arch matches):</p> <pre><code>➜ artisan git:(master) ✗ GOOS=linux GOARCH=amd64 go build </code></pre> <p>Check it can run on the host:</p> <pre><code>➜ artisan git:(master) ✗ ./artisan 10:14:04.925 [ERROR] artisan: need a command, one of server, provision or build </code></pre> <p>Copy to docker dir, build, run:</p> <pre><code>➜ artisan git:(master) ✗ cp artisan docker/build/bin/ ➜ artisan git:(master) ✗ cd docker ➜ docker git:(master) ✗ cat Dockerfile FROM docker:1.10 COPY build/ / ➜ docker git:(master) ✗ docker build -t artisan . Sending build context to Docker daemon 10.15 MB Step 1 : FROM docker:1.10 ... ➜ docker git:(master) ✗ docker run -it artisan sh / # /bin/artisan sh: /bin/artisan: not found </code></pre> <p>Now changing the image base to <code>phusion/baseimage</code>:</p> <pre><code>➜ docker git:(master) ✗ cat Dockerfile #FROM docker:1.10 FROM phusion/baseimage COPY build/ / ➜ docker git:(master) ✗ docker build -t artisan . Sending build context to Docker daemon 10.15 MB Step 1 : FROM phusion/baseimage ... ➜ docker git:(master) ✗ docker run -it artisan sh # /bin/artisan 08:16:39.424 [ERROR] artisan: need a command, one of server, provision or build </code></pre> </div>

在Docker容器中内置的Golang二进制文件,仍然是Mach-O可执行格式吗?

<div class="post-text" itemprop="text"> <p>I could really use some help here. What I am trying to do is use the standard golang:1.5 Docker image to build a Go binary, then copy that binary out of the container and into a new minimal Docker container based on busybox. The binary is pulled out of the container using a Docker mounted volume. There are two problems so far that I have run into. </p> <ol> <li><p>The resulting binary on the host (and subsequently copied into the second container) still seems to be a Mach-O 64-bit executable when running the <code>file</code> command. Is the Docker container somehow getting GOOS and GOARCH from the host?</p></li> <li><p>When manually running the container with <code>bash</code> and building the Go binary, it now says it is an ELF executable but it is dynamically linked. I thought by default built statically linked binaries? I could just be wrong in this assumption.</p></li> </ol> <p>Thanks in advance for any help you can provide. </p> <p>EDIT: Here are the commands I am using. Hopefully this makes it a bit more clear</p> <pre><code>## golang:1.5 base image with WORKDIR set to $GOPATH/src/myproject the source ## for the project was added in when creating the 'mybuild_img' docker image ## GOPATH is set automatically in the golang image. docker run -i -v `pwd`/jenkins/out:$GOPATH/src/myproject/jenkins/out mybuild_img:latest bash -c 'go build &amp;&amp; cp myproject ./jenkins/out' </code></pre> <p>Once the container is done running I have a Mach-O 64-bit executable in ./jenkins/out/. I'm not sure if this is some kind of weird behavior with docker-machine/boot2docker or anything like that. Just seems really weird. I have confirmed that if i set <code>GOOS=linux GOARCH=amd64</code> before the <code>go build</code> command, then I do get an executable of the correct type. Just trying to figure out what is going on here.</p> </div>

使用eclipse写C++时编译通过却没有生成二进制文件?

如图所示! ![图片说明](https://img-ask.csdn.net/upload/201811/14/1542162924_770171.jpg) ![图片说明](https://img-ask.csdn.net/upload/201811/14/1542162936_475054.jpg) ![图片说明](https://img-ask.csdn.net/upload/201811/14/1542162947_656049.jpg)

为Linux和Mac构建一个go二进制文件

<div class="post-text" itemprop="text"> <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/12168873/cross-compile-go-on-osx" dir="ltr">Cross compile Go on OSX?</a> <span class="question-originals-answer-count"> 6 answers </span> </li> </ul> </div> <p>How can I <code>go build</code> a project in a way that it works for both Mac and Linux (x86 and x64)? Is that even possible?</p> <p>I searched and found some stuff, but cannot make them work (or maybe I just didn't understood them).</p> </div>

无法执行golang引导程序安装程序的二进制文件

<div class="post-text" itemprop="text"> <p>I'm using the instructions in <a href="http://dave.cheney.net/2015/09/04/building-go-1-5-on-the-raspberry-pi" rel="nofollow">this blog post</a>, which is intended for installing go 1.5 on the Raspberry Pi, to install golang on my Chromebook (which has ChrUbuntu not Chromium installed). The technique recommended in the blog post is to install a Golang 1.4 bootstrap compiler <a href="http://dave.cheney.net/paste/go-linux-arm-bootstrap-c788a8e.tbz%20%7C%20tar%20xj" rel="nofollow">available here</a> and then use that to build golang 1.5 (as you need a version of go installed to build 1.5). I tried this on the Raspberry pi and it worked, but when I ran this command from /go/src on ChrUbuntu</p> <pre><code> env GO_TEST_TIMEOUT_SCALE=10 GOROOT_BOOTSTRAP=$HOME/go-linux-arm-bootstrap ./all.bash </code></pre> <p>It gave me this output</p> <pre><code> env GO_TEST_TIMEOUT_SCALE=10 GOROOT_BOOTSTRAP=$HOME/go-linux-arm-bootstrap ./all.bash # Building C bootstrap tool. cmd/dist ./make.bash: line 121: /home/user/go-linux-arm/bootstrap/bin/go cannot execute binary file </code></pre> <p>Why am I getting this error message (is it because it's not compatible with ChrUbuntu) and how to do what I am trying to do. Thank you in advance.</p> </div>

无法调试二进制文件-“无法启动进程:在二进制文件中找不到.debug_line节”

<div class="post-text" itemprop="text"> <p>I am working with GoLand IDE and I have the following simple code: </p> <pre><code>package main import ( "fmt" "time" ) func main() { start := time.Now() time.Sleep(2 * time.Second) elapsed := time.Since(start) fmt.Println("elapsed: %s", elapsed) } </code></pre> <p>When I run it, it works fine and I see the output.<br> When I put breakpoint in one of the lines I received the following error: </p> <pre><code>GOROOT=/usr/local/go #gosetup GOPATH=/root/go #gosetup /usr/local/go/bin/go build -o /tmp/___go_build_mymain_go -gcflags "all=-N -l" /root/go/src/myproj/mymain.go #gosetup /home/myuser/Desktop/GoLand-2018.1.4/plugins/go/lib/dlv/linux/dlv --listen=localhost:35607 --headless=true --api-version=2 --backend=default exec /tmp/___go_build_mymain_go -- #gosetup could not launch process: could not find .debug_line section in binary Debugger finished with exit code 1 </code></pre> <p>I didn't find any information regarding this error.<br> I read about debugging in Go and it was mentioned to use <code>-gcflags "all=-N -l"</code> which is being used. </p> <p>What can be the reason for this fail? </p> </div>

golang二进制文件未在mips上运行

<div class="post-text" itemprop="text"> <p>I'm using Go 1.11.4 on Windows 10 and I want to compile code for a MIPS 74Kc processor (Qualcomm Atheros QCA9558) running Linux. I compile with:</p> <p><code>GOOS=linux GOARCH=mips go build</code></p> <p>Get an executable, upload and run it and get:</p> <p><code>Illegal instruction</code></p> <p>Try again w/ <code>GOARCH=mipsle</code> and get:</p> <p><code>./hello_mipsle_linux: line 1: syntax error: unexpected "("</code></p> <p>What am I missing?</p> </div>

为什么我的交叉编译CGO二进制文件不能在Raspberry Pi(Raspbian)上运行?

<div class="post-text" itemprop="text"> <p>When I compile the following snippet of code (<a href="http://play.golang.org/p/wHb5Mtco2I" rel="nofollow">playground link</a>):</p> <pre><code>package main /* #cgo LDFLAGS: -lbluetooth #include &lt;bluetooth/bluetooth.h&gt; #include &lt;bluetooth/hci.h&gt; #include &lt;bluetooth/hci_lib.h&gt; */ import "C" func main() { C.hci_get_route(nil) } </code></pre> <p>…using these environment variables:</p> <pre><code>CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOARCH=arm GOARM=6 </code></pre> <p>I get a 1.6Mb binary that:</p> <ul> <li>works on my ODROID-C1 (ARMv7, running Arch, from archlinuxarm.org), but</li> <li>does not work on my Raspberry Pi B+ (ARMv6, running Raspbian, from raspberrypi.org).</li> </ul> <p>When I run it on the Pi, I get a "<code>Segmentation fault</code>".</p> <p>When I run it with these environment variables:</p> <pre><code>LD_PRELOAD=/lib/arm-linux-gnueabihf/libSegFault.so SEGFAULT_USE_ALTSTACK=1 </code></pre> <p>I get this output:</p> <pre><code>*** Segmentation fault Register dump: R0: 00000000 R1: 00000001 R2: bebf37f4 R3: bebf37fc R4: 00000000 R5: 00000000 R6: 00010c59 R7: 00000000 R8: 00000000 R9: 00000000 SL: b6f33000 FP: 00000000 IP: 0000004f SP: bebf37ec LR: 00010c6b PC: 0005d7f4 CPSR: 40000030 Trap: 0000000e Error: 00000817 OldMask: 00000000 Addr: 00000001 Backtrace: Memory map: 00010000-00125000 r-xp 00000000 b3:02 16193 /home/pi/test 00135000-0013b000 rw-p 00115000 b3:02 16193 /home/pi/test 0013b000-0014a000 rw-p 00000000 00:00 0 0026b000-00290000 rw-p 00000000 00:00 0 [heap] b6d53000-b6d73000 r-xp 00000000 b3:02 16080 /lib/arm-linux-gnueabihf/libgcc_s.so.1 b6d73000-b6d7a000 ---p 00020000 b3:02 16080 /lib/arm-linux-gnueabihf/libgcc_s.so.1 b6d7a000-b6d7b000 rw-p 0001f000 b3:02 16080 /lib/arm-linux-gnueabihf/libgcc_s.so.1 b6d7b000-b6e9f000 r-xp 00000000 b3:02 4254 /lib/arm-linux-gnueabihf/libc-2.13.so b6e9f000-b6ea6000 ---p 00124000 b3:02 4254 /lib/arm-linux-gnueabihf/libc-2.13.so b6ea6000-b6ea8000 r--p 00123000 b3:02 4254 /lib/arm-linux-gnueabihf/libc-2.13.so b6ea8000-b6ea9000 rw-p 00125000 b3:02 4254 /lib/arm-linux-gnueabihf/libc-2.13.so b6ea9000-b6eac000 rw-p 00000000 00:00 0 b6eac000-b6ec0000 r-xp 00000000 b3:02 4247 /lib/arm-linux-gnueabihf/libpthread-2.13.so b6ec0000-b6ec7000 ---p 00014000 b3:02 4247 /lib/arm-linux-gnueabihf/libpthread-2.13.so b6ec7000-b6ec8000 r--p 00013000 b3:02 4247 /lib/arm-linux-gnueabihf/libpthread-2.13.so b6ec8000-b6ec9000 rw-p 00014000 b3:02 4247 /lib/arm-linux-gnueabihf/libpthread-2.13.so b6ec9000-b6ecb000 rw-p 00000000 00:00 0 b6ecb000-b6ee0000 r-xp 00000000 b3:02 44311 /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3.12.0 b6ee0000-b6ee7000 ---p 00015000 b3:02 44311 /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3.12.0 b6ee7000-b6ee8000 r--p 00014000 b3:02 44311 /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3.12.0 b6ee8000-b6eea000 rw-p 00015000 b3:02 44311 /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3.12.0 b6ef8000-b6efa000 r-xp 00000000 b3:02 25761 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so b6efa000-b6f01000 ---p 00002000 b3:02 25761 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so b6f01000-b6f02000 rw-p 00001000 b3:02 25761 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so b6f02000-b6f04000 r-xp 00000000 b3:02 4246 /lib/arm-linux-gnueabihf/libSegFault.so b6f04000-b6f0b000 ---p 00002000 b3:02 4246 /lib/arm-linux-gnueabihf/libSegFault.so b6f0b000-b6f0c000 r--p 00001000 b3:02 4246 /lib/arm-linux-gnueabihf/libSegFault.so b6f0c000-b6f0d000 rw-p 00002000 b3:02 4246 /lib/arm-linux-gnueabihf/libSegFault.so b6f0d000-b6f2a000 r-xp 00000000 b3:02 4248 /lib/arm-linux-gnueabihf/ld-2.13.so b6f2e000-b6f32000 rw-p 00000000 00:00 0 b6f32000-b6f33000 r--p 0001d000 b3:02 4248 /lib/arm-linux-gnueabihf/ld-2.13.so b6f33000-b6f34000 rw-p 0001e000 b3:02 4248 /lib/arm-linux-gnueabihf/ld-2.13.so bebd3000-bebf4000 rw-p 00000000 00:00 0 bee7f000-bee80000 r-xp 00000000 00:00 0 [sigpage] ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors] Segmentation fault </code></pre> <p>Removing <code>/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so</code> from <code>/etc/ld.so.preload</code> gives me the same output, except with no lines containing <code>libcofi_rpi.so</code>.</p> <p>Trying to build a statically linked binary with <code>-tags netgo -a -ldflags "-linkmode external -extldflags -static"</code> gives me an "<code>Illegal instruction</code>" instead of the "<code>Segmentation fault</code>".</p> <p>Trying to build the binary on the Pi itself works, however, I want to cross-compile this. And cross compilation works indeed, but only on the ODROID-C1/Arch, not on the Raspberry Pi/Raspbian.</p> <p>The exact build steps I use can be reproduced using Docker:</p> <pre><code>$ docker run -it golang:1.4.1-cross bash </code></pre> <p>Inside docker, I run:</p> <pre class="lang-sh prettyprint-override"><code>echo "deb http://emdebian.org/tools/debian/ jessie main" &gt;/etc/apt/sources.list.d/crosstools.list curl -s http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - dpkg --add-architecture armhf apt-get update apt-get install -y crossbuild-essential-armhf libbluetooth-dev:armhf export CC=arm-linux-gnueabihf-gcc export CGO_ENABLED=1 export GOARCH=arm export GOARM=6 go build -o test test.go </code></pre> <p>This gives me an executable named "test" that, as noted above, will not run on the Pi.</p> <p>Here's some info about my test devices:</p> <h3>Raspberry Pi B+:</h3> <pre><code>$ uname -a Linux raspberrypi 3.18.5+ #744 PREEMPT Fri Jan 30 18:19:07 GMT 2015 armv6l GNU/Linux $ cat /proc/cpuinfo processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 2.00 Features : half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2708 Revision : 0010 Serial : 000000002a69d702 $ ldd test /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f01000) libbluetooth.so.3 =&gt; /usr/lib/arm-linux-gnueabihf/libbluetooth.so.3 (0xb6ed4000) libpthread.so.0 =&gt; /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6eb5000) libc.so.6 =&gt; /lib/arm-linux-gnueabihf/libc.so.6 (0xb6d84000) /lib/ld-linux-armhf.so.3 (0xb6f0e000) </code></pre> <p><strong>Installed Bluetooth libraries:</strong></p> <pre><code>$ dpkg -s libbluetooth3 Package: libbluetooth3 Status: install ok installed Priority: optional Section: libs Installed-Size: 172 Maintainer: Debian Bluetooth Maintainers &lt;pkg-bluetooth-maintainers@lists.alioth.debian.org&gt; Architecture: armhf Multi-Arch: same Source: bluez Version: 4.99-2 Replaces: libsdp2 (&lt;= 1.5-2) Depends: libc6 (&gt;= 2.13-28) Pre-Depends: multiarch-support Conflicts: libsdp2 (&lt;= 1.5-2) Description: Library to use the BlueZ Linux Bluetooth stack BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source project distributed under GNU General Public License (GPL). Homepage: http://www.bluez.org </code></pre> <h3>ODROID-C1:</h3> <pre><code>$ uname -a Linux alarm 3.10.66-1-ARCH #1 SMP PREEMPT Wed Jan 28 18:12:35 MST 2015 armv7l GNU/Linux $ cat /proc/cpuinfo Processor : ARMv7 Processor rev 1 (v7l) processor : 0 BogoMIPS : 3.27 processor : 1 BogoMIPS : 3.27 processor : 2 BogoMIPS : 3.27 processor : 3 BogoMIPS : 3.27 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc05 CPU revision : 1 Hardware : ODROIDC Revision : 000a Serial : 1b00000000000000 $ ldd test libbluetooth.so.3 =&gt; /usr/lib/libbluetooth.so.3 (0xb6eaf000) libpthread.so.0 =&gt; /usr/lib/libpthread.so.0 (0xb6e87000) libc.so.6 =&gt; /usr/lib/libc.so.6 (0xb6d48000) /lib/ld-linux-armhf.so.3 (0xb6ed1000) </code></pre> <p><strong>Installed Bluetooth libraries &amp; development headers files:</strong></p> <pre><code>$ pacman -Qe bluez bluez 5.27-1 </code></pre> <h3>Docker build environment</h3> <pre><code>$ uname -a Linux 094aa2ed34a5 3.18.5-gentoo-tp #1 SMP Fri Feb 6 20:14:55 CET 2015 x86_64 GNU/Linux </code></pre> <p><strong>Installed Bluetooth development headers:</strong></p> <pre><code>$ dpkg -s libbluetooth-dev:armhf Package: libbluetooth-dev Status: install ok installed Priority: extra Section: libdevel Installed-Size: 429 Maintainer: Debian Bluetooth Maintainers &lt;pkg-bluetooth-maintainers@lists.alioth.debian.org&gt; Architecture: armhf Source: bluez (5.23-2) Version: 5.23-2+b1 Replaces: libsdp2-dev (&lt;= 1.5.2) Provides: libbluetooth3-dev Depends: libbluetooth3 (= 5.23-2+b1), libc6-dev | libc-dev Suggests: pkg-config Conflicts: bluez-pan, libbluetooth-dev, libsdp2-dev (&lt;= 1.5.2) Description: Development files for using the BlueZ Linux Bluetooth library BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source project distributed under GNU General Public License (GPL). Homepage: http://www.bluez.org </code></pre> <hr> <p>Installing the exact same version of <code>libbluetooth-dev</code> in the Docker container as the one that is available on the Pi makes no difference.</p> <hr> <p>Copying over the newer <code>libbluetooth.so</code> from Jessie to Wheezie gives me this error:</p> <pre><code>./test: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.15' not found (required by /home/pi/libbluetooth.so.3.17.11) </code></pre> <hr> <h3>UPDATE:</h3> <p>Tried with Arch on the Pi, the cross compiled binary also segfaults, giving the same message ("<code>Illegal instruction (core dumped)</code>") with <code>GOARM=5</code>, <code>6</code> or <code>7</code>.</p> <p>So far I haven't found a way to cross-compile CGO code for the Pi, linked against <code>libbluetooth</code>.</p> <p>Will try with the Raspberry Pi 2 tomorrow.</p> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

立即提问
相关内容推荐