AppOrderFiles icon indicating copy to clipboard operation
AppOrderFiles copied to clipboard

Undefined symbol: ___sanitizer_cov_trace_pc_guard_init

Open willokyes opened this issue 5 years ago • 9 comments

image image

willokyes avatar Sep 01 '19 07:09 willokyes

在对应的二进制库关掉SanitizerCoverage就好了

liujiaozhu avatar Sep 01 '19 14:09 liujiaozhu

在对应的二进制库关掉SanitizerCoverage就好了

就创建个简单的demo,然后配置开启SanitizerCoverage也是报这个错,怎么解决

lsmakethebest avatar Sep 19 '19 07:09 lsmakethebest

哪个库编译不过,就移除哪个库 other c flags 中的 -fsanitize-coverage=func,trace-pc-guard

li6185377 avatar Sep 23 '19 06:09 li6185377

如果有swift代码,可能还需要在Other Swift Flags,把里面的东西删掉

coderiding avatar Mar 18 '20 05:03 coderiding

如果有swift代码,可能还需要在Other Swift Flags,把里面的东西删掉

请问如何能指定库关闭对应的other c flags标志呢,

talka123456 avatar Aug 04 '21 07:08 talka123456

any update?

dwirandytlvk avatar Apr 27 '22 10:04 dwirandytlvk

不行的原因是,应该是你的Pods是动态库,动态库又没有依赖AppOrderFiles这个,导致缺少 -fsanitize-coverage=func,trace-pc-guard 代码报错;这里的解决方案有三个: 1、将你的Pods改成静态库; 2、在你的Pods动态库中,依赖AppOrderFiles; 3、移除 -fsanitize-coverage=func,trace-pc-guard ,即不收集你的Pods的代码覆盖率数据。

erduoniba avatar May 17 '22 08:05 erduoniba

当然也可以针对某一个Pods设置为静态库,相关代码如下

#创建需要进行处理的动态库的数组
needStaticAry = Array['IQKeyboardManager']
#这个hooks允许,你在生成xcode project写入硬盘前做最后的改动
post_install do |installer|
    #获取所有的target,包括静态库h和动态库
    installer.pods_project.targets.each do |target|
        #打印所有的target,这里的target是一个对象,获取名字需要用target.name
        needStaticAry.each do |staticTarget|
            if target.name == staticTarget
                target.build_configurations.each do |config|
                    #将mach-o改为静态库
                    config.build_settings['MACH_O_TYPE'] = "staticlib"
                    config.build_settings['OTHER_CFLAGS'] = '-fsanitize-coverage=func,trace-pc-guard'
                    config.build_settings['OTHER_SWIFT_FLAGS'] = '-sanitize-coverage=func -sanitize=undefined'
                end
            end
        end
    end
end

这里在真机环境运行有问题,还没有解决。但是在模拟器正常,所以在模拟器得到Pods的数据也大差不差了。

erduoniba avatar May 17 '22 09:05 erduoniba

我这边所有的第三方库都有问题,私有库没问题,楼主解决了么

MrZQxiao avatar Jul 14 '22 07:07 MrZQxiao