Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I could't build on windows 10 #72

Open
ozerkon opened this issue Dec 19, 2020 · 1 comment
Open

I could't build on windows 10 #72

ozerkon opened this issue Dec 19, 2020 · 1 comment

Comments

@ozerkon
Copy link

ozerkon commented Dec 19, 2020

Hi, Following the instructions here I wanted to install the qtwebdriver but failed.

ozer@Lenovo MINGW64 /
$ git clone https://chromium.googlesource.com/external/gyp
Cloning into 'gyp'...
remote: Total 18491 (delta 11523), reused 18491 (delta 11523)
Receiving objects: 100% (18491/18491), 12.00 MiB | 1.10 MiB/s, done.
Resolving deltas: 100% (11523/11523), done.

ozer@Lenovo MINGW64 /
$ git clone https://github.com/cisco-open-source/qtwebdriver
Cloning into 'qtwebdriver'...
remote: Enumerating objects: 15448, done.
remote: Total 15448 (delta 0), reused 0 (delta 0), pack-reused 15448
Receiving objects: 100% (15448/15448), 144.16 MiB | 1016.00 KiB/s, done.
Resolving deltas: 100% (8949/8949), done.

ozer@Lenovo MINGW64 /
$ cd qtwebdriver

ozer@Lenovo MINGW64 /qtwebdriver (WD_1.X_dev)
$ cp qt5_sample_config.gypi wd.gypi

ozer@Lenovo MINGW64 /qtwebdriver (WD_1.X_dev)
$ cat wd.gypi
{
  'variables': {
    'QT5': '1',
    'WD_CONFIG_QWIDGET_BASE': '1',
# If Qt >= 5.6 set 'WD_CONFIG_WEBKIT' : '0'
    'WD_CONFIG_WEBKIT': '1',
    'WD_CONFIG_QUICK': '1',
    'WD_CONFIG_PLAYER': '0',
    'WD_CONFIG_ONE_KEYRELEASE': '0',
    'QT_INC_PATH': 'C:\Qt\5.15.2\mingw81_64\include',
    'QT_BIN_PATH': 'C:\Qt\5.15.2\mingw81_64\bin',
    'QT_LIB_PATH': 'C:\Qt\5.15.2\mingw81_64\lib'
  },
}

ozer@Lenovo MINGW64 /qtwebdriver (WD_1.X_dev)
$ ./build.sh ./out
Traceback (most recent call last):
  File "C:\Program Files\Git\qtwebdriver\generate_wdversion.py", line 14, in <module>
    versionfile.write("extern const char kLastChanges[] = \"" + data.strip() + "\";\n")
TypeError: can only concatenate str (not "bytes") to str
./build.sh: line 51: make: command not found

Here is the "C:\Program Files\Git\qtwebdriver\generate_wdversion.py" file


import subprocess as sp

filename = "./src/webdriver/webdriver_version.cc"
p = sp.Popen(["git", "describe" , "--abbrev=10", "--dirty", "--always"], stdin=sp.PIPE, stdout=sp.PIPE)

data = p.stdout.readline()

versionfile = open (filename, 'w')
versionfile.write("namespace webdriver {\n")
versionfile.write("extern const char kProductName[] = \"WebDriver-cisco-cmt\";\n")
versionfile.write("extern const char kVersionNumber[] = \"1.3.3\";\n")
versionfile.write("extern const char kBuildTime[] = __TIME__;\n")
versionfile.write("extern const char kBuildDate[] = __DATE__;\n")
versionfile.write("extern const char kLastChanges[] = \"" + data.strip() + "\";\n")
versionfile.write("}")
versionfile.close()

p.stdout.close()
p.stdin.close()

And here is the "C:\Program Files\Git\qtwebdriver\build.sh" file:

#!/usr/bin/env bash
output_gen=$1
platform=$2
mode=$3
qt_dir=$4

root_dir=`pwd`
if [ -z $output_gen ];
then
  output_gen=`pwd`/out
  platform="desktop"
fi

output_gen=`readlink -m ${output_gen}`
base_output_gen=`dirname ${output_gen}`

if [ -z $platform ];
then
  platforms="desktop"
else
  platforms=$platform
fi
if [ -z $mode ];
then
  modes="release"
else
  modes=$mode
fi

OUT_STATIC_LIB_FILES="libchromium_base.a libWebDriver_core.a libWebDriver_extension_qt_base.a libWebDriver_extension_qt_web.a libWebDriver_extension_qt_quick.a libWebDriver_extension_qt_quick_web.a"
OUT_SHARED_LIB_FILES="libchromium_base.so libWebDriver_core.so libWebDriver_extension_qt_base.so libWebDriver_extension_qt_web.so libWebDriver_extension_qt_quick.so libWebDriver_extension_qt_quick_web.so libAndroidWD_QML.so libAndroidWD_Widgets.so"
OUT_BIN_FILES="WebDriver WebDriver_noWebkit WebDriver_noWebkit_sharedLibs"

#generate wdversion.cc
python generate_wdversion.py

for platform in $platforms
do
  for mode in $modes
  do
    cd $root_dir

    OUTPUT_DIR=${output_gen}/$platform/$mode
    OUTPUT_DIR_OUT=${OUTPUT_DIR}/Default
    DIST_DIR=${output_gen}/dist/$platform/$mode

    gyp --depth . -G output_dir=. -D platform=$platform -D mode=$mode -D ROOT_PATH=${base_output_gen} -D QT_DIR=${qt_dir} --generator-output=${output_gen}/$platform/$mode wd.gyp
    [ $? -ne 0 ] && exit 1
    cd $OUTPUT_DIR
    [ $? -ne 0 ] && echo "**** ERROR: Can't access to $OUTPUT_DIR" && exit 1
    make
    [ $? -ne 0 ] && exit 1
    mkdir -p ${DIST_DIR}/{bin,libs,h,Test}
    [ $? -ne 0 ] && echo "**** ERROR: Can't create $DIST_DIR" && exit 1

    # copy libraries
    for file in $OUT_STATIC_LIB_FILES; do cp -f $OUTPUT_DIR_OUT/$file $DIST_DIR/libs 2>/dev/null; done
    for file in $OUT_SHARED_LIB_FILES; do cp -f $OUTPUT_DIR_OUT/lib.target/$file $DIST_DIR/libs 2>/dev/null; done

    # copy headers
    cp -rf $root_dir/inc/* $DIST_DIR/h 2>/dev/null;
    cp -rf $root_dir/src/Test $DIST_DIR 2>/dev/null;

    # copy test binaries
    for file in $OUT_BIN_FILES
    do
      if [ -f $OUTPUT_DIR_OUT/$file ]
      then
        cp -f $OUTPUT_DIR_OUT/$file $DIST_DIR/bin 2>/dev/null
      fi
    done
    
  done
done

@nefethael
Copy link

Hello,

To build on Win10, I ended up generating src/webdriver/webdriver_version.cc by hand:

namespace webdriver {
extern const char kProductName[] = "WebDriver-cisco-cmt";
extern const char kVersionNumber[] = "1.3.3";
extern const char kBuildTime[] = __TIME__;
extern const char kBuildDate[] = __DATE__;
extern const char kLastChanges[] = "whatever";
}

Then I removed python generate_wdversion.py in build.bat

After that you also need to remove some lines in src/third_party/mongoose/mongoose.c

struct timespec {
  long tv_nsec;
  long tv_sec;
};

Finally, I needed to add macro definition in generated chromium_base.vcxproj & WebDriver_core.vcxproj

<PreprocessorDefinitions>_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;......

For the moment, I only succeeded to compile on vs2019, i'll ry to use it now :)

Hope it helps,
Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants