haxeui / hxWidgets

Haxe externs (and wrappers) for wxWidgets
MIT License
77 stars 22 forks source link

Some error with ssize_t #55

Closed JeremyGiner closed 5 years ago

JeremyGiner commented 5 years ago

I'm trying to compile a simple test program using dlls with cygwin and gcc and i get the following error :

Error: Error while running command env g++ "-IC:/workspace/haxe_test/New Project/build_cpp/obj/cygwin64/pch/haxe" -Iinclude -IC:\cygwin64\lib\gcc720_dll\include -IC:\cygwin64\lib\gcc720_dll\lib\vc_dll\mswu -IC:/HaxeToolkit/haxe/lib/hxWidgets/1,0,0..\include -DUNICODE -D_UNICODE -DwxMSVC_VERISON_AUTO -DWIN32 -DWXMSW -DWX__=1 -DWXUSINGDLL -c -O2 -DHX_LINUX -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=331 -m64 -IC:/HaxeToolkit/haxe/lib/hxcpp/4,0,4/include -c -DwxUSE_LIBMSPACK -O2 -DHX_LINUX -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=331 -m64 -IC:/HaxeToolkit/haxe/lib/hxcpp/4,0,4/include -x c++ -frtti -frtti ./src/wx/widgets/_FontWeight/FontWeightImpl.cpp "-oC:/workspace/haxe_test/New Project/build_cpp/obj/cygwin64/1fa3da40_FontWeightImpl.o"

In file included from /usr/lib/gcc720_dll/include/wx/defs.h:846:0, from /usr/lib/gcc720_dll/include/wx/font.h:18, from include/wx/widgets/_FontWeight/FontWeightImpl.h:11, from ./src/wx/widgets/_FontWeight/FontWeightImpl.cpp:5: /usr/lib/gcc720_dll/include/wx/types.h:347:25: error: conflicting declaration 'typedef wxInt64 ssize_t' typedef wxInt64 ssize_t; ^~~ In file included from /usr/include/sys/unistd.h:12:0, from /usr/include/unistd.h:4, from C:/HaxeToolkit/haxe/lib/hxcpp/4,0,4/include/hxcpp.h:56: /usr/include/sys/types.h:200:18: note: previous declaration as 'typedef _ssize_t ssize_t' typedef _ssize_t ssize_t; ^~~

I'm not really good with c++ stuff but it seems like hxcpp and wxWidget doesn't like each other. Any idea on what would be the problem?

ianharrigan commented 5 years ago

Hmm, what version of haxe, hxcpp, wx? Also, can you zip up the test app? Does this work with VC++? (ive never tried with gcc on windows but worked on OSX / linux)

JeremyGiner commented 5 years ago

haxe 3.4.0 hxcpp (Haxe C++ Runtime Support) (4.0.4) wxWidgets 3.1.1

Main.hx :

package;

import hx.widgets.*;

class Main {
    public static function main() {
        var app = new App();
        app.init();

        var frame:Frame = new Frame(null, "hxWidgets");

        var taskBarIcon = new TaskBarIcon();
        taskBarIcon.setBitmap(Bitmap.fromHaxeResource("haxe-logo-tiny.png"), "Some tooltip");

        var platform:PlatformInfo  = new PlatformInfo();
        if (platform.isWindows) {
            frame.backgroundColour = 0xFFFFFF;
        }

        //frame.menuBar = buildMenu();
        frame.sizer = new BoxSizer(Orientation.VERTICAL);
        frame.resize(800, 600);

        var imageList:ImageList = new ImageList(16, 16);
        imageList.add(Bitmap.fromHaxeResource("ui-check-boxes-series.png"));
        imageList.add(Bitmap.fromHaxeResource("layer-shape-line.png"));
        imageList.add(Bitmap.fromHaxeResource("ui-scroll-pane-list.png"));
        imageList.add(Bitmap.fromHaxeResource("information-button.png"));
        imageList.add(Bitmap.fromHaxeResource("application-dialog.png"));
        imageList.add(Bitmap.fromHaxeResource("globe-green.png"));

        var tabs:Notebook = new Notebook(frame);
        if (platform.isMac) {
            tabs.allowIcons = false;
        }
        if (platform.isWindows) {
            tabs.padding = new Size(6, 6);
        }
        tabs.imageList = imageList;

        frame.sizer.add(tabs, 3, Stretch.EXPAND | Direction.ALL, 10);

        frame.sizer.addSpacer(5);

        frame.layout();
        frame.show();

        app.run();
    app.exit();
    }
}

Build.hxml :

_______________________________________________________________________________
# Test compilation

#-lib openfl
#-lib lime
-lib hxWidgets

#-lib haxeui-hxwidget
#-lib haxeui-core

# Select directory
-cp src

# java target
#-java build_java
-cpp build_cpp

#-D no-compilation
-D cygwin
-D windows
-D HXCPP_VERBOSE=1
-D HXCPP_M64
-D WXWIN=C:\cygwin64\lib\gcc720_dll

-main Main

I don't know about VC++

JeremyGiner commented 5 years ago

My .hxcpp_config is quite wierd, i kind of copy-pasted bits of code from everywhere trying to fix some other errors i was having. I assume that if the error come from somewhere it might come from this config.

.hxcpp_config :

<xml>

  <!-- This section is parses at the beginning of the build .... -->
  <section id="vars">

     <set name="toolchain" value="cygwin"/>
     <set name="HXCPP_M64" value="1"/>
     <set name="SDK_ROOT" value="c:\SDKs\" unless="SDK_ROOT" if="windows" />
     <set name="SDK_ROOT" value="${HOME}/SDKs/" unless="SDK_ROOT" />
     <set name="ANDROID_NDK_DIR" value="${SDK_ROOT}" unless="ANDROID_NDK_DIR" />
     <set name="ANT_HOME" value="${SDK_ROOT}/ant" unless="ANT_HOME" />
     <set name="ANDROID_SDK" value="${SDK_ROOT}/android-sdk" unless="ANDROID_SDK" />
     <set name="JAVA_HOME" value="${SDK_ROOT}/java_jdk" unless="JAVA_HOME" />

  </section>

  <!-- Use this section to add flags to the compilers and linkers -->
  <section id="exes">
<compiler id="cygwin" exe="env g++" if="windows">
  <flag value="-c"/>
  <flag value="-DwxUSE_LIBMSPACK"/><!-- wxWidget stuff -->
  <cppflag value="-frtti"/>
  <flag value="-g" if="debug"/>
  <flag value="-O2" unless="debug"/>
  <flag value="-DHX_LINUX"/>
  <flag value="-DHXCPP_BIG_ENDIAN" if="HXCPP_BIG_ENDIAN"/>
  <include name="toolchain/common-defines.xml" />
  <flag value="-m32" unless="HXCPP_M64"/>
  <flag value="-m64" if="HXCPP_M64"/>
  <flag value="-I${HXCPP}/include"/>
  <objdir value="obj/cygwin${OBJEXT}/"/>
  <outflag value="-o"/>
  <ext value=".o"/>
</compiler>

<linker id="dll" exe="env g++" if="windows">
  <flag value="-shared"/>
  <flag value="-m32" unless="HXCPP_M64"/>
  <flag value="-m64" if="HXCPP_M64"/>
  <flag value="-W,l--unresolved-symbols=report-all"/>
  <flag value="-Xlinker"/>
  <flag value="--no-undefined"/>
  <flag value="-debug" if="debug"/>
  <lib name="-ldl"/>
  <ext value=".dso"/>
  <outflag value="-o "/>
</linker>

<linker id="exe" exe="env g++" if="windows">
  <flag value="-debug" if="debug"/>
  <flag value="-m32" unless="HXCPP_M64"/>
  <flag value="-m64" if="HXCPP_M64"/>
  <flag value="-mwindows" if="SUBSYSTEMWINDOWS" />
  <lib name="-ldl"/>
  <ext value=".exe"/>
  <outflag value="-o "/>
</linker>

  </section>

</xml>
ianharrigan commented 5 years ago

have you tried to compile this: https://github.com/haxeui/hxWidgets/tree/master/samples/00-Showcase

IIRC correct this compiles fine via the .hxml files on all OS's i tested.

JeremyGiner commented 5 years ago

Try to compile the project as is, it gave me the "no compiler define for target" which i fixed by adding my usual flag : -D cygwin -D windows -D HXCPP_VERBOSE=1 -D HXCPP_M64 -D WXWIN=C:\cygwin64\lib\gcc720_dll

And then it asked for a missing wx/setup.h file, which apparently a "master" copy exist in include/wx/msw/wx/setup.h so i just copied the file to include/wx. And now i have the error : #error "This file should only be included when using Microsoft Visual C++"

I'm just going to give up this is not worth the effort. My config of hxcpp is most likely the source of all that, so i'm just going to close the issue, thank for your help anyway.

ianharrigan commented 5 years ago

How come you dont want to use MSVC on windows? Also, how did you install haxe under cygwin? I presume you are using the cygwin terminal? Have you tried http://tdm-gcc.tdragon.net/ (ie, just gcc withut the cygwin env)?

Main problem is its hard to know how your system(s) are setup so hard to reproduce.

Ian