Coder Social home page Coder Social logo

Not compiling on MacOS about cmf HOT 5 CLOSED

cojacoo avatar cojacoo commented on June 12, 2024
Not compiling on MacOS

from cmf.

Comments (5)

philippkraft avatar philippkraft commented on June 12, 2024

The problem is that I do not have access to any Mac - however it used to work some time ago wit clang. If you are free to choose your Python version, let us forget about Python 2.

Error messages for pip install cmf?

Can you post them here in the issues

Building from source

Should work like this:

git clone https://github.com/philippkraft/cmf
cd cmf
python3 setup.py install
cd demo
python3 tracer1d.py

Can you post me (and other users) errors?

Compiler configuration

Includes:

cmf/setup.py

Lines 202 to 204 in f5bf6a4

include_dirs = [os.path.join(*'cmf/cmf_core_src/math/integrators/sundials_cvode/include'.split('/'))]
# Include numpy
include_dirs += [get_numpy_include()]

POSIX specific settings (for Linux & Mac)

cmf/setup.py

Lines 227 to 238 in f5bf6a4

compile_args = ['-Wno-comment', '-Wno-reorder', '-Wno-deprecated', '-Wno-unused', '-Wno-sign-compare', '-ggdb',
'-std=c++11']
if sys.platform == 'darwin':
compile_args += ["-stdlib=libc++"]
link_args = ['-ggdb']
libraries = []
# Disable OpenMP on Mac see https://github.com/alejandrobll/py-sphviewer/issues/3
if openmp and not sys.platform == 'darwin':
compile_args.append('-fopenmp')
link_args.append("-fopenmp")
libraries.append('gomp')

Note the Mac specific setting here:

cmf/setup.py

Lines 229 to 230 in f5bf6a4

if sys.platform == 'darwin':
compile_args += ["-stdlib=libc++"]

Is this the problem? This might be specific for CLang (I don't know, it was a lot experimenting last time with a Mac).

All other flags are coming from the configuration of the compiler when Python was compiled. You might have better luck, if you do not use Mac OS' system Python but an extra version.

from cmf.

cojacoo avatar cojacoo commented on June 12, 2024

Thanks for your quick reply. Here is the error from calling pip install cmf (or calling python setup.py which results in the same):

python setup.py install
cmf 1.4.1
running install
running bdist_egg
running egg_info
writing cmf.egg-info/PKG-INFO
writing dependency_links to cmf.egg-info/dependency_links.txt
writing top-level names to cmf.egg-info/top_level.txt
reading manifest file 'cmf.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.dox' under directory 'cmf'
warning: no files found matching '*.png' under directory 'cmf'
warning: no files found matching '*.txt' under directory 'cmf'
writing manifest file 'cmf.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
running install_lib
running build_py
copying cmf/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/cmf
running build_ext
building 'cmf._cmf_core' extension
...

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/cojack/miniconda3/include -arch x86_64 -I/Users/cojack/miniconda3/include -arch x86_64 -Icmf/cmf_core_src/math/integrators/sundials_cvode/include -I/Users/cojack/miniconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/cojack/miniconda3/include/python3.6m -c cmf/cmf_core_src/math/root_finding.cpp -o build/temp.macosx-10.7-x86_64-3.6/cmf/cmf_core_src/math/root_finding.o -Wno-comment -Wno-reorder -Wno-deprecated -Wno-unused -Wno-sign-compare -ggdb -std=c++11 -stdlib=libc++
In file included from cmf/cmf_core_src/math/root_finding.cpp:2:
cmf/cmf_core_src/math/root_finding.h:45:28: error: implicit instantiation of
      undefined template 'std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >'
                                sign_error(std::string msg) : std::runti...
                                                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note:
      template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
In file included from cmf/cmf_core_src/math/root_finding.cpp:2:
cmf/cmf_core_src/math/root_finding.h:49:34: error: implicit instantiation of
      undefined template 'std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >'
                                not_finite_error(std::string msg) : std:...
                                                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note:
      template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
In file included from cmf/cmf_core_src/math/root_finding.cpp:2:
cmf/cmf_core_src/math/root_finding.h:53:33: error: implicit instantiation of
      undefined template 'std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >'
                                iteration_error(std::string msg) : std::...
                                                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:193:32: note:
      template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
3 errors generated.
error: command 'gcc' failed with exit status 1

from cmf.

cojacoo avatar cojacoo commented on June 12, 2024

I am not quite convinced if it has anything to do with the python version. I am using miniconda py3.6.
Moreover, I do not use clang (since I used to have a series of issues with this). To me the output points to the missing definition of "basic_string" in the Mac c++ library.? I hoped to change this by forcing the gcc compiler. However, the library remains pointed to the Xcode one.

from cmf.

philippkraft avatar philippkraft commented on June 12, 2024

Might be a missing include (not sure), which results in an error only in xcode library. Can you try to add to root_finding.h into line 39:

#include <string>

If it works, I will update cmf fast. root_finding.h is younger than my last try to compile cmf on a Mac.

from cmf.

cojacoo avatar cojacoo commented on June 12, 2024

Perfect! Quite a bunch of warnings are coming up but it compiles.
Thanks a lot for your quick help.

from cmf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.