Closed flipio closed 6 years ago
Is ctypes able to load a static lib? (In other words, does your patch create a wonking DDS lib for redeal?) I have no access to a mac to test right now.
Hey, So after couple of hours spent trying to make this work i came up with this. First reinstall gcc: brew reinstall gcc --without-multilib Next you have do change couple of stuff, when you clone repo with git clone --recursive git@github.com:anntzer/redeal.git you need to go and change some Makefile in dds/src (since they are not supporting .so libs on mac, it says in their README.md). Go to dds/src/Makefiles/Makefile_Mac_gcc:
Then when calling make from setup.py you will need to do couple of things: when building for mac you will need to execute two make installs,
subprocess.check_call(
["make", "-f", "Makefiles/Makefile_Mac_clang"])
subprocess.check_call(
["make", "-f", "Makefiles/Makefile_Mac_gcc"])
here is make_build class in setup.py:
class make_build(build_py, object):
def run(self):
super(make_build, self).run()
if os.name == "posix":
orig_dir = os.getcwd()
os.chdir(os.path.join(BASE_DIR, "dds", "src"))
if sys.platform.startswith('darwin'):
subprocess.check_call(
["make", "-f", "Makefiles/Makefile_Mac_clang"])
subprocess.check_call(
["make", "-f", "Makefiles/Makefile_Mac_gcc"])
else:
subprocess.check_call(
["make", "-f", "Makefiles/Makefile_linux_shared"])
os.chdir(orig_dir)
shutil.copy(os.path.join(BASE_DIR, "dds", "src", "libdds.so"),
os.path.join(self.build_lib, "redeal", "libdds.so"))
Thats how i got it working in the end..
Hi, Thanks for your investigation. In the mean time I got access to a mac server to try this out; unfortunately this currently fails with
$ python setup.py build
running build
running build_py
g++ -O3 -flto -mtune=generic -Wshadow -Wsign-conversion -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wcomment -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-promo -Wstrict-overflow=1 -Wswitch-default -Wundef -Werror -Wno-unused -Wno-unknown-pragmas -Wno-long-long -Wno-format -c dds.cpp
cc1plus: error: LTO support has not been enabled in this configuration
This is with a hand-built gcc 5.1.0; perhaps this is related to your note about the need to install gcc --without-multilib?
PS: While I would be happy to merge your fixes, perhaps you can make a PR to fix the makefiles directly to dds-bridge/dds?
I find it's so hard to compile successful under Mac OS. For simplicity, can we just copy libdds.so to redeal/redeal , like dds-32.dll or dds-64.dll for windows?
I am still waiting for the fixes to be integrated upstream (unfortuntanely they made a typo while integrating the Makefile, see https://github.com/dds-bridge/dds/issues/42). In any case I have not been able to build the shared library myself on Mac (see above). Do you have working instructions?
After some hours hard working, I have installed the repeal on my MAC OS (10.11.4 EL CAPITAN), here is my steps:
1) What happens if you don't install gcc via homebrew? Does Mac OS provide a C compiler by default nowadays? FWIW there is a Makefile for clang too, may be worth trying it.
I did not manage to build DDS on Mac. I only have access to a machine without admin rights, so no homebrew for me. I did build gcc by hand (this is actually not that hard, though time consuming...) but this was not enough, as mentioned above.
2) I believe the correct way to fix the issue is to create a generic Makefile in the DDS tha checks for uname
and dispatches on the corresponding OS-specific Makefile. This would avoid the need for any dispatch on the calling side. Can you open an issue on the upstream repo (https://github.com/dds-bridge/dds)?
3) You attached a static library (libdds.a), which won't work with ctypes (AFAIK... does it for you?). You'll need a shared library instead.
4) I am actually leaning towards stripping out any compiled code instead, as mingwpy should soon provide a pip-installable C compiler on Windows.
without gcc via home-brew, I guess you can compile dds by the makefile Makefile_Mac_clang, but the result libdds.a can't work correctly. ironically, by Makefile_Mac_gcc , get libdds.so , then rename it to libdds.a and copy to the right place ,it works!
Humm... what do you get when you run import platform; platform.python_compiler()
? I'm guessing that you need to match the compiler used to compile CPython itself, perhaps.
Python 3.5.1 (default, Jan 22 2016, 08:54:32) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import platform platform.python_compiler() 'GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)'
Python 2.7.11 (default, Jan 22 2016, 08:29:18) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import platform platform.python_compiler() 'GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)'
OK, and what do you mean by "the result libdds.a can't work correctly" (from clang)?
I believe the issue is now fixed (I am now patching the Makefiles from setup.py). Closing the issue, but feel free to discuss here if it is still not working or needs clarifications...
There was a issue with installing redeal on mac running OS X Yosemite, its now fixed. Problem was compiling c++ code, .so libraries are not built, only .a.