Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ordering of link flags before archive, thus flag ignored by linker #1015

Open
scivision opened this issue Apr 7, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@scivision
Copy link
Member

scivision commented Apr 7, 2024

Description

The link flags are put before the archive in the command line, causing the link flags to be ignored by the linker (at least for GCC).

With at least FPM 0.10.0 and 0.10.1, regardless of operating system (Linux and Windows tried), and using Ffilesystem project (probably any project has this issue):

by either:

FPM_LDFLAGS=-lm fpm build

or

fpm build --link-flags "-lm"

results in command:

Windows:

gfortran    -Wall -Wextra -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -fimplicit-none -Werror=implicit-interface -I.\.\include  -lm build\gfortran_CCDA9AB199436CCD\ffilesystem\app_fortran_main.f90.o build\gfortran_A18F5477E168D1CF\ffilesystem\libffilesystem.a -lstdc++ -o build\gfortran_E885EEFD2DC7A74C\app\main.exe

Linux:

gfortran    -Wall -Wextra -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -fimplicit-none -Werror=implicit-interface -I././include  -lm build/gfortran_E17BCF1508095BB1/ffilesystem/app_fortran_main.f90.o build/gfortran_FA0A528919A6C0C3/ffilesystem/libffilesystem.a -lstdc++ -o build/gfortran_6A2ED2947B09C891/app/main

Expected Behaviour

I expect the link flag "-lm" (or say -lUserenv for Windows) to be AFTER the object file or archive, otherwise the linker ignores the link flag

Version of fpm

0.10.1, 0.10.0

Platform and Architecture

at least Linux, Windows

Additional Information

No response

@scivision scivision added the bug Something isn't working label Apr 7, 2024
@scivision scivision changed the title ordering of link flags before object, causing flag to be ignored by linker ordering of link flags before archive, thus flag ignored by linker Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant