Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Cx-Freeze under Ubuntu

For the entire day I have been attempting to compile cx-Freeze under Ubuntu 14.04 and had no luck. So I gave up and decided to ask experts here.

What I have

  1. Ubuntu 14.04
  2. Python 3.4
  3. python-dev, python3-dev, python3.4-dev installed (I know this common issue)
  4. Sources of cx-Freeze 4.3.3

I tried two ways:

  1. install from the sources
  2. install by pip

Install from the sources

sudo python3 setup.py install

What I got

a lot of

MyPath/cx_Freeze-4.3.3/source/bases/Console.c:24: undefined reference to `PyErr_Print'
MyPath/cx_Freeze-4.3.3/source/bases/Console.c:24: undefined reference to `Py_FatalError'

and then

collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1

Install by pip

sudo pip3 install cx-Freeze

What I got

collect2: error: ld returned 1 exit status

error: command 'i686-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cx-Freeze/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c954v7x6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cx-Freeze
Storing debug log for failure in /home/grimel/.pip/pip.log

and in pip.log

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python3/dist-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cx-Freeze/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c954v7x6-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cx-Freeze

So, I expect you to help me with this issue and gonna be very thankful:)

like image 701
GriMel Avatar asked Aug 03 '14 18:08

GriMel


People also ask

What is CX freeze?

cx_Freeze is a set of scripts and modules for freezing Python scripts into executables, in much the same way that py2exe and py2app do. Unlike these two tools, cx_Freeze is cross-platform and should work on any platform that Python itself works on. It supports Python 2.7 or higher (including Python 3).


1 Answers

In setup.py string

if not vars.get("Py_ENABLE_SHARED", 0):

replace by

if True:

Thanks to Thomas K

like image 62
GriMel Avatar answered Oct 04 '22 16:10

GriMel