Skip to contentSkip to conversation

generic-package compiler flags

Buildroot Andreas Ziegler 1 participant 1 message Feb 8, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Alex,

Quoted 11 lines · Earthquake

Hi,

I added another package to my buildroot via buildroot externals. Its a generik-package in the mk file and the BUILD_CMDS is

$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)

Within the package source-Makefile the -fPIC is added to CFLAGS CFLAGS += -fPIC

Declared like this, CFLAGS will not be picked up by the Buildroot make script; Buildroot expects variables to be prefixed by the package name. A list of recognized variable names can be found in section 18.6.2 of

https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

You might use something like this instead:

MYPACKAGE_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) -fPIC

define MYPACKAGE_BUILD_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) $(MYPACKAGE_MAKE_OPTS) -C $(@D)

endef

Quoted 8 lines

Outside of buildroot the package builds the lib as .so (-shared is also defined), but within buildroot the -fPIC option in CFLAGS is missing.

CFLAGS within the buildroot env is: -D_LARGEFILE_SOURCE

(quoted diff) +0 -2
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64? -O2 -g0 
-D_FORTIFY_SOURCE=1

How can I solve this and also change the -g0 and -O?

You can find these settings in the 'Build options' sub-menu:

	[] build packages with debugging symbols
	[] build packages with runtime debugging info
	gcc optimization level (...) -->

Within this sub-menu, there also exist entries for shared /static build and controlling PIC/PIE globally.

Quoted 7 lines

Thanks for an answere.

Best regards,

Alex

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot