Bug 240856 - sqrt problem
Summary: sqrt problem
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.0-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2019-09-27 09:00 UTC by Adam Heinrich
Modified: 2020-10-29 08:37 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Adam Heinrich 2019-09-27 09:00:16 UTC
if I compile :

#include <math.h>

double Summx2 = 2.0;
double StandardDeviation;

int main (int argc, char **argv)
		StandardDeviation = sqrt(Summx2);

		return 0;

with :
gcc `pkg-config --cflags gtk+-3.0` -o "test" "test.c" `pkg-config --libs gtk+-3.0`

I receive
/usr/local/bin/ld: /tmp//ccQtgX7c.o: undefined reference to symbol 'sqrt@@FBSD_1.0'
/usr/local/bin/ld: /lib/libm.so.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Its only the problem part I need gtk for display the GUI, the full programm ist to long.
Comment 1 Andriy Gapon freebsd_committer 2019-09-27 11:30:28 UTC
sqrt is provided by libm.
That's what the error message tells you.
Comment 2 Li-Wen Hsu freebsd_committer 2020-10-29 08:37:38 UTC
I cannot reproduce here, please also check if you have -lm passed to cc.
Please test again in the newer release and updated pacakges.