How to compile and install ad-block with vs2017?


#1

Hi I’m new developper of brave but meet some problems of installtion.

Env: I’ve installed node.js npm version:5.5.1
os: win7 x64 vs2017
python 2.7.13
env variables is set.

after clone the brave code using npm install to compile, the brave project compiled sucessfully.
But when npm start the project it tell me that can not find module ‘ad-block’. output:

brave@0.21.0 start F:\prj\cppprj\brave\browser-laptop
node ./tools/start.js --user-data-dir-name=brave-development --enable-logging
–v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck


#2

App threw an error during load
Error: Cannot find module 'ad-block’
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (F:\prj\cppprj\brave\browser-laptop\node
_modules_electron@1.7.9@electron\dist\resources\electron.asar\common\reset-sear
ch-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (F:\prj\cppprj\brave\browser-laptop\app\adBlock.js:8:4
9)
at Object. (F:\prj\cppprj\brave\browser-laptop\app\adBlock.js:124
:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
An uncaught exception occurred in the main process Uncaught Exception:


#3

when after tring to install npm it failed.

  1. i tried using “npm install ad-block” under brave “browser-leptop” directory, it failed.
    BloomFilter.cpp
    hashFn.cpp
    HashSet.cpp
    win_delay_load_hook.cc

#7
  1. I also tried using source code to install adblock. after cloning the ad-block src code.
    run npm install , it automatic do something and compile some source code, but fianally failed, the output mesage is same with above.

    then i try to open build/ad-block.vcxproj using vs2017 IDE env, and compile the project, the result is same as above.


#9

the first Error is addon dot cc 28 : and not covert overloaded-function to node dot addon_register_func


#10

ifdef AD_BLOCK_INTERNAL_MODULE
NODE_MODULE_CONTEXT_AWARE_BUILTIN(ad_block, InitAll)
else
NODE_MODULE(ad_block, InitAll) // line 28
endif

the second error is the same line(line28 above ) cannot convert from const char [9] to node.addon_context_register_func

my question is :
how to install ad-block ?. Is there any problem under vs2017? how to fix it ?
Is there a way to run brave without ad-block without the problem?
thanks.


#11

I 've found the reason!

dot cc is recogonized as links !!!
could you plz change the system setting ? or change cpp source file to dot cpp ?


#12

To post a code snippet, please wrap it with <code>. thanks.


#13

@mok please avoid creating multiple posts on the same topic :slight_smile:

Hi I'm new developper of brave but meet some problems of installtion.

Env: I've installed node.js  npm version:5.5.1
os: win7 x64   vs2017
python 2.7.13

after clone the brave code using npm install to compile, the brave project compiled sucessfully.
But when npm start  the project  it tell me that can not find module 'ad-block'. output:
> brave@0.21.0 start F:\prj\cppprj\brave\browser-laptop
> node ./tools/start.js --user-data-dir-name=brave-development --enable-logging
--v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dche
ck


App threw an error during load
Error: Cannot find module 'ad-block'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (F:\prj\cppprj\brave\browser-laptop\node
_modules\_electron@1.7.9@electron\dist\resources\electron.asar\common\reset-sear
ch-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (F:\prj\cppprj\brave\browser-laptop\app\adBlock.js:8:4
9)
    at Object.<anonymous> (F:\prj\cppprj\brave\browser-laptop\app\adBlock.js:124
:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
An uncaught exception occurred in the main process Uncaught Exception:



when after tring to install npm it failed.
1. i tried using "npm install ad-block" under brave "browser-leptop" directory, it failed.
  BloomFilter.cpp
  hashFn.cpp
  HashSet.cpp
  win_delay_load_hookdot cc
..\addondot cc(28): error C2440: “类型转换”: 无法从“overloaded-function”转换为
“node::addon_r
egister_func” [F:\prj\cppprj\brave\ad-block\build\ad-block.vcxproj]
  ..\addondot cc(28): note: 在匹配目标类型的范围内没有具有该名称的函数
..\addondot cc(28): error C2440: “初始化”: 无法从“const char [9]”转换为“node::
addon_context
_register_func” [F:\prj\cppprj\brave\ad-block\build\ad-block.vcxproj]
     The output is same with following. it contains some non-english character, I'll explain it later.
2. I also tried using source code to install adblock. after cloning the ad-block src code.
   run  npm install , it automatic do something and compile some source code, but fianally failed:
  win_delay_load_hookdot cc
..\addondot cc(28): error C2440: “类型转换”: 无法从“overloaded-function”转换为“node::addon_register_func” [F:\prj\cppprj\brave\ad-block\build\ad-block.vcxproj]
  ..\addondot cc(28): note: 在匹配目标类型的范围内没有具有该名称的函数
..\addondot cc(28): error C2440: “初始化”: 无法从“const char [9]”转换为“node::addon_context_register_func” [F:\prj\cppprj\brave\ad-block\build\ad-block.vcxproj]  ..\addondot cc(28): note: 没有使该转换得以执行的上下文

   then i try to open  build/ad-block.vcxproj  using vs2017 IDE env, and compile the project, the result is same as above. 
   the first Error is   ..\addondot cc(28):  and not covert "overloaded-function"  to “node::addon_register_func”

<code>
#ifdef AD_BLOCK_INTERNAL_MODULE
NODE_MODULE_CONTEXT_AWARE_BUILTIN(ad_block, InitAll)
#else
NODE_MODULE(ad_block, InitAll)             // line 28
#endif
</code>

the second error is the same line(line28 above )  cannot  convert from “const char [9]” to “node::addon_context_register_func” 


my question is : 
how to install ad-block ?.  Is there any problem under vs2017?  how to fix it ?
Is there a way to  run brave without ad-block  without the problem? 
thanks.

Have you tried https://github.com/brave/browser-laptop/wiki/(setup)-Windows-build-guide already?

@brian or @clifton would help you out :+1: Since @alex speaks Chinese, he could as well :cn:


#15

are they online ? when will they can reply ?
My two posts seems are hidden.
I have to post this by devide content to several parts to avoid being recognized as links.
If possible I’d like to delete this post and keep another.
Could you plz turn off link recognization of “dot cc” because ad-block project is written by cplusplus?


#16

Please do not divide the post into several ones. Instead wrap it with 4 backtick quotes (````) to display it as a code block.

https://daringfireball.net/projects/markdown/syntax#code

Thanks!


#17

no reply at all.
any suggestion ?


#18

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.