You are not logged in.

#1 2024-11-18 17:31:00

FabioLolix
Member
Registered: 2021-06-27
Posts: 8
Website

[Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

Hi, I'm working on a pkgbuild for the intel NPU driver (for the sake of packaging; I don't have the hardware for testing)

the last issue I'm having is that it fail with -D_FORTIFY_SOURCE=3 while with -D_FORTIFY_SOURCE=2 build

How can I replace or change it?

Last edited by FabioLolix (2024-11-18 18:30:29)

Offline

#2 2024-11-18 18:14:16

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,399
Website

Re: [Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

Something along the lines of

export CFLAGS="${CFLAGS/D_FORTIFY_SOURCE=3/D_FORTIFY_SOURCE=2}"

in the PKGBUILD should work.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#3 2024-11-18 18:21:00

FabioLolix
Member
Registered: 2021-06-27
Posts: 8
Website

Re: [Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

That dind't work but I found a solution while casually looking into openvino pkgbuild which have the same problem

export CFLAGS="${CFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"
export CXXFLAGS="${CXXFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"

Offline

#4 2024-11-18 18:21:53

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,079

Re: [Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

That removes it altogether, which isn't what you want.

Offline

#5 2024-11-18 18:29:39

FabioLolix
Member
Registered: 2021-06-27
Posts: 8
Website

Re: [Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

OK, got it to work extending WorMzy suggestion to CXXFLAGS, this is mostly written in c++, didn't think about it at the first try

export CFLAGS="${CFLAGS/D_FORTIFY_SOURCE=3/D_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/D_FORTIFY_SOURCE=3/D_FORTIFY_SOURCE=2}"


Edited with the last suggestion

Last edited by FabioLolix (2024-11-18 18:52:03)

Offline

#6 2024-11-18 18:46:09

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,399
Website

Re: [Solved] How to replace -D_FORTIFY_SOURCE=3 with -D_FORTIFY_SOURCE=2

You should change the instance of 'CFLAGS' to 'CXXFLAGS' in the second line, otherwise you'll lose any c++-specific flags (like '-Wp,-D_GLIBCXX_ASSERTIONS').


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

Board footer

Powered by FluxBB