StarExec
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How do I compile a solver written in Python to a standalone executable with static libraries?

3 posters

Go down

 How do I compile a solver written in Python to a standalone executable with static libraries? Empty How do I compile a solver written in Python to a standalone executable with static libraries?

Post by df Fri Jun 20, 2014 11:48 pm

I have a solver written in Python. I tried to use freeze.py to compile it into a binary. But I found no way to ask freeze.py to link glibc statically (Python depends heavily on glibc). Freeze generated a huge bunch of C files and a Makefile but I couldn't hack the Makefile successfully to do static linking. If someone could share their experience in this matter, it would be very helpful.

Thanks, D (posting on behalf of a new user)

df

Posts : 17
Join date : 2014-04-30

Back to top Go down

 How do I compile a solver written in Python to a standalone executable with static libraries? Empty Re: How do I compile a solver written in Python to a standalone executable with static libraries?

Post by garvitjuniwal Fri Jun 27, 2014 10:19 pm

To elaborate on the above post.
I am using freeze.py to create standalone executables out of python programs. The freeze utility generates C code out of python code + python runtime and outputs a Makefile project. The makefile I get is here.

To put the binary on starexec, I need to statically link glibc. I tried adding the following flags to the linking command

-static-libstdc++ -static-libgcc -static -o

and it generates the following error:

/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `tan' with pointer equality in `/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.a(s_tan.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
collect2: error: ld returned 1 exit status

I then tried to add the suggested flags -fPIE and -pie to compilation and linking commands. But it results in the same error.

Any suggestions to get rid of this error or to use a completely different toolchain to compile python into standalone executables?

garvitjuniwal

Posts : 3
Join date : 2014-06-20

Back to top Go down

 How do I compile a solver written in Python to a standalone executable with static libraries? Empty Re: How do I compile a solver written in Python to a standalone executable with static libraries?

Post by j.waldmann Sat Jun 28, 2014 8:33 am

> To put the binary on starexec, I need to statically link glibc.

Really?

I assume this is because your binary was built on a system with a different glibc version.

Then another option is: you build your application in a virtual machine that matches starexec.
CentOS 6.3 is a good fit.

- J.

j.waldmann

Posts : 84
Join date : 2014-04-26

Back to top Go down

 How do I compile a solver written in Python to a standalone executable with static libraries? Empty Re: How do I compile a solver written in Python to a standalone executable with static libraries?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum