Skip to content

Cannot link C main #643

@awvwgk

Description

@awvwgk

I'm currently trying to (ab)use fpm to compile a C project. It is not a C package manager, but it certainly could become one.

Using a project with the following layout:

fpm.toml
app/main.c

fpm.toml:

name = "test"
[[executable]]
name = "test"
main = "main.c"

app/main.c:

int
main (void) {
  return 0;
}

Will fail to link the C executable with

❯ fpm build
 + mkdir -p build/gfortran_2A42023B310FA28D/test
 + gcc -c app/main.c  -I./include -o build/gfortran_2A42023B310FA28D/test/app_main.c.o
❯ fpm run
<INFO> No executables to run
STOP 0

I think the source scanning must find a program statement in the source-file declared as main in the manifest. Instead, it would be preferable if fpm just trust the user input and assumes that the provided main is providing the necessary entry point.


Tested with fpm 0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions