Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to run 32-bit executable on Ubuntu 16.04 on Pipelines Edited

Hello,

I'm having an issue with running a 32-bit executable built with GCC inside a Bitbucket pipeline using the atlassian/default-image:2 image:

 

+ file /usr/local/bin/pawncc/usr/local/bin/pawncc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=1df4edb3e7046c89aaac29df60750a897c3e0540, not stripped
+ ldd /usr/local/bin/pawncc	not a dynamic executable

LDD says that it's "not a dynamic executable".

Do I need to install some extra packages to run 32-bit programs? I currently have the following:

+ apt-get install -y libc6:i386 linux-libc-dev:i386 cmake gcc-multilib gcc-4.8 gcc-4.8-multilib g++-4.8 g++-4.8-multilib cmake snapd

 

Update:

Sample bitbucket-pipelines.yml that reproduces the issue:

image: atlassian/default-image:2

pipelines:
default:
- step:
name: Build
script:
- uname -a
- cat /etc/lsb-release
- dpkg --add-architecture i386
- apt-get update -qq
- apt-get install -y binfmt-support file wget libc6-i386 linux-libc-dev:i386 gcc gcc-multilib
- echo 'int main() { printf("Hello, world!"); }' >> test.c
- gcc -m32 test.c -o test
- ./test

Output:

bash: ./test: cannot execute binary file: Exec format error

1 answer

0 votes

If ldd is reporting it's not a valid executable, then it's been built incorrectly for the current architecture, or you are missing supporting libraries in the running environment.

While this running inside a bitbucket pipeline, it's not really a bitbucket question - there's something missing from the environment or the compile

The executable is built correctly - I'm using the same script on Travis CI and it's working

Ok, that's one thing fixed or ruled out.  The next question has to be what is the difference between your Travis environment and the Bitbucket pipeline environment?

No idea... I even ran the same Docker image as Pipelines uses on my computer with the same set of commands, and it worked for me there

I've just tried using a i386 image of ubuntu (i386/ubuntu:xenial) and it failed as well, but this time during build initialization stage:

standard_init_linux.go:211exec user process caused "exec format error"time="2021-05-14T13:04:46Z" level=error msg="init failed" error="standard_init_linux.go:211exec user process caused \"exec format error\"" name=kata-agent pid=1 source=agentpanic--this line should have never been executed, congratulations--goroutine 1 [running, locked to thread]:main.init.0()  /go/src/github.com/kata-containers/agent/agent.go:1489 +0x10f+ umask 000+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="master" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIRCloning into '/opt/atlassian/pipelines/agent/build'... 

No, it's the same answer - the environment you've got is different somehow, the one in your pipeline can't run the executable because it doesn't support that type of executable like the other test environments do.

I suspect that Bitbucket runs some script that modifies the default environment of the container, because the same build scripts run PERFECTLY when I using Docker with the same image (atlassian/default-image). Or maybe Pipelines run docker with some weird options that prevent 32-bit support or something.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

271 views 2 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you