build fail on freebsd because of strings.h include

Bug #631207 reported by Alex Samorukov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cuneiform for Linux
Fix Released
Undecided
Unassigned

Bug Description

I am maintainer of the freebsd port of smartmontools. While trying to update the port to the latest version i found a lot of build failures. All this failures are looking as:

[ 2%] Building C object cuneiform_src/Kern/ctb/CMakeFiles/ctb32.dir/src/ctb_oper.c.o
In file included from /usr/include/string.h:49,
                 from /usr/ports/graphics/cuneiform/work/cuneiform-linux-1.0.0/cuneiform_src/Kern/ctb/src/ctb_oper.c:62:
/usr/ports/graphics/cuneiform/work/cuneiform-linux-1.0.0/cuneiform_src/Kern/hrstr/strings.h:101: error: expected specifier-qualifier-list before 'uchar'
/usr/ports/graphics/cuneiform/work/cuneiform-linux-1.0.0/cuneiform_src/Kern/hrstr/strings.h:138: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'bNeedFreeString'
*** Error code 1

The real problem is that wrong strings.h is included from the system string.h header. Reason is very simple - gcc searches all directories from -I/src/... dirs and only then - system path. There is file names strings.h in the source tree, so its included by mistake and this causing a build failure.

There are 2 possible workarounds for this - one is to use mine workaround from the cuneiform_src/Kern/hhh/tigerh/h/c_types.h file:

/* solves conflict with bsd <strings.h> */
#if defined(__FreeBSD__)
#undef __BSD_VISIBLE
#endif

This way it force system strng.h not to include strings.h. The problem is that in many source files <strings.h> is included *before* cuneiform includes, so this will require to change include order of the all such files, Another option (as for me - better one) is to rename strings.h to something like cf_strings.h and also to change references in the cuneiform files (it is used only in 1 or 2 headers). I think this is the best case, because will prevent such problems in the feature. Please tell me your opinion and i will do the patch.

Revision history for this message
Alex Samorukov (samm-os2) wrote :

I patched 1.0 and now it builds fine. Proposed patch attached. Also

cuneiform_src/Kern/hrstr/strings.h needs to be renamed to cuneiform_src/Kern/hrstr/cf_strings.h and cuneiform_src/Kern/hhh/tigerh/h/strings.h to cuneiform_src/Kern/hhh/tigerh/h/cf_strings.h.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Applied. Thanks.

Changed in cuneiform-linux:
status: New → Fix Committed
Changed in cuneiform-linux:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.