Add wrapper for memcpy for linux x86_64 build so the library can be build on a new linux machine without enforcing a dependency on GLIBC 2.14

This commit is contained in:
Klaus Reimer 2013-04-16 22:13:19 +02:00
parent 6748760ef6
commit 3e00d5b498
6 changed files with 19 additions and 2 deletions

View File

@ -75,5 +75,5 @@ build()
chmod -x "$DISTDIR/"*
# Cleanup
# rm -rf "$TMPDIR"
rm -rf "$TMPDIR"
}

View File

@ -9,8 +9,9 @@ set -e
OS="linux"
ARCH="x86_64"
HOST="$ARCH-$OS-gnu"
CFLAGS="-m64"
CFLAGS="-m64 -Wl,--wrap=memcpy"
LIBUSB_CONFIG="--disable-shared"
USB4JAVA_LIBS="-lrt"
USB4JAVA_CFLAGS="-DWRAP_MEMCPY"
build

View File

@ -4,6 +4,7 @@ libusb4java_la_LIBADD = $(LIBUSB_LIBS)
libusb4java_la_LDFLAGS = -version-info 1:0:0 -no-undefined
EXTRA_DIST = *.h
libusb4java_la_SOURCES = \
wrappers.c \
usb4java.c \
LibUsb.c \
Version.c \

15
src/main/c/src/wrappers.c Normal file
View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2013 Klaus Reimer (k@ailis.de)
* See COPYING file for copying conditions
*/
#include <string.h>
// Enforce usage of older memcpy to be compatible with older libc versions
#if WRAP_MEMCPY
asm (".symver memcpy, memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
#endif