(以内容“Various portability issues, mainly between linux/freebsd * prctl() / prctl.h No prctl() in freebsd. ** To set process title, use setproctitle() ** For PR_SET_PTRACE...”创建新页面)
 
 
第1行: 第1行:
 
Various portability issues, mainly between linux/freebsd
 
Various portability issues, mainly between linux/freebsd
  
* prctl() / prctl.h
+
== prctl() / prctl.h ==
  
 
No prctl() in freebsd.  
 
No prctl() in freebsd.  
  
** To set process title, use setproctitle()
+
* To set process title, use setproctitle()
** For PR_SET_PTRACER, I'm not sure now.
+
* For PR_SET_PTRACER, I'm not sure now.
  
* malloc.h
+
== malloc.h ==
  
 
Including malloc.h in freebsd leads to compile error. Use stdlib.h instead.
 
Including malloc.h in freebsd leads to compile error. Use stdlib.h instead.
第14行: 第14行:
 
Anyway, in linux's malloc(3) manpage, it is said that you should include stdlib.h.
 
Anyway, in linux's malloc(3) manpage, it is said that you should include stdlib.h.
  
* libdl
+
== libdl ==
  
 
In linux, dlopen()/dlclose()/dlsym() are in libdl. In freebsd, they are in libc. So there is no point to link with libdl, and there is no libdl, anyway.
 
In linux, dlopen()/dlclose()/dlsym() are in libdl. In freebsd, they are in libc. So there is no point to link with libdl, and there is no libdl, anyway.
  
* program_invocation_short_name
+
== program_invocation_short_name ==
  
 
No such thing in bsd. Maybe you should use argv[0].
 
No such thing in bsd. Maybe you should use argv[0].
  
* Include path / Lib path
+
== Include path / Lib path ==
  
freebsd installs all non-base softwares into /usr/local. So, the third party include files are in /usr/local/include, and third party lib files are in /usr/local/lib, and they are not in the default include/lib path, so you should include them with -I & -L.
+
freebsd installs all non-base softwares into '''/usr/local'''. So, the third party include files are in '''/usr/local/include''', and third party lib files are in '''/usr/local/lib''', and they are not in the default include/lib path, so you should include them with -I & -L.
 +
 
 +
The modern way is to use pkg-config. You may also use cmake's FindXXX.

2012年12月24日 (一) 01:00的最新版本

Various portability issues, mainly between linux/freebsd

prctl() / prctl.h

No prctl() in freebsd.

  • To set process title, use setproctitle()
  • For PR_SET_PTRACER, I'm not sure now.

malloc.h

Including malloc.h in freebsd leads to compile error. Use stdlib.h instead.

Anyway, in linux's malloc(3) manpage, it is said that you should include stdlib.h.

libdl

In linux, dlopen()/dlclose()/dlsym() are in libdl. In freebsd, they are in libc. So there is no point to link with libdl, and there is no libdl, anyway.

program_invocation_short_name

No such thing in bsd. Maybe you should use argv[0].

Include path / Lib path

freebsd installs all non-base softwares into /usr/local. So, the third party include files are in /usr/local/include, and third party lib files are in /usr/local/lib, and they are not in the default include/lib path, so you should include them with -I & -L.

The modern way is to use pkg-config. You may also use cmake's FindXXX.