How to Remove Warning: “-pie being ignored. it is only used when linking a main executable”

Setting “Generate Position-Dependent Code” to Yes does not feel like the right fix. Position-independent is preferred. Non-app targets like frameworks and libraries will always be position independent anyway, hence the warning.

The warning shown is a linker message and the other setting in @Marcpek’s screen shot seems more suitable: “Linking > Generate Position-Dependent Executable”. QuickHelp shows this is the LD_NO_PIE setting.

Generate Position-Dependent Executable LD_NO_PIE setting

Even though this inherits No anyway from the OS defaults I tried setting it to No again in my CocoaPod targets explicitly and that seemed to work, fixing the linker warning.

Any project settings you make will be lost the next time you run pod install so edit the Podfile to make the change permanent. Add config.build_settings['LD_NO_PIE'] = 'NO' into post_install phase:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['LD_NO_PIE'] = 'NO'
        end
    end
end

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)