Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools/freeze "make" gets missing file error with unix shared builds #67594

Open
ned-deily opened this issue Feb 7, 2015 · 1 comment
Open
Labels
build The build process and cross-build

Comments

@ned-deily
Copy link
Member

BPO 23405
Nosy @malemburg, @loewis, @ned-deily, @meadori

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2015-02-07.10:48:02.356>
labels = []
title = 'Tools/freeze "make" gets missing file error with unix shared builds'
updated_at = <Date 2015-02-07.10:48:02.356>
user = 'https://github.com/ned-deily'

bugs.python.org fields:

activity = <Date 2015-02-07.10:48:02.356>
actor = 'ned.deily'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Demos and Tools']
creation = <Date 2015-02-07.10:48:02.356>
creator = 'ned.deily'
dependencies = []
files = []
hgrepos = []
issue_num = 23405
keywords = []
message_count = 1.0
messages = ['235518']
nosy_count = 4.0
nosy_names = ['lemburg', 'loewis', 'ned.deily', 'meador.inge']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue23405'
versions = ['Python 3.4', 'Python 3.5']

@ned-deily
Copy link
Member Author

While investigating another freeze-related issue, I found that Tools/freeze seems to not work when used with an installed shared unix build. The symptom is that the linkage step in the freeze-produced Makefile fails with:

gcc -pthread -Xlinker -export-dynamic config.o frozen.o M___future__.o [...] M_zipfile.o /py/3x/unix/root/lib/python3.4/config-3.4dm/libpython3.4dm.so -lpthread -ldl -lutil -lm -o hello
gcc: error: /py/3x/unix/root/f/../lib/python3.4/config-3.4dm/libpython3.4dm.so: No such file or directory
Makefile:505: recipe for target 'hello' failed
make: *** [hello] Error 1

The problem is that the freeze linkage step is looking for the python library with a shared library extension (in this case, '.so') in the config-3.xmm directory but the library is installed as a static archive ('.a') there:

./lib/python3.4/config-3.4dm/libpython3.4dm.a

I'm unfamiliar with freeze and its history but it looks like the problem was introduced by the changes for bpo-11824, in particular this:

  • libs = [os.path.join(binlib, 'libpython$(VERSION).a')]
    + libs = [os.path.join(binlib, '$(LDLIBRARY)')]

The Python Makefile target "libainstall" installs the Python library in the config* dir:
@if test -d $(LIBRARY); then :; else \
if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
if test "$(SHLIB_SUFFIX)" = .dll; then \
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
else \
$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
$(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
fi; \
else \
echo Skip install of $(LIBRARY) - use make frameworkinstall; \
fi; \
fi

So, if I understand the cases correctly, for non-".dll" cases, the library is installed in the config* directory as file name $LIBRARY. But the changed code in the freeze-generated Makefile looks for the library as $LDLIBRARY. For static Python builds, $LIBRARY and $LDLIBRARY are (always?) the same, but for shared builds, they are (usually) not, for example:

    LDLIBRARY = "libpython3.4dm.so"
    LIBRARY = "libpython3.4dm.a"

I'm not sure what the complete solution should be but clearly what is there now is not right for shared unix builds.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the build The build process and cross-build label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

2 participants