[Bug 247976] pkg-config produces icorrect linkage information about libncursesw
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jul 14 17:27:38 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247976
Bug ID: 247976
Summary: pkg-config produces icorrect linkage information about
libncursesw
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: ports-bugs at FreeBSD.org
Reporter: internalmike at gmail.com
Consider the following program:
```c
#include <locale.h>
#include <curses.h>
int main() {
setlocale(LC_ALL, "");
initscr();
cbreak();
noecho();
keypad(stdscr, true);
clear();
move(10, 10);
addnstr("x", 1);
move(10, 10);
insnstr("Привет", 2);
getch();
endwin();
return 0;
}
```
If you compile it in direct way and run resulting binary:
```sh
$ cc main.c -o main -lncursesw
$ ./main
```
you will get correct-working program: "./main" will display "Пx" on screen.
(Please, consider [this stackoverflow
answer](https://stackoverflow.com/questions/62897474/what-is-the-exact-meaning-of-the-second-parameter-of-the-insnstr-ncurses-funct/62898381#62898381)
if you have doubts about expected ncurses behavior.)
But pkg-config provides the following info about linkage:
```sh
$ pkg-config --libs ncursesw
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -lncursesw -ltinfow
```
And if you compile and run the program with all this flags:
```sh
$ cc -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lncursesw -ltinfow main.c -o
main -lncursesw
$ ./main
```
you will get very different result on screen: "Прx".
If you remove `-L/usr/local/lib` part, you get correct behavior back.
I believe, pkg-config should provide information, which does not broke
programs.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list