Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

LNK1120 Errors Building Firefox

Alex_K_6
Beginner
953 Views
Using the -Qipo flag with ICC 13 Beta Update 2, I get the following errors when building Firefox (specifically the js engine, SpiderMonkey):

http://software.intel.com/file/45509

Having -Qipo- in the makefile of the js directory still brings up the error unless the flag is removed completely.
0 Kudos
15 Replies
SergeyKostrov
Valued Contributor II
953 Views
Quoting alexboy94
Using the -Qipo flag with ICC 13 Beta Update 2, I get the following errors when building Firefox (specifically the js engine, SpiderMonkey):

http://software.intel.com/file/45509

Having -Qipo- in the makefile of the js directory still brings up the error unless the flag is removed completely.


Could youre-post a complete compilationlog( C++ compiler& Linker ) in text format, please?

0 Kudos
Alex_K_6
Beginner
953 Views
Here's the build log:
0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Hi,

Quoting alexboy94
Here's the build log...


Here are results of my investigation:

1.I searched in the log file for a substring 'error C'and I found a couple of compilation errors:
...
checking for pthread_create in -lpthreads... dummy.c
dummy.c(2) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
no
checking for pthread_create in -lpthread... dummy.c
dummy.c(2) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
no
checking for pthread_create in -lc_r... dummy.c
dummy.c(2) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
no
checking for pthread_create in -lc... dummy.c
dummy.c(2) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
no
...
However, I don't think thatthese errors arerelated to your linking problem. Personally, I would look at 'dummy.c'.

2. There are lots of linker errors at the end of the log file:
...
c:/mozilla-build/python/python2.7.exe
/c/Users/Alex/Downloads/mozilla-beta/js/src/config/pythonpath.py
-I../config /c/Users/Alex/Downloads/mozilla-beta/js/src/config/expandlibs_exec.py
--uselist -- xilink -NOLOGO -OUT:js.exe -PDB:js.pdb
-MACHINE:X64 -opt:ref,icf
../../../dist/lib/mozglue.lib
-> js.obj
-> jsworkers.obj
-> jsoptparse.obj
-> jsheaptools.obj
c:/Users/Alex/Downloads/objdir/dist/lib/nspr4.lib
c:/Users/Alex/Downloads/objdir/dist/lib/plc4.lib
c:/Users/Alex/Downloads/objdir/dist/lib/plds4.lib
-> ../js_static.lib
kernel32.lib
user32.lib
gdi32.lib
winmm.lib
wsock32.lib
advapi32.lib
psapi.lib
xilink: executing 'link'
Creating library js.lib and object js.exp
js_static.lib(jsapi.obj) : error LNK2019: unresolved external symbol
-> "enum JSType __cdecl js::TypeOfValue(struct JSContext *,class JS::Value const &)"
(?TypeOfValue@js@@YA?AW4JSType@@PEAUJSContext@@AEBVValue@JS@@@Z)
-> referenced in function JS_TypeOfValue
...

First unresolved external symbol is detectedin JS_TypeOfValue function andyou need to understand what is
wrong withjs::TypeOfValue method.Whereisthe implementation? Inwhat source file?

I also marked with '->' and bolded all modules for your review.
I crossed all libraries you could ignore.

I could assume that:

some source file is missing, or
a piece of code is not included in compilation because it was #ifdef-ed improperly
( some macro was not definedor defined )

Best regards,
Sergey

0 Kudos
Alex_K_6
Beginner
953 Views
The dummy.c file can be ignored, the errors occur when compiling with MSVC as well. pthread.h is a unix file.

The only mention of TypeOfValue I can find is in:

jsapi.h:

extern JS_PUBLIC_API(JSType)
JS_TypeOfValue(JSContext *cx, jsval v);

jsapi.cpp:

JS_PUBLIC_API(JSType)
JS_TypeOfValue(JSContext *cx, jsval v)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, v);
return TypeOfValue(cx, v);
}

As for the .obj files they're generated correctly:



So why does Qipo cause this problem?
0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Quoting alexboy94
jsapi.h
jsapi.cpp
...
JS_PUBLIC_API
...

So why does Qipo cause this problem?


I don't know so far.

Could you upload 'jsapi.h', 'jsapi.cpp' and a header where a macro 'JS_PUBLIC_API' is declared, please?

0 Kudos
Alex_K_6
Beginner
953 Views
Here you go:
(Macro declarations in jstypes.h, lines 62, 65, 68 and 72)
0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Quoting alexboy94
Here you go:
(Macro declarations in jstypes.h, lines 62, 65, 68 and 72)


Ireviewed these source files and I don't see any problems. This is what I would do to verify some macros:

UPDATE #1

>> jstypes.h <<

...
/*
* The linkage of JS API functions differs depending on whether the file is
* used within the JS library or not. Any source file within the JS
* interpreter should define EXPORT_JS_API whereas any client of the library
* should not. STATIC_JS_API is used to build JS as a static library.
*/
#if defined( STATIC_JS_API )

# pragma message ( "*** Message: STATIC_JS_API defined ***" )
# define JS_PUBLIC_API(t) t
# define JS_PUBLIC_DATA(t) t

#elif defined( EXPORT_JS_API ) || defined( STATIC_EXPORTABLE_JS_API )

# pragma message ( "*** Message: EXPORT_JS_API or STATIC_EXPORTABLE_JS_APIdefined ***" )
# define JS_PUBLIC_API(t) MOZ_EXPORT_API(t)
# define JS_PUBLIC_DATA(t) MOZ_EXPORT_DATA(t)

#else

# pragma message ( "*** Message: JS API functions declared asIMPORTED ***" )
# define JS_PUBLIC_API(t) MOZ_IMPORT_API(t)
# define JS_PUBLIC_DATA(t) MOZ_IMPORT_DATA(t)

#endif
...

Please update 'jstypes.h' source file,re-build the project and submit a compilation log. Thank you.

Best regards,
Sergey

0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Please take into account that comment:

...
/*
* The linkage of JS API functions differs depending on whether the file is
* used within the JS library or not. Any source file within the JS
* interpreter should define EXPORT_JS_API whereas any client of the library
* should not. STATIC_JS_API is used to build JS as a static library.
*/
...

Since you have lots of linking problems it could be related to how JS APIis declared.

Is aSTATIC_JS_API macrodefined?
0 Kudos
Alex_K_6
Beginner
953 Views
The static js library is only linked if --disable-shared-js is defined in the mozconfig.
I enabled the shared js library (--enable-shared-js)

Build log:
log

Updated to Firefox 15 Beta 5 (the one before was Beta 4). Seems that the bug has changed, but still occurs with Qipo.
0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Hi,

Quoting alexboy94
...Updated to Firefox 15 Beta 5 (the one before was Beta 4). Seems that the bug has changed, but still occurs with Qipo.


I just completed a review and noticed thatyour buildbreaks on compilation.

You havesome compilation errors now.Simply to note, you hadsome linker errors.

Please take a look at some consolidated pieces of my review...

Best regards,
Sergey

PS: Alex, you've escalated your problems because you've done a change from Beta 4 to Beta 5. I wouldn't do it until
the investigation with the linker problems is completed. Look, now thetitle of thepost doesn't reflect your current problems.
Anyway, I'm ready to help as much as possible...

0 Kudos
SergeyKostrov
Valued Contributor II
953 Views

Here is a list of all compilation errors ( Detailed ):

...
dom_quickstubs.cpp
*** Message: JS API functions declared as IMPORTED ***
..\include\mozilla/CheckedInt.h(355): error: type name is not allowed
bool IsSigned = IsSigned::value,
^

..\include\mozilla/CheckedInt.h(355): error: the global scope has no "value"
bool IsSigned = IsSigned::value,
^

..\include\mozilla/CheckedInt.h(361): error: a template argument list is not allowed in a declaration of a primary template
struct IsMulValidImpl
^

..\include\mozilla/CheckedInt.h(372): error: a template argument list is not allowed in a declaration of a primary template
struct IsMulValidImpl
^

..\include\mozilla/CheckedInt.h(396): error: a template argument list is not allowed in a declaration of a primary template
struct IsMulValidImpl
^

..\include\mozilla/CheckedInt.h(421): error: type name is not allowed
template::value>
^

..\include\mozilla/CheckedInt.h(421): error: the global scope has no "value"
template::value>
^

..\include\mozilla/CheckedInt.h(427): error: a template argument list is not allowed in a declaration of a primary template
struct OppositeIfSignedImpl
^

..\include\mozilla/CheckedInt.h(408): error: identifier "IsMulValidImpl" is undefined
return IsMulValidImpl::run(x, y);
^
detected during:
instantiation of "bool mozilla::detail::IsMulValid(T, T) [with T=unsigned int]" at line 690
instantiation of "mozilla::CheckedInt mozilla::operator*(const mozilla::CheckedInt &, const mozilla::CheckedInt &)
[with T=uint32_t={unsigned int}]" at line 1107 of "../../../dist/include/WebGLContext.h"

..\include\mozilla/CheckedInt.h(408): error: type name is not allowed
return IsMulValidImpl::run(x, y);
^
detected during:
instantiation of "bool mozilla::detail::IsMulValid(T, T) [with T=unsigned int]" at line 690
instantiation of "mozilla::CheckedInt mozilla::operator*(const mozilla::CheckedInt &, const mozilla::CheckedInt &)
[with T=uint32_t={unsigned int}]" at line 1107 of "../../../dist/include/WebGLContext.h"

..\include\mozilla/CheckedInt.h(408): error: the global scope has no "run"
return IsMulValidImpl::run(x, y);
^
detected during:
instantiation of "bool mozilla::detail::IsMulValid(T, T) [with T=unsigned int]" at line 690
instantiation of "mozilla::CheckedInt mozilla::operator*(const mozilla::CheckedInt &, const mozilla::CheckedInt &)
[with T=uint32_t={unsigned int}]" at line 1107 of "../../../dist/include/WebGLContext.h"

compilation aborted for c:/Users/Alex/Downloads/objdir/js/xpconnect/src/dom_quickstubs.cpp (code 2)
...

0 Kudos
SergeyKostrov
Valued Contributor II
953 Views

Here is a consolidation of all compilation errors ( By Error ):

..\include\mozilla/CheckedInt.h(355): error: type name is not allowed
..\include\mozilla/CheckedInt.h(421): error: type name is not allowed
..\include\mozilla/CheckedInt.h(408): error: type name is not allowed

..\include\mozilla/CheckedInt.h(355): error: the global scope has no "value"
..\include\mozilla/CheckedInt.h(421): error: the global scope has no "value"

..\include\mozilla/CheckedInt.h(408): error: the global scope has no "run"

..\include\mozilla/CheckedInt.h(361): error: a template argument list is not allowed in a declaration of a primary template
..\include\mozilla/CheckedInt.h(372): error: a template argument list is not allowed in a declaration of a primary template
..\include\mozilla/CheckedInt.h(396): error: a template argument list is not allowed in a declaration of a primary template
..\include\mozilla/CheckedInt.h(427): error: a template argument list is not allowed in a declaration of a primary template

..\include\mozilla/CheckedInt.h(408): error: identifier "IsMulValidImpl" is undefined

0 Kudos
SergeyKostrov
Valued Contributor II
953 Views

Here is a consolidation of all declarations that cased some compilation errors ( By Declaration ):

...
bool IsSigned = IsSigned::value
bool IsSigned = IsSigned::value

struct IsMulValidImpl

struct IsMulValidImpl

struct IsMulValidImpl

template::value>
template::value>

struct OppositeIfSignedImpl

return IsMulValidImpl::run(x, y)
...

0 Kudos
SergeyKostrov
Valued Contributor II
953 Views
Quoting alexboy94
...Seems that the bug has changed, but still occurs with Qipo...


Could you try to create a simple test-case that reproduces at least some compilation error? I think it will help Intel Software Engineers to
understand what could be possibly wrong.

Best regards,
Sergey

0 Kudos
Alex_K_6
Beginner
953 Views
EDIT: The compilation error is indeed a bug in the compiler:
https://bugzilla.mozilla.org/show_bug.cgi?id=784309

Sure. Also, it seems that the compilation errors occur if Qipo ISN'T defined (and only for Firefox 15). If Qipo is defined, the linking errors occur first. The linking errors also occur while trying to build Firefox 14, 13 etc. As for the build.log I linked above, that was compiled with Firefox 14 Beta 4 so nothing changed, I was just letting you know that the problem still occurs with any version of Firefox 15.

To reproduce the compilation errors, just compile any version of Firefox 15 with ICC 13 Beta 2.

Since I don't document how to build my browser, you can use this which is similar:

http://code.google.com/p/pcxfirefox/wiki/MozillaBuiltICC

Just follow step 1 and step 2 since the bug patches listed there have all gone now.

Also modify configure in the root directory and in js/src/configure to this:

FROM:
elif test "$_CC_MAJOR_VERSION" = "17"; then
_CC_SUITE=11
TO:
elif test "$_CC_MAJOR_VERSION" = "13"; then
_CC_SUITE=10
(It's the same thing you need to change in both files).
0 Kudos
Reply