-
Notifications
You must be signed in to change notification settings - Fork 80
Misc fixes for darwin and android compilation on darwin #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,8 +47,13 @@ LOCAL_32_BIT_ONLY := true | |
| LOCAL_SHARED_LIBRARIES := libparameter_host | ||
| LOCAL_STATIC_LIBRARIES := libxmlserializer_host | ||
|
|
||
| # python is only available in 32bits for now, thus arch is forced to 32bits | ||
| PYTHON_INSTALL_PATH := prebuilts/python/$(HOST_OS)-x86/2.7.5/ | ||
| PYTHON_INCLUDES_PATH := $(PYTHON_INSTALL_PATH)/include/python2.7 | ||
| PYTHON_BIN_PATH := $(PYTHON_INSTALL_PATH)/bin | ||
|
|
||
| LOCAL_C_INCLUDES := \ | ||
| prebuilts/python/linux-x86/2.7.5/include/python2.7 \ | ||
| $(PYTHON_INCLUDES_PATH) \ | ||
| $(HOST_OUT_HEADERS)/parameter | ||
|
|
||
| # The 'unused-but-set-variable' warning must be disabled because SWIG generates | ||
|
|
@@ -74,15 +79,29 @@ LOCAL_GENERATED_SOURCES := $(generated-sources-dir)/pfw_wrap.cxx $(generated-sou | |
|
|
||
| LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated-sources-dir) | ||
|
|
||
| # Careful, we need to invoque the android python config not the host's one. | ||
| # BTW, the intenal install directory of python is hardcoded to a dummy value, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. internal
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #124 |
||
| # thus we need to manually add the correct path to libs to the library list. | ||
| ifeq ($(HOST_OS), linux) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no dummy value on darwin, only linux's
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #124 |
||
| LOCAL_LDLIBS += $(shell $(PYTHON_BIN_PATH)/python $(PYTHON_BIN_PATH)/python-config --ldflags) \ | ||
| -L $(PYTHON_INSTALL_PATH)/lib/ | ||
| else | ||
| LOCAL_LDLIBS += $(shell python-config --ldflags) | ||
| endif | ||
|
|
||
| $(generated-sources-dir)/pfw_wrap.h: $(generated-sources-dir)/pfw_wrap.cxx | ||
|
|
||
| # The PyPfw.py file is generated in the directory given by -outdir switch, thus | ||
| # this directory must be put in the python path to be reachable | ||
| $(generated-sources-dir)/pfw_wrap.cxx: HOST_ARCH := $(HOST_ARCH) | ||
| $(generated-sources-dir)/pfw_wrap.cxx: HOST_OS := $(HOST_OS) | ||
| $(generated-sources-dir)/pfw_wrap.cxx: HOST_LIBRARY_PATH := $(HOST_LIBRARY_PATH) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure that this is needed as those variable should be immutable. Nevertheless, fool safe protection is not a bad idea in android build system.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that we can remove this paragraph.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #124
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| $(generated-sources-dir)/pfw_wrap.cxx: $(LOCAL_PATH)/pfw.i | ||
| @echo "Generating Python binding files" | ||
| mkdir -p $(dir $@) # surprisingly, path is not generated by build system | ||
| mkdir -p $(HOST_LIBRARY_PATH) | ||
| prebuilts/misc/linux-x86_64/swig/swig \ | ||
| prebuilts/misc/$(HOST_OS)-$(HOST_ARCH)/swig/swig \ | ||
| -Iprebuilts/misc/common/swig/include/2.0.11/python/ \ | ||
| -Iprebuilts/misc/common/swig/include/2.0.11/ \ | ||
| -Wall -Werror -v -python -c++ -outdir $(HOST_LIBRARY_PATH)/ -o $@ $^ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,7 @@ bool CSocket::read(void* pvData, uint32_t uiSize) | |
|
|
||
| while (uiSize) { | ||
|
|
||
| int32_t iAccessedSize = ::recv(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); | ||
| int32_t iAccessedSize = ::recv(_iSockFd, &pucData[uiOffset], uiSize, 0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess there is no MSG_DEFAULT or similar (could not find anything like that in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, but I wanted to know if there was a standard macro that represented this. |
||
|
|
||
| switch (iAccessedSize) { | ||
| case 0: | ||
|
|
@@ -140,17 +140,19 @@ bool CSocket::write(const void* pvData, uint32_t uiSize) | |
|
|
||
| while (uiSize) { | ||
|
|
||
| int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); | ||
| int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, 0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess you are solving #39 with this pull request.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, as mentionned in the PR message.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [seb] Wrong fix, you can still receive the signal. Maybe do a
const int set = 1;
setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(int));
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #124 |
||
|
|
||
| if (iAccessedSize == -1) { | ||
| if (errno == ECONNRESET) { | ||
| // Peer has disconnected | ||
| _disconnected = true; | ||
| } | ||
| // errno == EINTR => The send system call was interrupted, try again | ||
| if (errno != EINTR) { | ||
| return false; | ||
| if (errno == EINTR) { | ||
| // The send system call was interrupted, try again | ||
| continue; | ||
| } | ||
|
|
||
| // An error occured, forget this socket | ||
| _disconnected = true; | ||
| close(_iSockFd); | ||
| _iSockFd = -1; | ||
| return false; | ||
| } else { | ||
| uiSize -= iAccessedSize; | ||
| uiOffset += iAccessedSize; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invoke
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #124