Compiling Python 3.4 with emscripten on Linux (encountering linkage errors)

I am in the process of building Python 3.4 from source using emscripten.

After successfully installing emscripten and setting up a build folder outside the source tree, I have followed these steps:

  1. Ran configure:

    $ emconfigure ../Python-3.4.3/configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 --build=i686-linux-gnu

  2. Noticed a conflict between LONG_BIT in ../Python-3.4.3/Include/pyport.h and the #define SIZEOF_LONG defined in emscripten headers, so commented out the check in ../Python-3.4.3/Include/pyport.h

  3. Successfully ran configure, then executed emmmake make in my build folder

  4. Verified that the built python file is LLVM bytecode by running file python. Proceeded to link libpython3.4.so with the bytecode using:

$ llvm-link libpython3.4.so python -o python.bc

Encountered the following error message:

ERROR: Linking globals named '_Py_open_cloexec_works': symbol multiply defined!

Despite confirming that the symbol is not multiply defined in the source code:

$ grep -rnw ../Python-3.4.3 -e "_Py_open_cloexec_works" --include=\*.{c,h}
../Python-3.4.3/Python/fileutils.c:33:int _Py_open_cloexec_works = -1;
../Python-3.4.3/Python/fileutils.c:784:    atomic_flag_works = &_Py_open_cloexec_works;
../Python-3.4.3/Modules/posixmodule.c:7702:extern int _Py_open_cloexec_works;
../Python-3.4.3/Modules/posixmodule.c:7725:    int *atomic_flag_works = &_Py_open_cloexec_works;
../Python-3.4.3/Modules/_io/fileio.c:210:extern int _Py_open_cloexec_works;
../Python-3.4.3/Modules/_io/fileio.c:232:    int *atomic_flag_works = &_Py_open_cloexec_works;

Attempting to use nm on libpython3.4.so resulted in an error message:

nm: libpython3.4.so: File format not recognised

Feeling stuck now and seeking assistance to resolve the linkage issues.

[[ Additional Info ]]

  • clang version 3.6.0
  • LLVM version 3.6.0svn

Answer №1

Don't rely on nm, opt for the more robust objdump. Give objdump -t your_file or objdump -T your_file a try.

For instance, use: objdump -t lib.o

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

implement django self,pk post-save success function

It might seem unconventional, but I'm attempting to utilize a primary key (pk) in a success function to generate a href for loading. The pk will be new and generated by the save() method. What I would like to know is how to send the self.pk pack to t ...

Exploring the Basics of Python Dictionaries

def find_larger_elements(dictionary, num): result = [] for key in dictionary: if key > num: result.append(key) return result I am tasked with finding all the elements in the dictionary that are larger than a ...

Finding an element with Python and Selenium by accessing innerHTML

I am currently navigating my way through Selenium and attempting to create my inaugural script using the Python package. My setup includes: Operating System: Windows 10 Python Version: 3.10.5 Selenium Version: 4.3.0 Up until now, I have managed to accom ...

Seal the h5py data file that is currently open

Within our laboratory, data is stored in hdf5 files using the Python package h5py. When starting an experiment, we initiate a new hdf5 file and continuously add arrays of data to it. However, if an experiment fails or is interrupted, the file may not be p ...

Finding a future variable in Python using Pandas based on time intervals in minutes

Apologies for the inadequate title, finding the right words to summarize my issue is challenging I am working with a dataset df1 that has the following index: [2014-01-02 10:00:02.644000, ..., 2014-01-02 15:59:58.630000] Length: 26761, Freq: None, Timezo ...

Choose a particular tier within the MultiIndex

The code snippet below demonstrates how to extract a specific list from multiple levels: idx1 = sys_bal.index idx2 = user_bal.index idx3 = idx1.intersection(idx2) The following output is generated by the above code: MultiIndex(levels=[[3, 29193], [&apos ...

Error: JSON requires string indices to be integers

I need help filtering JSON data from a webhook. Here is the code I am working with: headers = { 'client-id': 'my twitch client id', 'Authorization': 'my twitch oauth key', } params = ( ('query' ...

Issue with the beautiful soup 4 library

I'm feeling puzzled as this code seems to work inconsistently. It utilizes the beautiful soup module and I'm curious why it functions in certain situations but fails at other times. from bs4 import BeautifulSoup import requests import lxml import ...

Press the "Load More" button on Jooble using Selenium in Python

I am currently attempting to perform web scraping on this website and seeking a method to activate the load more button using selenium in Python. I have experimented with the following code snippets: driver.find_element(By.LINK_TEXT, "Load more") ...

How can you design a versatile Logic app in Azure that handles all email functions?

Currently, I am developing an ETL script in Python Azure function to automate the process of sending email notifications regarding job status and progress tracking to various stakeholders. In order to achieve this efficiently, I am exploring the option of ...

If the specified date is not found in the queryset, then insert a default

While working on integrating django with chartjs, I have utilized a class-based view as shown below. class SingleTagChartJSONView(BaseLineOptionsChartView): def get_context_data(self, **kwargs): context = super(BaseLineChartView, self).get_con ...

Looking for a Python library that supports proxy for Twitter Streaming API?

Anyone know of a Python library for the Twitter Streaming API that supports proxies? I like tweepy, but haven't found a way to use an HTTP proxy. Any suggestions? ...

What is preventing me from importing selenium?

Why am I unable to import selenium? Here is how my code appears in Visual Studio Code: https://i.stack.imgur.com/Goqde.png This issue only started after I upgraded to Windows 11, which resulted in the deletion of the C-drive. Does anyone have a solution ...

Differentiating between the components and contents of a webpage during the process of web scraping

import mechanize from bs4 import BeautifulSoup import urllib2 import cookielib cj = cookielib.CookieJar() br = mechanize.Browser() br.set_handle_robots(False) br.set_cookiejar(cj) br.open("*******") br.select_form(nr=0) br.form['ctl00$BodyConten ...

Exporting Python Pandas Data Frame to an HTML file

I'm attempting to save a Python Pandas Data Frame as an HTML page. I also want to ensure that the table can be filtered by the value of any column when saved as an HTML table. Do you have any suggestions on how to accomplish this? Ultimately, I want t ...

Error: The 'PullRequest' object does not contain the 'issue_comments' attribute

I have been utilizing the https://github.com/sigmavirus24/github3.py library for my project. However, I am encountering an issue when trying to fetch issue_comments from PR. for pr in repo.iter_pulls(): for comment in pr.issue_comments(): pri ...

Encountering a FileNotFoundError while attempting to automate responses to a Google form using Selenium and WebDriver

Looking to automate responses on a Google Form using Selenium, following this model: youtu.be/BvU7qfdrqjc (25 sec video); more details can be seen in this video: youtu.be/MUxScr-p-jl. While testing the code, an error cropped up: Code: from selenium impor ...

Utilizing WSGI in conjunction with a Python/Flask application - A guide from HasGeek's Lastuser

Currently, I am in the process of setting up a lastuser OAuth server on my local machine. My plan is to configure Nginx with SSL (on port 443) and utilize the lastuser app as the WSGI server. If you want more details about the HasGeek lastuser project, ch ...

Python code to verify if a specific condition is satisfied within a certain time period

Seeking to determine if certain conditions are met over a period of time. The data is structured as follows: Datetime Valve1 Valve2 01/01/2020 11:00:01 1 0 The condition being evaluated is: (Valve1=1 for 1h) and (Valve-0 for 1h) Utilizing rolling ...

capturing the result of the print statement in a text file

Is there a way to save the content of a text file to a new one in Python while also converting all words to lowercase for word frequency analysis? I tried using 'text.lower()' but it didn't work. Below is the code snippet I used: text = ope ...