ACE 7.1.2 / TAO 3.1.2 (please specify your exact version)
Host machine and operating system
Linux Debian 10 64-bit
Target machine and operating system (if different from host)
Linux / x86 (32-bit) - desired target
Compiler name and version (including patch level)
clang 13.0.1-6~deb10u4
The $ACE_ROOT/ace/config.h file
config-linux.h
The $ACE_ROOT/include/makeinclude/platform_macros.GNU file
debug=1
optimize=1
fast=1
buildbits=32
shared_libs=0
static_libs=1
include $(ACE_ROOT)/include/makeinclude/platform_linux_clang.GNU
platform_linux_clang.GNU (I use a link to this file)
Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features
Not applicable - this is a build configuration issue
AREA/CLASS/EXAMPLE AFFECTED:
Build system / Makefile configuration - platform_linux_clang.GNU
The problem effects:
Compilation - ACE/TAO libraries build successfully but produce 64-bit binaries instead of requested 32-bit when buildbits=32 is specified
Synopsis
platform_linux_clang.GNU lacks architecture flag handling for buildbits variable, causing builds to ignore buildbits=32 setting and always produce 64-bit libraries when using clang
Description
When attempting to build ACE/TAO libraries for 32-bit architecture using clang on a 64-bit host system by setting export buildbits=32, the build completes without errors. However, the resulting libraries are compiled as 64-bit binaries, not 32-bit as requested.
The issue is that platform_linux_clang.GNU does not currently handle the buildbits variable at all. Unlike platform_linux.GNU (which is used for gcc) that contains appropriate architecture flags based on buildbits, the clang configuration file lacks this functionality.
This leads to a silent failure - the build appears successful, but the output is incorrect for the intended target architecture.
Repeat by
Configure ACE/TAO build for 32-bit:
text
export buildbits=32
Use platform_linux_clang.GNU (link or copy)
Run make
After successful build, check the resulting binaries:
text
file $ACE_ROOT/lib/libACE.so
Output shows 64-bit ELF instead of expected 32-bit
Sample fix/ workaround
Add the following architecture flags handling before the line "OCFLAGS += -O3" in $ACE_ROOT/include/makeinclude/platform_linux_clang.GNU:
makefile
Handle 32-bit and 64-bit builds
ifeq ($(buildbits),32)
FLAGS_C_CC += -m32
LDFLAGS += -m32
endif
ifeq ($(buildbits),64)
FLAGS_C_CC += -m64
LDFLAGS += -m64
endif
This change ensures that when buildbits=32 is set, the proper -m32 flag is added to both compiler flags (FLAGS_C_CC) and linker flags (LDFLAGS), allowing successful 32-bit compilation with clang. Without these flags, clang defaults to 64-bit builds regardless of the buildbits setting.
ACE 7.1.2 / TAO 3.1.2 (please specify your exact version)
Host machine and operating system
Linux Debian 10 64-bit
Target machine and operating system (if different from host)
Linux / x86 (32-bit) - desired target
Compiler name and version (including patch level)
clang 13.0.1-6~deb10u4
The $ACE_ROOT/ace/config.h file
config-linux.h
The $ACE_ROOT/include/makeinclude/platform_macros.GNU file
debug=1
optimize=1
fast=1
buildbits=32
shared_libs=0
static_libs=1
include $(ACE_ROOT)/include/makeinclude/platform_linux_clang.GNU
platform_linux_clang.GNU (I use a link to this file)
Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features
Not applicable - this is a build configuration issue
AREA/CLASS/EXAMPLE AFFECTED:
Build system / Makefile configuration - platform_linux_clang.GNU
The problem effects:
Compilation - ACE/TAO libraries build successfully but produce 64-bit binaries instead of requested 32-bit when buildbits=32 is specified
Synopsis
platform_linux_clang.GNU lacks architecture flag handling for buildbits variable, causing builds to ignore buildbits=32 setting and always produce 64-bit libraries when using clang
Description
When attempting to build ACE/TAO libraries for 32-bit architecture using clang on a 64-bit host system by setting export buildbits=32, the build completes without errors. However, the resulting libraries are compiled as 64-bit binaries, not 32-bit as requested.
The issue is that platform_linux_clang.GNU does not currently handle the buildbits variable at all. Unlike platform_linux.GNU (which is used for gcc) that contains appropriate architecture flags based on buildbits, the clang configuration file lacks this functionality.
This leads to a silent failure - the build appears successful, but the output is incorrect for the intended target architecture.
Repeat by
Sample fix/ workaround
Add the following architecture flags handling before the line "OCFLAGS += -O3" in $ACE_ROOT/include/makeinclude/platform_linux_clang.GNU:
makefile
Handle 32-bit and 64-bit builds
ifeq ($(buildbits),32)
FLAGS_C_CC += -m32
LDFLAGS += -m32
endif
ifeq ($(buildbits),64)
FLAGS_C_CC += -m64
LDFLAGS += -m64
endif
This change ensures that when buildbits=32 is set, the proper -m32 flag is added to both compiler flags (FLAGS_C_CC) and linker flags (LDFLAGS), allowing successful 32-bit compilation with clang. Without these flags, clang defaults to 64-bit builds regardless of the buildbits setting.