Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing libpd via Cocoapods #345

Closed
corporate-fun opened this issue Mar 17, 2022 · 11 comments
Closed

Error installing libpd via Cocoapods #345

corporate-fun opened this issue Mar 17, 2022 · 11 comments

Comments

@corporate-fun
Copy link
Contributor

I have included libpd in our Podfile like so:

        pod 'libpd-ios', '~> 0.11'

And upon installing I am seeing this error

Installing libpd-ios (0.11.0)

[!] Error installing libpd-ios
[!] /usr/bin/git -C /var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06 submodule update --init --recursive

Submodule 'jni/opensl_stream' (git://github.com/nettoyeurny/opensl_stream.git) registered for path 'jni/opensl_stream'
Submodule 'pure-data' (git://git.code.sf.net/p/pure-data/pure-data) registered for path 'pure-data'
Cloning into '/private/var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06/jni/opensl_stream'...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
fatal: clone of 'git://github.com/nettoyeurny/opensl_stream.git' into submodule path '/private/var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06/jni/opensl_stream' failed
Failed to clone 'jni/opensl_stream'. Retry scheduled
Cloning into '/private/var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06/pure-data'...
Cloning into '/private/var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06/jni/opensl_stream'...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
fatal: clone of 'git://github.com/nettoyeurny/opensl_stream.git' into submodule path '/private/var/folders/gh/xcjm9cgj4ps4zl75mmr6kztr0000gn/T/d20220317-790-i7fw06/jni/opensl_stream' failed
Failed to clone 'jni/opensl_stream' a second time, aborting
@danomatika
Copy link
Member

danomatika commented Mar 17, 2022

It looks like GitHub is deprecating open git:// links: link 1 and link 2

The fix appears to be to update the submodule links to use https instead. This is done in the latest commit but you will need to change your pod file to take the current git master and not the 0.11 version tag for now, until we release 0.12 soon.

@corporate-fun
Copy link
Contributor Author

corporate-fun commented Mar 24, 2022

thanks @danomatika. could you tell me what that would look like in the Podfile? I'm having trouble finding what url i should be using. I've tried:

pod 'libpd-ios', :git => 'https://github.com/libpd/pd-for-ios.git'

and

pod 'libpd-ios', :git => 'https://github.com/libpd/libpd.git'

and neither are working:

[!] Unable to find a specification for 'libpd-ios'.

@danomatika
Copy link
Member

danomatika commented Mar 24, 2022 via email

@corporate-fun
Copy link
Contributor Author

I found that using this worked to have cocoapods clone properly:

pod 'libpd', :git => 'https://github.com/libpd/libpd', :submodules => true

However, now I'm experiencing a number of duplicate symbol build errors. for example:

duplicate symbol '_libpdreceive_new' in:
    /Users/rickyd/Library/Developer/Xcode/DerivedData/app-ajeklipqnvrtccfhmglxlafpojth/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/libpd.build/Objects-normal/arm64/x_libpdreceive-0aba41783a6bffe5f385d4ba8116ee8e.o
    /Users/rickyd/Library/Developer/Xcode/DerivedData/app-ajeklipqnvrtccfhmglxlafpojth/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/libpd.build/Objects-normal/arm64/x_libpdreceive-a12880a7c6e4a1b37ca7b612c50d0040.o
...

Seems that there are a number of classes that are defined multiple times? I'm thinking maybe it's an issue with the spec file needing to be updated to exclude files that contain the duplicates but can't say for sure.

@danomatika
Copy link
Member

Yes, the x_libpd files in pure-data/src probably need to be excluded.

@corporate-fun
Copy link
Contributor Author

corporate-fun commented Mar 24, 2022

I don't know the rules for making a PR for the project but I forked the repo and found that updating the podspec file to this works:

Pod::Spec.new do |spec|
  spec.name = 'libpd'
  spec.version = '0.12.3'

  spec.license = { :type => 'Standard Improved BSD License', :file => 'License.txt' }

  spec.summary = 'Pure Data embeddable audio synthesis library, useful as a sound engine in mobile phone apps, games, web pages, and art projects'
  spec.homepage = 'https://github.com/libpd/libpd'
  spec.authors = 'Peter Brinkmann', 'Dan Wilcox', 'Rich Eakin', 'Miller Puckette (Pure Data)'

  spec.source = {
    :git => 'https://github.com/libpd/libpd.git',
    :tag => spec.version.to_s,
    :submodules => true
  }

  # include all sources except for extra/pd~/binarymsg.c, it's included directly
  # in pd~.c so it needs to exist but *not* be built
  spec.source_files = 'pure-data/src/**/*.{h,c}',
                      'pure-data/extra/bob~/*.{h,c}',
                      'pure-data/extra/bonk~/*.{h,c}',
                      'pure-data/extra/choice/*.{h,c}',
                      'pure-data/extra/fiddle~/*.{h,c}',
                      'pure-data/extra/loop~/*.{h,c}',
                      'pure-data/extra/lrshift~/*.{h,c}',
                      'pure-data/extra/pd~/pdsched.c',
                      'pure-data/extra/pd~/pd~.c',
                      'pure-data/extra/pique/*.{h,c}',
                      'pure-data/extra/sigmund~/*.{h,c}',
                      'pure-data/extra/stdout/*.{h,c}',
                      'libpd_wrapper/**/*.{h,c}',
                      'objc/**/*.{h,m}'
  spec.preserve_paths = 'pure-data/extra/pd~/binarymsg.c'

  spec.public_header_files = 'objc/**/*.{h}'

  spec.ios.deployment_target = '9.0'
  spec.macos.deployment_target = '10.10'

  spec.requires_arc = true
  spec.compiler_flags = '-DPD', '-DUSEAPI_DUMMY', '-DHAVE_UNISTD_H', '-DLIBPD_EXTRA', '-fcommon'
  spec.frameworks = 'Foundation'

  # frameworks for ios-only audio implementation
  spec.ios.frameworks = 'AudioToolbox', 'AVFoundation'

  # allow for loading pd externals
  spec.macos.compiler_flags = '-DHAVE_LIBDL'
  spec.macos.libraries = 'dl'

  # exclude backends and utils not relevant to libpd
  spec.exclude_files = 'pure-data/src/s_audio_alsa.h',
                       'pure-data/src/s_audio_alsa.c',
                       'pure-data/src/s_audio_alsamm.c',
                       'pure-data/src/s_audio_audiounit.c',
                       'pure-data/src/s_audio_esd.c',
                       'pure-data/src/s_audio_jack.c',
                       'pure-data/src/s_audio_mmio.c',
                       'pure-data/src/s_audio_oss.c',
                       'pure-data/src/s_audio_pa.c',
                       'pure-data/src/s_audio_paring.h',
                       'pure-data/src/s_audio_paring.c',
                       'pure-data/src/s_file.c',
                       'pure-data/src/s_midi_alsa.c',
                       'pure-data/src/s_midi_dummy.c',
                       'pure-data/src/s_midi_mmio.c',
                       'pure-data/src/s_midi_oss.c',
                       'pure-data/src/s_midi_pm.c',
                       'pure-data/src/s_midi.c',
                       'pure-data/src/d_fft_fftw.c',
                       'pure-data/src/s_entry.c',
                       'pure-data/src/s_watchdog.c',
                       'pure-data/src/u_pdreceive.c',
                       'pure-data/src/u_pdsend.c',
                       'pure-data/src/x_libpdreceive.h',
                       'pure-data/src/x_libpdreceive.c',
                       'pure-data/src/z_ringbuffer.h',
                       'pure-data/src/z_ringbuffer.c',
                       'pure-data/src/z_queued.c',
                       'pure-data/src/z_queued.h',
                       'pure-data/src/z_print_util.c',
                       'pure-data/src/z_print_util.h',
                       'pure-data/src/z_hooks.c',
                       'pure-data/src/z_hooks.h',
                       'pure-data/src/s_libpdmidi.c',
                       'pure-data/src/z_libpd.c',
                       'pure-data/src/z_libpd.h'
                       
                       

  # exclude ios-only audio implementation
  spec.macos.exclude_files = 'objc/PdAudioController.*{h,m}',
                             'objc/PdAudioUnit.*{h,m}',
                             'objc/AudioHelpers.*{h,m}'
end

I think the podspec file in Cocoapods may need to be updated too. I'm not an iOS developer though and don't really know the full process for updating pod spec files

@danomatika
Copy link
Member

I'd be happy to look at a PR for this, if you can make one. Maybe include the following comment line above spec.exclude_files and below the current comment:

# also exclude libpd files included with the puredata source itself for now (until parity)

@corporate-fun
Copy link
Contributor Author

Got one up now: #346

@danomatika
Copy link
Member

Please test the current master. If the merge is now working, then I think we can close the issue.

@danomatika
Copy link
Member

I will assume this works. Please reopen if not.

@andresbrocco
Copy link

I was running into similar issues, because my git was unable to fetch submodules through ssh. So I've run git config --global url."https://".insteadOf git:// as proposed by berteodoseo at this post, and everything worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants