[lttng-dev] Status of MinGW support for babeltrace (either 1.x or 2.x)

Jonah Graham jonah at kichwacoders.com
Fri Aug 18 11:01:07 UTC 2017


Hi Michael,

Your port-staging branch was very useful, as you expected, it worked
much better than current master. There are numerous make check
failures that I don't get on Linux, I have attached the log in the
hope that is helpful.

I did have one build problem which I don't know how to fix properly,
so I provide the problem and workaround I used.

Using commit bf428c782eb16a511be6abf2bb3f17385b872fec I got this error:
Making all in cli
make[1]: Entering directory '/d/tracecompass/git/babeltrace/cli'
  CCLD     babeltrace.exe
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0x420): undefined
reference to `libiconv'
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0x92c): undefined
reference to `libiconv_open'
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0xaa3): undefined
reference to `libiconv_open'
C:/msys64/mingw64/lib\libintl.a(relocatable.o):(.text+0x46): undefined
reference to `libiconv_set_relocation_prefix'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:621: babeltrace.exe] Error 1

The expanded command/error:
$ make -C cli V=1
make: Entering directory '/d/tracecompass/git/babeltrace/cli'
/bin/sh ../libtool  --tag=CC   --mode=link gcc -pthread -Wall -Wformat
-pthread -mms-bitfields -I/mingw64/include/glib-2.0
-I/mingw64/lib/glib-2.0/include -I/mingw64/include
-DBT_SET_DEFAULT_IN_TREE_CONFIGURATION -g -O2 -Wl,--no-as-needed
--static -static-libgcc -static-libstdc++
-Wl,--start-group,-lgmodule-2.0,-lglib-2.0,-liconv,-lintl,-lrpcrt4,-lws2_32,-lwinmm,-lole32,-lpopt,-lpthread,--end-group
 -o babeltrace.exe babeltrace-babeltrace.o babeltrace-babeltrace-cfg.o
babeltrace-babeltrace-cfg-cli-args.o
babeltrace-babeltrace-cfg-cli-args-connect.o
babeltrace-babeltrace-cfg-cli-args-default.o babeltrace-logging.o
../lib/libbabeltrace.la ../compat/libcompat.la
../common/libbabeltrace-common.la ../logging/libbabeltrace-logging.la
../plugins/libctfcopytrace/libctfcopytrace.la -L/mingw64/lib -lpopt
-lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread -L/mingw64/lib
-lgmodule-2.0 -pthread -lglib-2.0 -lintl -pthread -lws2_32 -lole32
-lwinmm -lshlwapi -lpcre -lintl -lpcre
libtool: link: gcc -pthread -Wall -Wformat -pthread -mms-bitfields
-I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include
-I/mingw64/include -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION -g -O2
-Wl,--no-as-needed --static -static-libgcc -static-libstdc++
-Wl,--start-group -Wl,-lgmodule-2.0 -Wl,-lglib-2.0 -Wl,-liconv
-Wl,-lintl -Wl,-lrpcrt4 -Wl,-lws2_32 -Wl,-lwinmm -Wl,-lole32
-Wl,-lpopt -Wl,-lpthread -Wl,--end-group -o .libs/babeltrace.exe
babeltrace-babeltrace.o babeltrace-babeltrace-cfg.o
babeltrace-babeltrace-cfg-cli-args.o
babeltrace-babeltrace-cfg-cli-args-connect.o
babeltrace-babeltrace-cfg-cli-args-default.o babeltrace-logging.o
-pthread -pthread  ../lib/.libs/libbabeltrace.dll.a -L/mingw64/lib
../compat/.libs/libcompat.a ../common/.libs/libbabeltrace-common.a
../logging/.libs/libbabeltrace-logging.a
../plugins/libctfcopytrace/.libs/libctfcopytrace.a
/d/tracecompass/git/babeltrace/lib/.libs/libbabeltrace.dll.a -lpopt
-lrpcrt4 -liconv -lpthread -lgmodule-2.0 -lglib-2.0 -lws2_32 -lole32
-lwinmm -lshlwapi -lintl -lpcre -pthread
-L/d/tracecompass/babeltrace/babeltrace-port-staging/lib
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0x420): undefined
reference to `libiconv'
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0x92c): undefined
reference to `libiconv_open'
C:/msys64/mingw64/lib\libintl.a(dcigettext.o):(.text+0xaa3): undefined
reference to `libiconv_open'
C:/msys64/mingw64/lib\libintl.a(relocatable.o):(.text+0x46): undefined
reference to `libiconv_set_relocation_prefix'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:621: babeltrace.exe] Error 1
make: Leaving directory '/d/tracecompass/git/babeltrace/cli'

If I re-run the command with -liconv appended it works fine and I get
babeltrace.exe built fine. I can see that -liconv is in the
babeltrace_bin_LDFLAGS, but those LDFLAGS are appearing too early on
the command line AFAICT

If I run with LIBS= then it builds too which I didn't expect:

$ make -C cli V=1 LIBS=
make: Entering directory '/d/tracecompass/git/babeltrace/cli'
/bin/sh ../libtool  --tag=CC   --mode=link gcc -pthread -Wall -Wformat
-pthread -mms-bitfields -I/mingw64/include/glib-2.0
-I/mingw64/lib/glib-2.0/include -I/mingw64/include
-DBT_SET_DEFAULT_IN_TREE_CONFIGURATION -g -O2 -Wl,--no-as-needed
--static -static-libgcc -static-libstdc++
-Wl,--start-group,-lgmodule-2.0,-lglib-2.0,-liconv,-lintl,-lrpcrt4,-lws2_32,-lwinmm,-lole32,-lpopt,-lpthread,--end-group
 -o babeltrace.exe babeltrace-babeltrace.o babeltrace-babeltrace-cfg.o
babeltrace-babeltrace-cfg-cli-args.o
babeltrace-babeltrace-cfg-cli-args-connect.o
babeltrace-babeltrace-cfg-cli-args-default.o babeltrace-logging.o
../lib/libbabeltrace.la ../compat/libcompat.la
../common/libbabeltrace-common.la ../logging/libbabeltrace-logging.la
../plugins/libctfcopytrace/libctfcopytrace.la -L/mingw64/lib -lpopt
-lws2_32 -lrpcrt4 -lintl -liconv -lole32 -lpthread
libtool: link: gcc -pthread -Wall -Wformat -pthread -mms-bitfields
-I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include
-I/mingw64/include -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION -g -O2
-Wl,--no-as-needed --static -static-libgcc -static-libstdc++
-Wl,--start-group -Wl,-lgmodule-2.0 -Wl,-lglib-2.0 -Wl,-liconv
-Wl,-lintl -Wl,-lrpcrt4 -Wl,-lws2_32 -Wl,-lwinmm -Wl,-lole32
-Wl,-lpopt -Wl,-lpthread -Wl,--end-group -o .libs/babeltrace.exe
babeltrace-babeltrace.o babeltrace-babeltrace-cfg.o
babeltrace-babeltrace-cfg-cli-args.o
babeltrace-babeltrace-cfg-cli-args-connect.o
babeltrace-babeltrace-cfg-cli-args-default.o babeltrace-logging.o
../lib/.libs/libbabeltrace.dll.a -L/mingw64/lib
../compat/.libs/libcompat.a ../common/.libs/libbabeltrace-common.a
../logging/.libs/libbabeltrace-logging.a
../plugins/libctfcopytrace/.libs/libctfcopytrace.a
/d/tracecompass/git/babeltrace/lib/.libs/libbabeltrace.dll.a
-lgmodule-2.0 -lglib-2.0 -lwinmm -lshlwapi -lpcre -lpopt -lws2_32
-lrpcrt4 -lintl -liconv -lole32 -lpthread -pthread
-L/d/tracecompass/babeltrace/babeltrace-port-staging/lib
make: Leaving directory '/d/tracecompass/git/babeltrace/cli'


I hope the above is useful. Please let me know how I can help.

Thanks
Jonah
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 15 August 2017 at 17:34, Michael Jeanson <mjeanson at efficios.com> wrote:
> On 2017-08-15 12:12, Jonah Graham wrote:
>> Hello,
>>
>> Over the years I have seen some discussions and patches about getting
>> full MinGW support for babeltrace. I am interested in if someone can
>> provide an overview of the current state of MinGW.
>>
>> I have tried to build 1.5.3 and (probably as expected) there are
>> numerous compile issues (e.g. sys/mman.h)
>>
>> I have gotten further with current master (my primary interest is
>> libbabeltrace so the issues I have with cli/babeltrace.c and
>> tests/test_ctf_writer.c don't concern me too much yet). However when I
>> try to run a simple example (that works on Linux) it fails on
>> bt_ctf_stream_flush. I will debug further to identify the problem.
>> However If someone does have a mingw port working well any guidance on
>> building would be much appreciated.
>>
>> Thanks
>> Jonah
>
> Hi Jonah,
>
> A fully working port to Mingw is a release goal for babeltrace 2.0, as
> you may have noticed a lot of patches for Mingw compatibility have been
> merged in master in the last few weeks.
>
> You can have a look at my port-staging [1] branch but it's really a
> moving target right now.
>
> As always, patches are welcome, if you plan to work on something, don't
> hesitate to contact us on this mailing list or on oftc in the #lttng
> channel.
>
> Cheers,
>
> Michael
>
>
> [1] https://github.com/mjeanson/babeltrace/tree/port-staging
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-suite-mingw.log
Type: text/x-log
Size: 50700 bytes
Desc: not available
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20170818/ddb5eed1/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-suite-linux.log
Type: text/x-log
Size: 3692 bytes
Desc: not available
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20170818/ddb5eed1/attachment-0003.bin>


More information about the lttng-dev mailing list