From: Baptiste DURAND Date: Tue, 28 May 2013 15:30:46 +0000 (+0200) Subject: Fix compatibility for x64 arch X-Git-Tag: accepted/tizen/20130529.154805~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F3705%2F1;p=platform%2Fcore%2Fconnectivity%2Fnfc-manager.git Fix compatibility for x64 arch => Fix hardcoded library path in code and pc file => Fix build Error : relocation R_X86_64_32 against by add fPIC opt. --- diff --git a/src/clientlib/nfc.pc.in b/src/clientlib/nfc.pc.in index 8731985..b455a2e 100755 --- a/src/clientlib/nfc.pc.in +++ b/src/clientlib/nfc.pc.in @@ -1,6 +1,6 @@ prefix=/usr exec_prefix=${prefix}/bin -libdir=${prefix}/lib +libdir=@LIB_INSTALL_DIR@ includedir=${prefix}/include Name: nfc @@ -8,4 +8,4 @@ Description: NFC Version: $version Requires: Libs: -lnfc -Cflags: -I/usr/include/nfc \ No newline at end of file +Cflags: -I/usr/include/nfc diff --git a/src/commonlib/nfc-common-lib.pc.in b/src/commonlib/nfc-common-lib.pc.in index 1df1eee..7ebdd55 100755 --- a/src/commonlib/nfc-common-lib.pc.in +++ b/src/commonlib/nfc-common-lib.pc.in @@ -2,12 +2,12 @@ prefix=/usr exec_prefix=/usr/bin -libdir=/usr/lib +libdir=@LIB_INSTALL_DIR@ includedir=/usr/include/nfc-common-lib Name: nfc-common-lib Description: NFC Common Library Version: 1.0 Requires: -Libs: -L/usr/lib -lnfc-common-lib +Libs: -L@LIB_INSTALL_DIR@ -lnfc-common-lib Cflags: -I/usr/include/nfc-common-lib diff --git a/src/manager/CMakeLists.txt b/src/manager/CMakeLists.txt index b1390b1..be1d217 100644 --- a/src/manager/CMakeLists.txt +++ b/src/manager/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../commonlib/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ MANAGER_SRCS) - +ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"") IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") @@ -24,7 +24,7 @@ MESSAGE("CHECK MODULE in MANAGER ${manager_pkges_LDFLAGS}") # this for NFC flag -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden") SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic") diff --git a/src/manager/net_nfc_controller.c b/src/manager/net_nfc_controller.c index 6c340db..39f1b5c 100755 --- a/src/manager/net_nfc_controller.c +++ b/src/manager/net_nfc_controller.c @@ -27,7 +27,7 @@ #include "net_nfc_server_ipc_private.h" #include "net_nfc_server_dispatcher_private.h" -#define NET_NFC_OEM_LIBRARY_PATH "/usr/lib/libnfc-plugin.so" +#define NET_NFC_OEM_LIBRARY_PATH LIBPATH "/libnfc-plugin.so" static net_nfc_oem_interface_s g_interface; @@ -72,24 +72,24 @@ void *net_nfc_controller_onload() if ((!(strncmp(token_cpuinfo[1], "SLP_PQ", 6)) && (revision >= 7))) //|| !(strncmp(token_cpuinfo[1] , "REDWOOD" , 7))) { DEBUG_SERVER_MSG("It's SLP_PQ && Revision 7!! || REDWOOD revC."); - library_path = "/usr/lib/libnfc-plugin-65nxp.so"; + library_path = LIBPATH "/libnfc-plugin-65nxp.so"; } else if (!(strncmp(token_cpuinfo[1], "REDWOOD", 7))) { DEBUG_SERVER_MSG("It's REDWOOD revC."); - library_path = "/usr/lib/libnfc-plugin-lsi.so"; + library_path = LIBPATH "/libnfc-plugin-lsi.so"; } else { DEBUG_SERVER_MSG("It's NOT!!!! SLP_PQ && Revision 7!!"); - library_path = "/usr/lib/libnfc-plugin.so"; + library_path = LIBPATH "/libnfc-plugin.so"; } } else { DEBUG_SERVER_MSG("It doesn't have Hardware info!!"); - library_path = "/usr/lib/libnfc-plugin.so"; + library_path = LIBPATH "/libnfc-plugin.so"; } if ((handle = dlopen(library_path/*NET_NFC_OEM_LIBRARY_PATH*/, RTLD_LAZY)) != NULL) diff --git a/test_clinet_app/ndef-tool/CMakeLists.txt b/test_clinet_app/ndef-tool/CMakeLists.txt index 7396407..95591ab 100644 --- a/test_clinet_app/ndef-tool/CMakeLists.txt +++ b/test_clinet_app/ndef-tool/CMakeLists.txt @@ -22,7 +22,7 @@ ENDFOREACH(flag) # this for NFC flag -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden") SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")