Does Haiku have a maths so library?

I’ve been trying to compile something that wants to use -lm, which doesn’t work, and I’ve found patching the makefile about impossible.

This is a common porting problem.

Check this link out for fix: http://ports.haiku-files.org/wiki/CommonProblems

Oh yeah, forgot to check that page. COuld I avoid future problems creating a link called libm.so to libroot or creating a blank library called libm.so? THat way, the compiler wouldn’t encounter a problem when couldn’t find the file.

No because if you remove the link, then the program will complain that libm is missing. Also, if you provide it to others they would require the same link or library.

Correct way is to remove -lm from your configure script or makefile.

A libm symlink is just a workaround modifying the build environment, and one that could be proved counter-productive at runtime or after a system upgrade.

The root problem is that coder(s) assumes wrongly, by harcoding it in the build system, that maths POSIX APIs are always provided in a separate library called libm.so. It’s neither required by POSIX or true on several platforms.

The correct way is to fix the build system. If it’s autoconf-based, in configure.in (or configure.ac) script, fix or add this:

AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")

… and replace every occurence of litteral -lm with $LIBM.

If it’s plain makefile(s), you could do something similar to this:

HOST=$(shell uname) ifneq ($(HOST), Haiku) LIBM = -lm endif

And then, again, replace every occurence of -lm with $(LIBM).

That way, you actually add Haiku port and improve the project build system at the same time, and your port can be upstream to the project team.

Or via HaikuPorts.

[quote=tonestone57]
Correct way is to remove -lm from your configure script or makefile.[/quote]

Should have said the easy way.

Phoudoin gave the correct way for fixing the missing math library issue!!!

I’ve also had a program looking for libc, but I can’t find this in either the makefiles, configure, or configure.ac. Is it possible to get rid of it?

Search for any -lc and fix the issue the same way you will did for -lm.
If you found none, please share here which project is it.