How to generate C/C++ Shared Library for Linux 32-bit target from Linux 64-bit Host?
Show older comments
Hi,
I am working in a Matlab design and I have intend to use the Matlab Coder for Linux 32 bits target. However, the Matlab Coder provide support only to generate shared library for Linux 64 bits target. Then I made a workaround to generate shared library via Matlab Coder with the following changes (adding –m32 flag) in makefile (*.mk), such as:
- CFLAGS = -m32 -c $(ANSI_OPTS) -fPIC -O0 $(CDEBUG)
- CPPFLAGS = -m32 -c $(CPP_ANSI_OPTS) -fPIC -O0 $(CPPDEBUG)
- CPP_LDFLAGS = -m32 -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)" $(CPPLDDEBUG)
- CPP_SHAREDLIB_LDFLAGS = -m32 -shared -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)" -Wl,--no-undefined $(CPPLDDEBUG)
I am wondering, if I can change the makefile in order to cross-compile for Linux 32 bits target and why the Matlab does not provide by default this setting? And, what can I lose (performance, possible problems, etc.) with it workaround?
Below it follows my environment settings:
- Host: Linux 64 bits (Debian 8.3), kernel 3.16.0
- Matlab: 9.0.0.341360 (R2016A)
- Matlab Coder: Version 3.1 (R2016a)
- Target: Linux 32 bits, kernel 2.6.32
Thank in advance,
Bruno
Answers (1)
Raghu Boggavarapu
on 26 Nov 2021
0 votes
Categories
Find more on MATLAB Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!