MeetYouDevs / cocoapods-imy-bin

1.05k stars 244 forks source link

请教一下有关dwarfdump命令的问题 #119

Closed LynahZ closed 3 years ago

LynahZ commented 3 years ago

我在尝试使用dwarfdump解析静态库.a文件的时候,发现并不能获取到包含AT_comp_dir的具体信息,猜测原因是使用了pod package命令构建静态库,尝试把简单组件的文件复制到新创建的static library工程中构建,得到的.a文件就可以正常获取到信息,但是对于存在依赖的组件无从下手。 所以想请教一下在现有情况下构建正常的.a静态库,非常感谢! (另外我们因为有其他需求,所有组件的podspec都需要转为json文件使用)

dabing1022 commented 3 years ago

能否描述的更详细点?

dabing1022 commented 3 years ago

如果你使用的是cocoapods-packager打的包,那么默认不带debug info的,我们可以从 cocoapods-packager/pod_utils.rb 中看到相关代码

def install_pod(platform_name, sandbox)
        podfile = podfile_from_spec(
          @path,
          @spec.name,
          platform_name,
          @spec.deployment_target(platform_name),
          @subspecs,
          @spec_sources
        )

        static_installer = Installer.new(sandbox, podfile)
        static_installer.install!

        unless static_installer.nil?
          static_installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
              config.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
              config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO'
            end
          end
          static_installer.pods_project.save
        end

        static_installer
      end

注意 config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO', 这里将工程的generate debug symbols设置为了NO,所以我们在静态库中看到.debug_info content 是空的,AT_comp_dir 当然也不存在。

这里设置为YES即可。

dabing1022 commented 3 years ago

而 imy-bin 这里工程的配置是YES

LynahZ commented 3 years ago

非常感谢,我尝试修改本地cocoapods-packager的文件

dabing1022 commented 3 years ago

非常感谢,我尝试修改本地cocoapods-packager的文件

好的,有结论了,可以在这里同步下。如果解决了问题,可以close掉哦。