Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Error compiling R25 framework on MacOS

    Cinema 4D SDK
    r25 macos
    2
    3
    401
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BruceC
      last edited by

      Hi,
      I got the sdk.zip file from C4d (R25.117) install directory on mac. When I compile the example plugin project (plugins/example.nodes) in R25.117 on mac, I got below errors.
      Can you please help take a look?
      Thanks.

      BTW, there is no problem building 2024 nor 2023 sdk versions.
      One more thing, I need to build multiple C4d sdk versions on this mac.

      cd /tmp/R25/frameworks/core.framework/project
         /bin/sh -c /tmp/R25/build/core.framework.build/Release/core.framework.build/Script-A0F4AB3A6F00000000690000.sh
      Loading generator module dumpgenerator from ../../../frameworks/settings/sourceprocessor/generators/dumpgenerator.py...
      Loading generator module phgenerator from ../../../frameworks/settings/sourceprocessor/generators/phgenerator.py...
      Loading generator module summarygenerator from ../../../frameworks/settings/sourceprocessor/generators/summarygenerator.py...
      Loading generator module cppgenerator from ../../../frameworks/settings/sourceprocessor/generators/cppgenerator.py...
      Looking for source files in /tmp/R25/frameworks/core.framework...
      Traceback (most recent call last):
       File "/private/tmp/R25/frameworks/core.framework/project/../../../frameworks/settings/sourceprocessor/sourceprocessor.py", line 2829, in <module>
         if not main():
       File "/private/tmp/R25/frameworks/core.framework/project/../../../frameworks/settings/sourceprocessor/sourceprocessor.py", line 2490, in main
         if not recurse(args, args.directory):
       File "/private/tmp/R25/frameworks/core.framework/project/../../../frameworks/settings/sourceprocessor/sourceprocessor.py", line 2423, in recurse
         if not process(a):
       File "/private/tmp/R25/frameworks/core.framework/project/../../../frameworks/settings/sourceprocessor/sourceprocessor.py", line 2781, in process
         msg, err, exc, sources, oldSources = scanFiles(args, stampTime, previousFiles, generators, scriptDir, summary, results)
       File "/private/tmp/R25/frameworks/core.framework/project/../../../frameworks/settings/sourceprocessor/sourceprocessor.py", line 2128, in scanFiles
         p.start()
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
         self._popen = self._Popen(self)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
         return _default_context.get_context().Process._Popen(process_obj)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
         return Popen(process_obj)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
         super().__init__(process_obj)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
         self._launch(process_obj)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
         reduction.dump(process_obj, fp)
       File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
         ForkingPickler(file, protocol).dump(obj)
      TypeError: cannot pickle 'module' object
      Command PhaseScriptExecution failed with a nonzero exit code
      
      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @BruceC
        last edited by ferdinand

        Hello @BruceC,

        Thank you for reaching out to us. This is likely caused by you using Python 3.9 while the source processor for R25 was shipped with Python 3.7 (on Windows). On macOS we relied on the Python shipped with Xcode (and still do); which is nice for package sizes but can be a bit tricky for users to then use the correct Python version later on.

        Alternatively, you can also go into your frameworks/settings/sourceprocessor/sourceprocessor.py and change the function sharesModules to this:

        def sharesModules():
            # Module sharing does not work for newer versions like 3.9 on macOS.
            return sys.platform != 'win32' and sys.platform != 'darwin'
        

        This will prevent the module objects for the code generators being shared among processes (S26/Python 3.9 behaviour) instead of sharing them (R25/3.7). But I would not recommend monkey patching the source processor in this manner, as it changes quite constantly and you can easily end up in a mess (this case is kind of harmless but I would still avoid doing it).

        When you are in multi-platform building environment this can indeed be a bit tricky with the environment variable for Python. The easiest solution would be probably to write yourself a command script which changes to which Python version /usr/local/bin/python points on a button press.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 1
        • B
          BruceC
          last edited by

          Thank you, @ferdinand. I modified sourceprocessor.py for now, and it works.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post