Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ jobs:
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
GCC_LATEST=$(apt-cache search ^gcc-[0-9]+$ | sort -V | tail -1 | awk '{print $1}')
GCC_LATEST=$(apt-cache search \^gcc-\[0-9\]+\$ | sort -V | tail -1 | awk '{print $1}')
GXX_LATEST=$(echo "$GCC_LATEST" | sed 's/gcc/g++/')
sudo apt-get install -y "$GCC_LATEST" "$GXX_LATEST"
sudo ln -sf "/usr/bin/$GCC_LATEST" /usr/local/bin/cc
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20260707.3
1.20260708.0
9 changes: 5 additions & 4 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@ if(LIBOPENCOR_PYTHON_BINDINGS)

set(PYTHON_BINDINGS_DIR ${CMAKE_BINARY_DIR}/tests/bindings/python CACHE INTERNAL "Python bindings directory.")

# Check whether we need to provide a glibc compatibility wrapper for __isoc23_strtoll().
# Note: indeed, it is used by our prebuilt LLVM+Clang and libssh2 libraries which are compiled using glibc 2.38+
# Check whether we need to provide a glibc compatibility wrapper for __isoc23_strtol() and __isoc23_strtoll().
# Note: indeed, they are used by our prebuilt LLVM+Clang and libssh2 libraries which are compiled using glibc 2.38+
# (Ubuntu 24.04 LTS on GitHub Actions), but there are currently no versions of manylinux that uses glibc
# 2.38+, so we need to provide a compatibility wrapper for this function in order to be able to build our
# 2.38+, so we need to provide a compatibility wrapper for these functions in order to be able to build our
# Python wheels.

include(CheckSymbolExists)

check_symbol_exists(__isoc23_strtol stdlib.h LIBOPENCOR_GLIBC_HAS_ISOC23_STRTOL)
check_symbol_exists(__isoc23_strtoll stdlib.h LIBOPENCOR_GLIBC_HAS_ISOC23_STRTOLL)
Comment thread
agarny marked this conversation as resolved.

set(ACTUAL_PYTHON_SOURCE_FILES ${PYTHON_SOURCE_FILES})

if(LIBOPENCOR_GLIBC_HAS_ISOC23_STRTOLL)
if(LIBOPENCOR_GLIBC_HAS_ISOC23_STRTOL AND LIBOPENCOR_GLIBC_HAS_ISOC23_STRTOLL)
list(REMOVE_ITEM ACTUAL_PYTHON_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/glibc.cpp)
endif()

Expand Down
23 changes: 17 additions & 6 deletions src/bindings/python/glibc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@ limitations under the License.
*/

#if defined(__linux__) && defined(__GNUC__)
// On glibc 2.38+, strtoll() is defined as a macro that redirects to __isoc23_strtoll().

# include <cstdlib>

# undef strtoll
// On glibc 2.38+, strtol() and strtoll() are redirected to __isoc23_strtol() and __isoc23_strtoll(), respectively,
// either via preprocessor macro (Intel) or via __asm__("__isoc23_strtol") on the declaration (ARM). The latter is a
// compiler-level redirect that cannot be undone with #undef, so calling strtol() inside our __isoc23_strtol() wrapper
// would cause infinite recursion on ARM. To bypass this, we forward-declare strtol()/strtoll() ourselves without the
// compiler-level redirect, giving us a direct reference to glibc's implementation unaffected by any asm redirect on the
// standard names.

extern "C" {
long strtol(const char *pString, char **pEndPtr, int pBase);
long long strtoll(const char *pString, char **pEndPtr, int pBase);

__attribute__((weak)) long __isoc23_strtol(const char *pString, char **pEndPtr, int pBase)
{
return strtol(pString, pEndPtr, pBase);
}

extern "C" long long __isoc23_strtoll(const char *pString, char **pEndPtr, int pBase)
__attribute__((weak)) long long __isoc23_strtoll(const char *pString, char **pEndPtr, int pBase)
{
return strtoll(pString, pEndPtr, pBase);
}
}

#endif
Loading