Bug 235907 - shells/bash-static doesn't link after compile
Summary: shells/bash-static doesn't link after compile
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-21 04:55 UTC by Walter Parker
Modified: 2019-02-22 07:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Parker 2019-02-21 04:55:51 UTC
If you run make config and select the static option, the link stage fails with errors.

cc -shared -Wl,-soname,print  -fstack-protector -fuse-ld=bfd  -static  -o print print.o
/usr/bin/ld.bfd: warning: cannot find entry symbol _start; defaulting to 0000000000400170
print.o: In function `print_builtin':
print.c:(.text+0x15): undefined reference to `reset_internal_getopt'
print.c:(.text+0x57): undefined reference to `internal_getopt'
print.c:(.text+0x70): undefined reference to `list_optarg'
print.c:(.text+0x87): undefined reference to `list_optarg'
print.c:(.text+0x8f): undefined reference to `all_digits'
print.c:(.text+0x9e): undefined reference to `list_optarg'
...

/usr/lib/libc.a(getenv.o): In function `__clean_env':
/usr/src/lib/libc/stdlib/getenv.c:250: undefined reference to `environ'
/usr/src/lib/libc/stdlib/getenv.c:251: undefined reference to `environ'
/usr/lib/libc.a(getenv.o): In function `getenv':
/usr/src/lib/libc/stdlib/getenv.c:440: undefined reference to `environ'
/usr/lib/libc.a(getenv.o): In function `__merge_environ':
/usr/src/lib/libc/stdlib/getenv.c:546: undefined reference to `environ'
/usr/src/lib/libc/stdlib/getenv.c:558: undefined reference to `environ'
/usr/lib/libc.a(getenv.o):/usr/src/lib/libc/stdlib/getenv.c:338: more undefined references to `environ' follow
...
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
Comment 1 Emanuel Haupt freebsd_committer freebsd_triage 2019-02-21 07:58:56 UTC
This happens during the 'make stage' target when static build is selected and can be safely ignored. Loadables (./work/bash-5.0/examples/loadables) won't work with static building. The upstream Makefile already ignores the error code emitted by this directory.

I concede that this is confusing and it has prompted questions before. I'll commit a patch shortly that will prevent running this particular section of the Makefile when static build is selected.
Comment 2 Emanuel Haupt freebsd_committer freebsd_triage 2019-02-22 07:22:03 UTC
I've committed a patch that prevents trying to build loadables with the static option.