Open Rush opened 10 years ago
This is puzzling, as it is perfectly legal to have _DLL undefined in the preprocessor directive. Also, I could not reproduce the result. Any chance you could post the output of running make -V on sfio?
Sorry, make that 'make V=1'
Making all in Sfio_f
make[1]: Entering directory `/home/rush/Programowanie/graphviz.test.git/lib/sfio/Sfio_f'
/bin/sh ../../../libtool --tag=CC --mode=compile i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../lib/common -I../../../lib/sfio -I/usr/local/include -Dvt_threaded=0 -g -O2 -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -ffast-math -MT _sfclrerr.lo -MD -MP -MF .deps/_sfclrerr.Tpo -c -o _sfclrerr.lo _sfclrerr.c
libtool: compile: i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../lib/common -I../../../lib/sfio -I/usr/local/include -Dvt_threaded=0 -g -O2 -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -ffast-math -MT _sfclrerr.lo -MD -MP -MF .deps/_sfclrerr.Tpo -c _sfclrerr.c -o _sfclrerr.o
In file included from ../../../lib/sfio/sfio_t.h:46:0,
from ../../../lib/sfio/sfhdr.h:29,
from _sfclrerr.c:14:
../../../lib/sfio/sfio.h:292:10: error: operator '&&' has no left operand
#if _DLL && _DLL_INDIRECT_DATA
^
make[1]: *** [_sfclrerr.lo] Error 1
make[1]: Leaving directory `/home/rush/Programowanie/graphviz.test.git/lib/sfio/Sfio_f'
make: *** [all-recursive] Error 1
I tried monkey patching all compile errors to get something usable .. below is a complete diff of changes to make it compile. Unfortunately I also had to recompile mkdefs
tools because it compiled with the host settings and was not usable .. had to recompile it with my build system gcc.
Anyway, I still did not succeed in making it link. I also provide link error log ... Either I am doing something inherently wrong or graphviz is not supposed to cross-compile on MinGW.
diff --git a/lib/ast/ast.h b/lib/ast/ast.h
index a03ddf7..d65a871 100644
--- a/lib/ast/ast.h
+++ b/lib/ast/ast.h
@@ -18,7 +18,7 @@ extern "C" {
#ifndef AST_H
#define AST_H
-#include <sfio.h>
+//#include <sfio.h>
#include <stdlib.h>
#include <stddef.h>
#include <align.h>
diff --git a/lib/ast/error.c b/lib/ast/error.c
index db1be6e..6fc761e 100644
--- a/lib/ast/error.c
+++ b/lib/ast/error.c
@@ -27,6 +27,7 @@
#include <error.h>
#include <string.h>
#include <errno.h>
+#include <stdio.h>
Error_info_t error_info;
@@ -54,37 +55,37 @@ void errorv(const char *id, int level, va_list ap)
}
if (level && ((s = error_info.id) || (s = (char *) id))) {
if (flags & ERROR_USAGE)
- sfprintf(sfstderr, "Usage: %s ", s);
+ fprintf(stderr, "Usage: %s ", s);
else
- sfprintf(sfstderr, "%s: ", s);
+ fprintf(stderr, "%s: ", s);
}
if (flags & ERROR_USAGE)
/*nop */ ;
else if (level < 0) {
int i;
for (i = 0; i < error_info.indent; i++)
- sfprintf(sfstderr, " ");
- sfprintf(sfstderr, "debug%d: ", level);
+ fprintf(stderr, " ");
+ fprintf(stderr, "debug%d: ", level);
} else if (level) {
if (level == ERROR_WARNING) {
- sfprintf(sfstderr, "warning: ");
+ fprintf(stderr, "warning: ");
error_info.warnings++;
} else {
error_info.errors++;
if (level == ERROR_PANIC)
- sfprintf(sfstderr, "panic: ");
+ fprintf(stderr, "panic: ");
}
if (error_info.line) {
if (error_info.file && *error_info.file)
- sfprintf(sfstderr, "\"%s\", ", error_info.file);
- sfprintf(sfstderr, "line %d: ", error_info.line);
+ fprintf(stderr, "\"%s\", ", error_info.file);
+ fprintf(stderr, "line %d: ", error_info.line);
}
}
s = va_arg(ap, char *);
- sfvprintf(sfstderr, s, ap);
+ fprintf(stderr, s, ap);
if (flags & ERROR_SYSTEM)
- sfprintf(sfstderr, "\n%s", strerror(errno));
- sfprintf(sfstderr, "\n");
+ fprintf(stderr, "\n%s", strerror(errno));
+ fprintf(stderr, "\n");
if (level >= ERROR_FATAL)
exit(level - ERROR_FATAL + 1);
}
diff --git a/lib/common/utils.c b/lib/common/utils.c
index f74dbb6..cc84fba 100644
--- a/lib/common/utils.c
+++ b/lib/common/utils.c
@@ -19,7 +19,7 @@
#include "gvc.h"
#ifdef WIN32
-#include "libltdl/lt_system.h"
+#include "libltdl/libltdl/lt_system.h"
#endif
#ifndef WIN32
#include <unistd.h>
@@ -366,7 +366,7 @@ static char* findPath (char** dirs, int maxdirlen, const char* str)
for (dp = dirs; *dp; dp++) {
sprintf (safefilename, "%s%s%s", *dp, DIRSEP, str);
- if (access (safefilename, R_OK) == 0)
+ if (access (safefilename, 0) == 0)
return safefilename;
}
return NULL;
diff --git a/lib/expr/exlib.h b/lib/expr/exlib.h
index 1ab24ef..cec7f05 100644
--- a/lib/expr/exlib.h
+++ b/lib/expr/exlib.h
@@ -34,6 +34,9 @@ extern "C" {
(char*)((f)->next = (f)->data+(p)) ) \
)
+typedef struct _sfio_s Sfio_t;
+
+typedef long Sflong_t;
typedef struct Exinput_s /* input stack */
{
diff --git a/lib/expr/exparse.y b/lib/expr/exparse.y
index 306167f..7c27b77 100644
--- a/lib/expr/exparse.y
+++ b/lib/expr/exparse.y
@@ -41,7 +41,7 @@
double floating;
struct Exref_s* reference;
struct Exid_s* id;
- Sflong_t integer;
+ long integer;
int op;
char* string;
void* user;
diff --git a/lib/expr/expr.h b/lib/expr/expr.h
index d9d5b51..e17d482 100644
--- a/lib/expr/expr.h
+++ b/lib/expr/expr.h
@@ -130,6 +130,8 @@ struct Exref_s; typedef struct Exref_s Exref_t;
typedef int (*Exerror_f) (Expr_t *, Exdisc_t *, int, const char *, ...);
typedef void (*Exexit_f) (Expr_t *, Exdisc_t *, int);
+typedef long Sflong_t;
+
typedef struct Exlocal_s /* user defined member type */
{
Sflong_t number;
@@ -255,6 +257,8 @@ struct Exdisc_s /* discipline */
void* user;
};
+typedef struct _sfio_s Sfio_t;
+
struct Expr_s /* ex program state */
{
const char* id; /* library id */
diff --git a/lib/gvc/Makefile.am b/lib/gvc/Makefile.am
index d5e3404..0d3a021 100644
--- a/lib/gvc/Makefile.am
+++ b/lib/gvc/Makefile.am
@@ -40,7 +40,7 @@ pdf_DATA = gvc.3.pdf
libgvc_C_la_SOURCES = gvrender.c gvlayout.c gvdevice.c gvloadimage.c \
gvcontext.c gvjobs.c gvevent.c gvplugin.c gvconfig.c \
- gvtextlayout.c gvusershape.c gvc.c
+ gvtextlayout.c gvusershape.c gvc.c regex_win32.c
libgvc_C_la_LIBADD = \
$(top_builddir)/lib/pack/libpack_C.la \
$(top_builddir)/lib/xdot/libxdot_C.la \
diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c
index dc3d578..bb54361 100644
--- a/lib/gvc/gvconfig.c
+++ b/lib/gvc/gvconfig.c
@@ -40,7 +40,7 @@ typedef struct {
static void globfree (glob_t* pglob);
static int glob (GVC_t * gvc, char*, int, int (*errfunc)(const char *, int), glob_t*);
#else
-#include <regex.h>
+#include <regex_win32.h>
#include <glob.h>
#endif
#include <sys/stat.h>
diff --git a/lib/gvc/regex_win32.c b/lib/gvc/regex_win32.c
index fdf7817..2d07c7d 100644
--- a/lib/gvc/regex_win32.c
+++ b/lib/gvc/regex_win32.c
@@ -3645,19 +3645,19 @@ re_search_2(struct re_pattern_buffer *bufp,
/* Free everything we malloc. */
#ifdef MATCH_MAY_ALLOCATE
-#define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
+#define FREE_VAR(variable) if (variable) REGEX_FREE (variable); (variable) = NULL
#define FREE_VARIABLES() \
do { \
REGEX_FREE_STACK (fail_stack.stack); \
- FREE_VAR ((void*) regstart); \
- FREE_VAR ((void*) regend); \
- FREE_VAR ((void*) old_regstart); \
- FREE_VAR ((void*) old_regend); \
- FREE_VAR ((void*) best_regstart); \
- FREE_VAR ((void*) best_regend); \
- FREE_VAR ((void*) reg_info); \
- FREE_VAR ((void*) reg_dummy); \
- FREE_VAR ((void*) reg_info_dummy); \
+ FREE_VAR (regstart); \
+ FREE_VAR (regend); \
+ FREE_VAR (old_regstart); \
+ FREE_VAR (old_regend); \
+ FREE_VAR (best_regstart); \
+ FREE_VAR (best_regend); \
+ FREE_VAR (reg_info); \
+ FREE_VAR (reg_dummy); \
+ FREE_VAR (reg_info_dummy); \
} while (0)
#else
#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
diff --git a/lib/gvpr/gprstate.c b/lib/gvpr/gprstate.c
index fb69581..d8c1323 100644
--- a/lib/gvpr/gprstate.c
+++ b/lib/gvpr/gprstate.c
@@ -18,8 +18,8 @@
*/
#ifdef WIN32
-#include "windows.h"
-#include "Shlwapi.h"
+//#include "windows.h"
+//#include "Shlwapi.h"
#endif
#include <gprstate.h>
diff --git a/lib/sfio/sfio.h b/lib/sfio/sfio.h
index 2945f6e..b3ba46e 100644
--- a/lib/sfio/sfio.h
+++ b/lib/sfio/sfio.h
@@ -289,14 +289,6 @@ extern "C" {
extern Sfio_t _Sfstderr;
#undef extern
-#if _DLL && _DLL_INDIRECT_DATA
-/* The Uwin shared library environment requires these to be defined
- in a global structure set up by the Uwin start-up procedure.
-*/
-#define sfstdin ((Sfio_t*)_ast_dll->_ast_stdin)
-#define sfstdout ((Sfio_t*)_ast_dll->_ast_stdout)
-#define sfstderr ((Sfio_t*)_ast_dll->_ast_stderr)
-#endif
#if _BLD_sfio && defined(__EXPORT__)
#define extern __EXPORT__
diff --git a/lib/vmalloc/malloc.c b/lib/vmalloc/malloc.c
index 86f335b..d2c8454 100644
--- a/lib/vmalloc/malloc.c
+++ b/lib/vmalloc/malloc.c
@@ -377,7 +377,7 @@ int value;
}
#endif
-#if _lib_mallinfo
+/*#if _lib_mallinfo
#if __STD_C
struct mallinfo mallinfo(void)
#else
@@ -397,7 +397,7 @@ struct mallinfo mallinfo()
}
return mi;
}
-#endif
+#endif*/
#if _lib_mstats
#if __STD_C
CCLD dot_static.exe
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(neatosplines.o): In function `splineEdges':
/home/rush/Programowanie/graphviz.git/lib/neatogen/neatosplines.c:671: undefined reference to `_imp__Dtoset'
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(constraint.o): In function `constrainX':
/home/rush/Programowanie/graphviz.git/lib/neatogen/constraint.c:516: undefined reference to `_imp__Dtobag'
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(constraint.o): In function `constrainY':
/home/rush/Programowanie/graphviz.git/lib/neatogen/constraint.c:554: undefined reference to `_imp__Dtobag'
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(grid.o): In function `mkGrid':
/home/rush/Programowanie/graphviz.git/lib/fdpgen/grid.c:174: undefined reference to `_imp__Dtoset'
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(edgelist.o): In function `init_edgelist':
/home/rush/Programowanie/graphviz.git/lib/circogen/edgelist.c:56: undefined reference to `_imp__Dtoset'
../../plugin/neato_layout/.libs/libgvplugin_neato_layout_C.a(deglist.o): In function `mkDeglist':
/home/rush/Programowanie/graphviz.git/lib/circogen/deglist.c:67: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `map_label':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:644: undefined reference to `_imp__rect2poly'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `check_control_points':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:711: undefined reference to `_imp__ptToLine2'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `map_point':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:292: undefined reference to `_imp__rect2poly'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `emit_map_rect':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:619: undefined reference to `_imp__rect2poly'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `emit_once':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:3556: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(emit.o): In function `emit_page':
/home/rush/Programowanie/graphviz.git/lib/common/emit.c:3437: undefined reference to `_imp__rect2poly'
../../lib/gvc/.libs/libgvc_C.a(utils.o): In function `overlap_bezier':
/home/rush/Programowanie/graphviz.git/lib/common/utils.c:1757: undefined reference to `_imp__lineToBox'
../../lib/gvc/.libs/libgvc_C.a(utils.o): In function `mkClustMap':
/home/rush/Programowanie/graphviz.git/lib/common/utils.c:2159: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(utils.o): In function `processClusterEdges':
/home/rush/Programowanie/graphviz.git/lib/common/utils.c:1260: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(postproc.o): In function `map_point':
/home/rush/Programowanie/graphviz.git/lib/common/postproc.c:84: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `star_inside':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:3874: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `epsf_inside':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:3769: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `record_inside':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:3549: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `point_inside':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:2984: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o):/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:2232: more undefined references to `_imp__ccwrotatepf' follow
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `compassPoint':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:2442: undefined reference to `_imp__cwrotatepf'
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:2451: undefined reference to `_imp__ccwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `compassPort':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:2639: undefined reference to `_imp__cwrotatepf'
../../lib/gvc/.libs/libgvc_C.a(shapes.o): In function `record_path':
/home/rush/Programowanie/graphviz.git/lib/common/shapes.c:3587: undefined reference to `_imp__flip_rec_boxf'
../../lib/gvc/.libs/libgvc_C.a(ortho.o): In function `addChan':
/home/rush/Programowanie/graphviz.git/lib/ortho/ortho.c:332: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(ortho.o): In function `extractHChans':
/home/rush/Programowanie/graphviz.git/lib/ortho/ortho.c:343: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(ortho.o): In function `extractVChans':
/home/rush/Programowanie/graphviz.git/lib/ortho/ortho.c:380: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(pointset.o): In function `newPS':
/home/rush/Programowanie/graphviz.git/lib/common/pointset.c:65: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(pointset.o): In function `newPM':
/home/rush/Programowanie/graphviz.git/lib/common/pointset.c:172: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(psusershape.o):/home/rush/Programowanie/graphviz.git/lib/common/psusershape.c:54: more undefined references to `_imp__Dtoset' follow
../../lib/gvc/.libs/libgvc_C.a(gvusershape.o): In function `gvusershape_open':
/home/rush/Programowanie/graphviz.git/lib/gvc/gvusershape.c:598: undefined reference to `_imp__Dttree'
../../lib/gvc/.libs/libgvc_C.a(xlabels.o): In function `xlnew':
/home/rush/Programowanie/graphviz.git/lib/label/xlabels.c:47: undefined reference to `_imp__Dtobag'
../../lib/gvc/.libs/libgvc_C.a(maze.o): In function `mkMazeGraph':
/home/rush/Programowanie/graphviz.git/lib/ortho/maze.c:328: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(intset.o): In function `openIntSet':
/home/rush/Programowanie/graphviz.git/lib/common/intset.c:59: undefined reference to `_imp__Dtoset'
../../lib/gvc/.libs/libgvc_C.a(htmlparse.o): In function `htmlparse':
/home/rush/Programowanie/graphviz.git/lib/common/../../lib/common/htmlparse.y:538: undefined reference to `_imp__Dtqueue'
../../lib/gvc/.libs/libgvc_C.a(htmlparse.o): In function `addRow':
/home/rush/Programowanie/graphviz.git/lib/common/../../lib/common/htmlparse.y:276: undefined reference to `_imp__Dtqueue'
../../lib/gvc/.libs/libgvc_C.a(htmlparse.o): In function `parseHTML':
/home/rush/Programowanie/graphviz.git/lib/common/../../lib/common/htmlparse.y:615: undefined reference to `_imp__Dtqueue'
../../lib/cgraph/.libs/libcgraph_C.a(graph.o): In function `agopen1':
/home/rush/Programowanie/graphviz.git/lib/cgraph/graph.c:73: undefined reference to `_imp__Dttree'
../../lib/cgraph/.libs/libcgraph_C.a(attr.o): In function `agmakedatadict':
/home/rush/Programowanie/graphviz.git/lib/cgraph/attr.c:111: undefined reference to `_imp__Dttree'
../../lib/cgraph/.libs/libcgraph_C.a(refstr.o): In function `refdict':
/home/rush/Programowanie/graphviz.git/lib/cgraph/refstr.c:62: undefined reference to `_imp__Dttree'
../../lib/cgraph/.libs/libcgraph_C.a(imap.o): In function `aginternalmapinsert':
/home/rush/Programowanie/graphviz.git/lib/cgraph/imap.c:113: undefined reference to `_imp__Dttree'
/home/rush/Programowanie/graphviz.git/lib/cgraph/imap.c:110: undefined reference to `_imp__Dttree'
../../lib/cgraph/.libs/libcgraph_C.a(pend.o):/home/rush/Programowanie/graphviz.git/lib/cgraph/pend.c:128: more undefined references to `_imp__Dttree' follow
To clarify: I am using openSUSE 13.1 with mingw environment from repository http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_13.1/
We're not that familiar with mingw. At times we used UWIN which makes more of an attempt at POSIX compliance and transparency for porting source code. It is not that surprising if sfio breaks when brought over to mingw as it is a stdio replacement and lives close to the operating system interface.
My recollection may be incomplete but I believe we need sfio for Glenn Fowler's libexpr, that we use extensively in gvpr and fdp to evaluate C-like symbolic expressions. I believe libexpr uses the capability of sfio to push strings back into an I/O channel. I don't believe stdio has anything like this. Therefore, you can patch the code to try to get rid of sfio, but you'll hit a dead end somewhere.
If you search you will find other remarks in mailing lists about building graphviz under mingw. The general idea seems to be to build only the minimal set of libraries and commands for what you need to do (this was in the contest of the R Graphviz package, which apparently does not need a large set of renderers or external shape loaders).
Stephen North
You do not want to tweak all of the code that uses sfio; it won't work. This is obviously some type of strange compiler quirk. I can build graphviz fine under mingw. I also used your compiler flags and still compiled sfio.
One workaround is what Stephen suggested: sfio is not used in any of the main layout programs. If you don't plan to use gvpr or smyrna, you can tweak the Makefiles in lib and cmd to not build vmalloc, sfio, ast, expr, gvpr and smyrna.
I also not that if you google "error: operator '&&' has no left operand", the problem has occurred in another contexts involving gcc. These may suggest a solution. Or you can run gcc -E to see if this is really a preprocessor problem. You can also try stripping away code until you find a minimal example.
Thanks for all the tips. Unfortunately I am not getting anywhere. I have even managed to compile dot
using CMake (build system which I can comprehend) and compiled for Linux it works but for Windows it crashes immediately ...
@emdenrg Are you using mingw-64 on Linux or some different version/configuration?
On Mar 30, 2014, at 7:41 PM, Damian Kaczmarek notifications@github.com wrote:
Thanks for all the tips. Unfortunately I am not getting anywhere. I have even managed to compile dot using CMake (build system which I can comprehend) and compiled for Linux it works but for Windows it crashes immediately ...
@emdenrg Are you using mingw-64 on Linux or some different version/configuration?
— Reply to this email directly or view it on GitHub.
It is possible that getting Graphviz to run under mingw will require understanding the correct definition of the DLL macro stuff to import/export external symbols, beyond just getting the code to compile and link.
If the executable crashes when starting up, one might hazard a guess that there are missing symbols and some library can’t be found at load time. It might be worthwhile to inspect the executable with objdump. Better, there is there a mingw-gdb.
There could be problems not specific to Graphviz; see
http://stackoverflow.com/questions/14368482/mingw-compiled-programs-crash-on-64-bit-windows
One might also compare the instructions found in http://www.mingw.org/wiki/HOWTO about
using external libraries, and compare with whatever configure/make are giving you.
You might start with a minimal program like “nop” or “gc” that just read and write graphs without the elaborate driver machinery.
Stephen North
To be honest, I can't recall which version of mingw that I installed, but it was probably pretty vanilla at the time. I am sorry that the problem is worse than just compiling sfio. As Stephen says, you might just start with a program that just reads and writes a graph with no layout, to see if that works. You might also want to post on the Graphviz mailing list. We're not that familiar with mingw, but others have build Graphviz using it.
I think I found a way to have a universal environment for MinGW build testing.
cd /path/to/lots/of/storage/
git clone https://github.com/mxe/mxe
cd mxe
# at this moment the MXE_TARGETS in Makefile should be changed from .static to .shared
make librsvg pthreads libgnurx # this pulls other dependencies like cairo etc.
# wait some time until all is build ....
cd /path/to/graphviz
./configure --host=i686-pc-mingw32.shared
make
Alternative build could be done by specifying i686-w64-mingw32.shared
in the MXE_TARGETS and building with ./configure --host=i686-w64-mingw32.shared
. Both are kind of different ...but both failing
Maybe this requires an approach of fixing problems one by one. :-)
Using latest master and using MXE with packages librsvg pthreads libgnurx (which should be 100% reproducible on your PC) - described how to install in above post
./configure --host=i686-w64-mingw32.shared
http://x.rushbase.net/54cf836bada7d9dd95756736db06c9a2b67b956c/config.log
I got output:
graph.c:276:10: warning: 'Agdirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
Agdesc_t Agdirected = { 1, 0, 0, 1 };
^
graph.c:277:10: warning: 'Agstrictdirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
Agdesc_t Agstrictdirected = { 1, 1, 0, 1 };
^
graph.c:278:10: warning: 'Agundirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
Agdesc_t Agundirected = { 0, 0, 0, 1 };
^
graph.c:279:10: warning: 'Agstrictundirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
Agdesc_t Agstrictundirected = { 0, 1, 0, 1 };
^
graph.c:281:10: warning: 'AgDefaultDisc' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
Agdisc_t AgDefaultDisc = { &AgMemDisc, &AgIdDisc, &AgIoDisc };
^
graph.c:281:1: error: initializer element is not constant
Agdisc_t AgDefaultDisc = { &AgMemDisc, &AgIdDisc, &AgIoDisc };
^
graph.c:281:1: error: (near initialization for 'AgDefaultDisc.mem')
graph.c:281:1: error: initializer element is not constant
graph.c:281:1: error: (near initialization for 'AgDefaultDisc.id')
graph.c:281:1: error: initializer element is not constant
graph.c:281:1: error: (near initialization for 'AgDefaultDisc.io')
My impression Damian is that if you really want to get this to work, you're going to have to take some time to actually understand what's going on, and figure out how to get the right definitions for macros that involve DLLs. The whole thing is tricky because mingw has some aspects of native Windows and some aspects of Unix and this is likely to confuse the configure scripts. You might be able to crib some definitions from the UWIN version of Graphviz. I doubt anyone is more motivated than you are at this moment so it's probably up to you tackle the problem. Stephen North
On Apr 3, 2014, at 7:18 AM, Damian Kaczmarek notifications@github.com wrote:
Maybe this requires an approach of fixing problems one by one. :-)
Using latest master and using MXE with packages librsvg pthreads libgnurx (which should be 100% reproducible on your PC) - described how to install in above post
./configure --host=i686-w64-mingw32.shared http://x.rushbase.net/54cf836bada7d9dd95756736db06c9a2b67b956c/config.log I got output:
graph.c:276:10: warning: 'Agdirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] Agdesc_t Agdirected = { 1, 0, 0, 1 }; ^ graph.c:277:10: warning: 'Agstrictdirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] Agdesc_t Agstrictdirected = { 1, 1, 0, 1 }; ^ graph.c:278:10: warning: 'Agundirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] Agdesc_t Agundirected = { 0, 0, 0, 1 }; ^ graph.c:279:10: warning: 'Agstrictundirected' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] Agdesc_t Agstrictundirected = { 0, 1, 0, 1 }; ^ graph.c:281:10: warning: 'AgDefaultDisc' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] Agdisc_t AgDefaultDisc = { &AgMemDisc, &AgIdDisc, &AgIoDisc }; ^ graph.c:281:1: error: initializer element is not constant Agdisc_t AgDefaultDisc = { &AgMemDisc, &AgIdDisc, &AgIoDisc }; ^ graph.c:281:1: error: (near initialization for 'AgDefaultDisc.mem') graph.c:281:1: error: initializer element is not constant graph.c:281:1: error: (near initialization for 'AgDefaultDisc.id') graph.c:281:1: error: initializer element is not constant graph.c:281:1: error: (near initialization for 'AgDefaultDisc.io') — Reply to this email directly or view it on GitHub.
I found some CMake files from 2 years go that build Graphviz library. I am working on them and fixing all sorts of dllimport / dllexport issues ... getting a bit more understanding what sort of mess this is. I gave up hope on autotools, tool of the devil. :) When working with CMake I can actually debug what is going on. When dot.exe works I hope to rebase that work on latest master and possibly work from there ... maybe it could be cleaned up for inclusion even.
@Rush did you ever find a resolution for the error: initializer element is not constant
?
This is the key graph.c:281:10: warning: 'AgDefaultDisc' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
. I initially started manually patching cases where dllimport/dllexport
was badly set... Eventually I ended up building a fully static build of dot.exe ... I don't believe I recall my exact steps. I could try looking my disk for a build directory and zip it up.
Oh wow, thanks for the immediate reply. https://github.com/tkelman/graphviz/commit/6fc3f4c532c7722d718a422dbf306fcb59836e8d fixes that first one, now I'm seeing the no left operand
error in sfio. I'll keep digging into it, and give some of your other patches here a try.
Static build is a no brainer fix for those dllimport and dllexport errors but also you'll probably encounter multiple definition errors by compiling this way. There is another no-brainer fix for it, add linker flag -Wl,--allow-multiple-definition
. Compiling everything with -flto
might also "fix" the whole build. I feel kinda bad not sending patches to graphiz but I felt totally lost on which "windows stuff" was proper, fixing MinGW builds upstream looked like a very long endeavour. There was a lot of Microsoft related stuff as I recall I was clueless how to handle. :( Good luck with your fixed.
I'm aiming for a dll here. Gradually making progress with similar patches to yours, see https://github.com/tkelman/graphviz/compare/patch-1. Turns out _DLL
is defined by MSVC when you compile with either /MD
or /MDd
, ref http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx. So I can add CFLAGS=-D_DLL
to my configure
call and resolve the error: operator '&&' has no left operand
.
Here is my config.log: http://x.rushbase.net/53b5e3a857ed75506806af16ce9a63501396abbd/config.log
Here is my configure line:
./configure --host=i686-w64-mingw32 --enable-shared --disable-static
Everything seems to detected properly:
It seems that sfio seems to be inherently Unix-based .. but I may be mistaken, please advise. I tried following http://www.graphviz.org/doc/winbuild.html but it seems to be more confusing than helpful as all the extra switches should not be necessary with properly configured pkg-config and cross-compilation environment. I believe my environment is proper.
Regards, Damian