| 117 | | = Common Porting Problems = |
| 118 | | |
| 119 | | This page serves to collect information about common problems encountered when porting applications/libraries to the Haiku/BeOS platform. The problems should be identified by the (compiler) errors that typify them. |
| 120 | | |
| 121 | | Information about BeOS's POSIX compatibility, see [wiki:BeOSPosix]. |
| 122 | | |
| 123 | | === no undefined references allowed in i586-pc-beos shared libraries === |
| 124 | | |
| 125 | | ports: [wiki:dev-util/subversion], [wiki:dev-libs/apr] |
| 126 | | |
| 127 | | You need to pass the {{{-no-undefined}}} option to libtool |
| 128 | | |
| 129 | | Alternatively, libtool can be patched to always exhibit this behavior, at the risk of breaking static compilation when dynamic linking fails. -- andreasf |
| 130 | | |
| 131 | | === (stat) structure has no member named `st_blocks' (Now fixed in Haiku) === |
| 132 | | |
| 133 | | ports: [wiki:app-arch/tar] (make check), [wiki:net-fs/samba], [wiki:dev-util/cvs] |
| 134 | | |
| 135 | | The stat struct in sys/stat.h in BeOS ~~and Haiku~~ ([http://dev.haiku-os.org/ticket/2261 Haiku now has it] [http://dev.haiku-os.org/changeset/27791 as seen here]) doesn't have an st_blocks member. In projects with autoconf, you can check for HAVE_STAT_ST_BLOCKS. |
| 136 | | |
| 137 | | http://lists.samba.org/archive/samba-technical/2005-January/039275.html |
| 138 | | |
| 139 | | === -lm === |
| 140 | | |
| 141 | | ports: [wiki:dev-lang/lua], others |
| 142 | | |
| 143 | | The -lm refers to libm which isn't needed for Haiku or BeOS as the math library is part of libroot and linked by default |
| 144 | | |
| 145 | | Please DO NOT create a shortcut of libroot.so and rename to libm.so on gcc4 and gcc2 lib directory (Haiku hybrids case) or change the -lm references in the configure file to -lroot. |
| 146 | | If the port is using the autotools chances are this can be fixed by doing an AC_CHECK_LIB for cos in m and then setting a variable such as LIBM or MLIB to by ="-lm" if true or "" if not. |
| 147 | | |
| 148 | | Here is some explanation: |
| 149 | | http://www.freelists.org/archives/haiku-development/04-2008/msg00904.html |
| 150 | | |
| 151 | | === -lc === |
| 152 | | |
| 153 | | This sometimes turns up, and I think it is due to the port using an older libtool. Try running libtoolize --force --copy --install, aclocal, autoconf and automake before ./configure to see if that clears it up. |
| 154 | | |
| 155 | | === conflicting types for `restrict' (Now fixed in Haiku) === |
| 156 | | |
| 157 | | /boot/develop/headers/posix/search.h:35: conflicting types for `restrict' |
| 158 | | /boot/develop/headers/posix/search.h:35: previous declaration of `restrict' |
| 159 | | This seems to be an issue with Haiku and has been reported [http://dev.haiku-os.org/ticket/2262 Haiku-2262] |
| 160 | | This has been fixed in Haiku. If using a version prior to the fix you can copy the search.h file over the one in your headers/posix folder. |
| 161 | | |
| 162 | | === GCC 2.9 related build problems === |
| 163 | | |
| 164 | | output_operand_lossage `invalid expression as operand' |
| 165 | | |
| 166 | | This can be avoided by not passing the '-g' option to gcc for this test. |
| 167 | | |
| 168 | | |
| 169 | | === GCC 4.3 related build problems === |
| 170 | | |
| 171 | | Typical errors look like these: |
| 172 | | |
| 173 | | error: 'find' is not a member of 'std' |
| 174 | | |
| 175 | | error: 'exit' was not declared in this scope |
| 176 | | |
| 177 | | Please take a look at: http://www.cyrius.com/journal/2007/05/10#gcc-4.3-include |
| 178 | | |
| 179 | | or |
| 180 | | |
| 181 | | http://www.comp.leeds.ac.uk/hannah/cpp/errors.html |
| 182 | | |
| 183 | | === MSG_NOSIGNAL undeclared === |
| 184 | | |
| 185 | | Add below to header/source file. |
| 186 | | |
| 187 | | {{{ |
| 188 | | #ifndef MSG_NOSIGNAL |
| 189 | | #define MSG_NOSIGNAL 0 |
| 190 | | #endif |
| 191 | | }}} |
| 192 | | |
| 193 | | === O_NOATIME undeclared === |
| 194 | | |
| 195 | | Add below to header/source file. |
| 196 | | |
| 197 | | {{{ |
| 198 | | #include <fcntl.h> |
| 199 | | #ifndef _GNU_SOURCE |
| 200 | | #define _GNU_SOURCE // for O_NOATIME |
| 201 | | #define O_NOATIME 01000000 |
| 202 | | #endif |
| 203 | | }}} |
| 204 | | |