LiteEditor fails to build (link)

Discussion about CodeLite development process and patches
SlimFast
CodeLite Enthusiast
Posts: 43
Joined: Fri Jun 17, 2011 9:31 am
Genuine User: Yes
IDE Question: C++
Contact:

LiteEditor fails to build (link)

Post by SlimFast »

Well I am pretty sure you met this yourself already, but current trunk does no build for me anymore. The reason is that the file "LiteEditor.txt" passed to make is too long and gets truncated. Therefore, linking fails.

I just wonder how you solved it using current CL 4.1?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: LiteEditor fails to build (link)

Post by eranif »

To fix this:
Untick the option: Settings -> Build Settings -> Compilers -> gnu g++ -> Advanced -> Pass files to linker via file

Build codelite and run 'update.bat' script

Once you have the new version installed, you can re-enable this option
The problem is that Windows' ECHO command truncates its output to 8191 bytes

It is fixed in trunk by breaking the single ECHO command into number of ECHO calls

Eran
Make sure you have read the HOW TO POST thread
SlimFast
CodeLite Enthusiast
Posts: 43
Joined: Fri Jun 17, 2011 9:31 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: LiteEditor fails to build (link)

Post by SlimFast »

eranif wrote:To fix this:
Untick the option: Settings -> Build Settings -> Compilers -> gnu g++ -> Advanced -> Pass files to linker via file
Yes - that did it (I wasn't even aware of that option). Thanks for the fast help! :-)

Being curious: If passing via file is error prone, why should it be enabled at all? What's the benefit?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: LiteEditor fails to build (link)

Post by eranif »

SlimFast wrote:If passing via file is error prone
Its not. There was a bug in the I implemented the file creation (I used ECHO command in the makefile).

However, there is a definitely a bug in the command line argument length that g++ can accept - windows limits the length to 16K or something like that.
So passing a single file name instead of passing a very long string which contains hundreds of object file names is the correct way to go

Eran
Make sure you have read the HOW TO POST thread
leon_lee
CodeLite Enthusiast
Posts: 32
Joined: Sun Nov 18, 2012 10:44 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: LiteEditor fails to build (link)

Post by leon_lee »

eranif wrote:To fix this:
Untick the option: Settings -> Build Settings -> Compilers -> gnu g++ -> Advanced -> Pass files to linker via file

Build codelite and run 'update.bat' script

Once you have the new version installed, you can re-enable this option
The problem is that Windows' ECHO command truncates its output to 8191 bytes

It is fixed in trunk by breaking the single ECHO command into number of ECHO calls

Eran
it seems that there's still some thing wrong with the fix. I put the make error output of my project below. it looks like both two processes try to create make10096-1.bat at the same time which causes this error, but I try not to use "-j 4" argument in make, the error still exist. If I Untick the above option, it's fine.

Live child 00E5F560 (Debug/angotest) PID 15067016
Reaping winning child 00E5F560 PID 15067016
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Creating temporary batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Batch file contents:
@echo off
echo >> "angotest.txt"
CreateProcess(C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat,C:\DOCUME~1\leon\LOCALS~1\Temp\make1009
6-1.bat,...)
Live child 00E5F560 (Debug/angotest) PID 15067016
Reaping winning child 00E5F560 PID 15067016
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Creating temporary batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Batch file contents:
@echo off
g++ -o ./Debug/angotest @"angotest.txt" -L. -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/li
bbionic/Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libskia/Debug/ -Ld:/linux/linuxkernel/W
ORKING_DIRECTORY/ango/libcorejni/Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libdvm/Debug/
-Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libcutils/Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECT
ORY/ango/runtime/ -llog -lws2_32 -mwindows -mthreads -LC:\wxWidgets-2.9.4\lib\gcc_dll -lwxmsw29ud
_xrc -lwxmsw29ud_aui -lwxmsw29ud_html -lwxmsw29ud_adv -lwxmsw29ud_core -lwxbase29ud_xml -lwxbase29ud
_net -lwxmsw29ud_richtext -lwxbase29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd
-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32
-loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lpthread -lpthread.dll -lpthreadGC2.dll -lpthreadG
C2-static -lpthreadGCE2 -lpthreadGCE2.dll
g++ -o ./Debug/angotest @"angotest.txt" -L. -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libbionic/
Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libskia/Debug/ -Ld:/linux/linuxkernel/WORKING_D
IRECTORY/ango/libcorejni/Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango/libdvm/Debug/ -Ld:/lin
ux/linuxkernel/WORKING_DIRECTORY/ango/libcutils/Debug/ -Ld:/linux/linuxkernel/WORKING_DIRECTORY/ango
/runtime/ -llog -lws2_32 -mwindows -mthreads -LC:\wxWidgets-2.9.4\lib\gcc_dll -lwxmsw29ud_xrc -lw
xmsw29ud_aui -lwxmsw29ud_html -lwxmsw29ud_adv -lwxmsw29ud_core -lwxbase29ud_xml -lwxbase29ud_net -lw
xmsw29ud_richtext -lwxbase29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkerne
l32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut
32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lpthread -lpthread.dll -lpthreadGC2.dll -lpthreadGC2-stati
c -lpthreadGCE2 -lpthreadGCE2.dll
CreateProcess(C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat,C:\DOCUME~1\leon\LOCALS~1\Temp\make1009
6-1.bat,...)
Live child 00E5F560 (Debug/angotest) PID 15067016
g++: error: ECHO: No such file or directory
g++: error: 处于关闭状态。: No such file or directory
Reaping losing child 00E5F560 PID 15067016
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
angotest.mk:89: recipe for target `Debug/angotest' failed
mingw32-make.exe[1]: *** [Debug/angotest] Error 1
Removing child 00E5F560 PID 15067016 from chain.
mingw32-make.exe[1]: Leaving directory `D:/linux/linuxkernel/WORKING_DIRECTORY/ango/angowx'
Reaping losing child 00A204B0 PID 10626272
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make5868-1.bat
ango_wsp.mk:4: recipe for target `All' failed
mingw32-make.exe: *** [All] Error 2
Removing child 00A204B0 PID 10626272 from chain.
leon_lee
CodeLite Enthusiast
Posts: 32
Joined: Sun Nov 18, 2012 10:44 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: LiteEditor fails to build (link)

Post by leon_lee »

eranif wrote:
SlimFast wrote:If passing via file is error prone
Its not. There was a bug in the I implemented the file creation (I used ECHO command in the makefile).

However, there is a definitely a bug in the command line argument length that g++ can accept - windows limits the length to 16K or something like that.
So passing a single file name instead of passing a very long string which contains hundreds of object file names is the correct way to go

Eran
I heard that copying C:\WINDOWS\system32\cmd.exe to the project dir, and using the local cmd.exe in make would break the 16k limit. I will try it when my project gets bigger enough. But how to make codelite use the local cmd.exe?
leon_lee
CodeLite Enthusiast
Posts: 32
Joined: Sun Nov 18, 2012 10:44 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: LiteEditor fails to build (link)

Post by leon_lee »

leon_lee wrote:
eranif wrote:To fix this:
Untick the option: Settings -> Build Settings -> Compilers -> gnu g++ -> Advanced -> Pass files to linker via file

Build codelite and run 'update.bat' script

Once you have the new version installed, you can re-enable this option
The problem is that Windows' ECHO command truncates its output to 8191 bytes

It is fixed in trunk by breaking the single ECHO command into number of ECHO calls

Eran
it seems that there's still some thing wrong with the fix. I put the make error output of my project below. it looks like both two processes try to create make10096-1.bat at the same time which causes this error, but I try not to use "-j 4" argument in make, the error still exist. If I Untick the above option, it's fine.

Live child 00E5F560 (Debug/angotest) PID 15067016
Reaping winning child 00E5F560 PID 15067016
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Creating temporary batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Batch file contents:
@echo off
echo >> "angotest.txt"
CreateProcess(C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat,C:\DOCUME~1\leon\LOCALS~1\Temp\make1009
6-1.bat,...)
now i figure out this is because of "echo >> "angotest.txt"". My project happens to just reach the limit, so there's would 2 echo, but the second echo is null, which causes the error. I try to add one more file in my project, the second echo is still null. Maybe there's some error in the code with the second echo.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: LiteEditor fails to build (link)

Post by eranif »

leon_lee wrote:Batch file contents:
@echo off
echo >> "angotest.txt"
Where does this come from?
I dont think that codelite does that...
Is this something custom you have in your project?

Eran
Make sure you have read the HOW TO POST thread
leon_lee
CodeLite Enthusiast
Posts: 32
Joined: Sun Nov 18, 2012 10:44 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: LiteEditor fails to build (link)

Post by leon_lee »

eranif wrote:
leon_lee wrote:Batch file contents:
@echo off
echo >> "angotest.txt"
Where does this come from?
I dont think that codelite does that...
Is this something custom you have in your project?

Eran
eranif wrote:Once you have the new version installed, you can re-enable this option
The problem is that Windows' ECHO command truncates its output to 8191 bytes

It is fixed in trunk by breaking the single ECHO command into number of ECHO calls
I don't think there's anything custom in my project. You said Windows' ECHO command truncates its output to 8191 bytes , and It is fixed in trunk by breaking the single ECHO command into number of ECHO calls. Actually make passes the object files to linker by echo all the name into one file.
Batch file contents:
@echo off
echo >> "angotest.txt"
This is the log from "make -d", make is creating the batch file for echo. I feel the key is how It is fixed in trunk by breaking the single ECHO command into number of ECHO calls in the code. If you tell me which part I should look into, I will do that.
Just to clarify the situation, I put more make log below. you can see there's two echo batch file. the first one is using " echo ...> "angotest.txt"", then the second one uses "echo >> "angotest.txt"". So the issue is why the second echo echos null?

Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Creating temporary batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Batch file contents:
@echo off
echo ./Debug/gui.o ./Debug/main.o ./Debug/app_process_app_main_test.o ./Debug/AndroidRuntime
_AndroidRuntimetest.o ./Debug/utils_VectorImpl.o ./Debug/utils_SharedBuffer.o ./Debug/libcutils_ashm
em-dev.o ./Debug/libcutils_memory.o ./Debug/libcutils_atomic.o ./Debug/libcutils_process_name.o ./D
ebug/libcutils_properties.o ./Debug/libcutils_mspace.o ./Debug/libcutils_sched_policy.o ./Debug/Andr
oidRuntime_sigprocmask.o ./Debug/libdvm_mingw_libdvm.o ./Debug/libcorejni_mingw-poll.o ./Debug/unist
d_signal.o ./Debug/sigaction_sigaction1.o ./Debug/bionic___set_errno.o ./Debug/bionic_system_propert
ies.o ./Debug/bionic_dlmalloc.o ./Debug/futex_futex.o ./Debug/string_strsep.o ./Debug/stdlib_lrand4
8.o ./Debug/stdlib__rand48.o ./Debug/libdex_DexProto.o ./Debug/libdex_DexFile.o ./Debug/libdex_ZipAr
chive.o ./Debug/libdex_DexCatch.o ./Debug/libdex_CmdUtils.o ./Debug/libdex_DexClass.o ./Debug/libde
x_DexDataMap.o ./Debug/libdex_DexInlines.o ./Debug/libdex_DexOptData.o ./Debug/libdex_DexSwapVerify.
o ./Debug/libdex_InstrUtils.o ./Debug/libdex_Leb128.o ./Debug/libdex_OpCodeNames.o ./Debug/libdex_Op
tInvocation.o ./Debug/libdex_sha1.o ./Debug/libdex_SysUtil.o ./Debug/vm_Jnitest.o ./Debug/vm_Initte
st.o ./Debug/vm_CheckJnitest.o ./Debug/vm_Threadtest.o ./Debug/mterp_Mterptest.o ./Debug/out_InterpC
-portstdtest.o ./Debug/out_InterpC-portdbgtest.o ./Debug/vm_AllocTrackertest.o ./Debug/vm_Properties
test.o ./Debug/alloc_Alloctest.o ./Debug/alloc_Heaptest.o ./Debug/alloc_CardTabletest.o ./Debug/all
oc_HeapWorkertest.o ./Debug/alloc_HeapSourcetest.o ./Debug/alloc_HeapBitmap.o ./Debug/alloc_clz.o ./
Debug/vm_Misctest.o ./Debug/vm_Synctest.o ./Debug/interp_Stacktest.o ./Debug/interp_Interptest.o ./
Debug/vm_ReferenceTabletest.o ./Debug/vm_InlineNative.o ./Debug/vm_Inlines.o ./Debug/oo_Classtest.o
./Debug/oo_Objecttest.o ./Debug/oo_TypeChecktest.o ./Debug/oo_Arraytest.o ./Debug/oo_Resolvetest.o .
/Debug/oo_AccessCheck.o ./Debug/vm_Profiletest.o ./Debug/jdwp_ExpandBuf.o ./Debug/jdwp_JdwpEventtes
t.o ./Debug/jdwp_JdwpConstants.o ./Debug/jdwp_JdwpHandlertest.o ./Debug/jdwp_JdwpMain.o ./Debug/jdwp
_JdwpSockettest.o ./Debug/jdwp_JdwpAdbtest.o ./Debug/vm_IndirectRefTabletest.o ./Debug/vm_Exceptiont
est.o ./Debug/analysis_RegisterMaptest.o ./Debug/analysis_DexVerifytest.o ./Debug/analysis_Optimize
test.o ./Debug/analysis_VerifySubstest.o ./Debug/analysis_CodeVerifytest.o ./Debug/vm_PointerSettest
.o ./Debug/vm_Atomic.o ./Debug/vm_AtomicCache.o ./Debug/vm_UtfStringtest.o ./Debug/vm_Hashtest.o ./
Debug/vm_LinearAlloctest.o ./Debug/vm_Interntest.o ./Debug/vm_Debuggertest.o ./Debug/vm_DvmDex.o ./D
ebug/vm_Ddmtest.o ./Debug/native_InternalNativetest.o ./Debug/reflect_Annotationtest.o ./Debug/vm_Na
tivetest.o > "angotest.txt"
CreateProcess(C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat,C:\DOCUME~1\leon\LOCALS~1\Temp\make1009
6-1.bat,...)
Live child 00E5F560 (Debug/angotest) PID 15067016
Reaping winning child 00E5F560 PID 15067016
Cleaning up temp batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Creating temporary batch file C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat
Batch file contents:
@echo off
echo >> "angotest.txt"
CreateProcess(C:\DOCUME~1\leon\LOCALS~1\Temp\make10096-1.bat,C:\DOCUME~1\leon\LOCALS~1\Temp\make1009
6-1.bat,...)
leon_lee
CodeLite Enthusiast
Posts: 32
Joined: Sun Nov 18, 2012 10:44 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: LiteEditor fails to build (link)

Post by leon_lee »

leon_lee wrote:
eranif wrote:
leon_lee wrote:Batch file contents:
@echo off
echo >> "angotest.txt"
Where does this come from?
I dont think that codelite does that...
Is this something custom you have in your project?

Eran
eranif wrote:Once you have the new version installed, you can re-enable this option
The problem is that Windows' ECHO command truncates its output to 8191 bytes

It is fixed in trunk by breaking the single ECHO command into number of ECHO calls
I don't think there's anything custom in my project. You said Windows' ECHO command truncates its output to 8191 bytes , and It is fixed in trunk by breaking the single ECHO command into number of ECHO calls. Actually make passes the object files to linker by echo all the name into one file.
Batch file contents:
@echo off
echo >> "angotest.txt"
This is the log from "make -d", make is creating the batch file for echo. I feel the key is how It is fixed in trunk by breaking the single ECHO command into number of ECHO calls in the code. If you tell me which part I should look into, I will do that.
Just to clarify the situation, I put more make log below. you can see there's two echo batch file. the first one is using " echo ...> "angotest.txt"", then the second one uses "echo >> "angotest.txt"". So the issue is why the second echo echos null?
This is a small bug residented in Plugin\builder_gnumake.cpp.
I have 3 files in my project, which would not have object files, but in BuilderGnuMake::CreateObjectList, they are counted for objCounter, hence even though my project has no 100 object files, the objCounter jumps to 1, which leads to the second null echo.

I just change BuilderGnuMake::CreateObjectList a little bit to fix this bug by adding ValidObjFileCount for objCounter , and the code is below. I try to rebuild codelite, but fail with "No rule to make target `autoversion.cpp', needed by `Debug/autoversion.o'. Stop.". The codelite from git clone simply doesn't have this `autoversion.cpp'. So the code is not verified yet, but hopely it should be working.
code of BuilderGnuMake::CreateObjectList wrote: void BuilderGnuMake::CreateObjectList(ProjectPtr proj, const wxString &confToBuild, wxString &text)
{
m_objectChunks = 1;
std::vector<wxFileName> files;
proj->GetFiles(files, true);

BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf(proj->GetName(), confToBuild);
wxString cmpType = bldConf->GetCompilerType();

//get the compiler settings
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetCompiler(cmpType);

int counter = 1;
Compiler::CmpFileTypeInfo ft;
wxString cwd = ::wxGetCwd();

wxString objectsList;
size_t objCounter = 0;
// to exclude the amount of invalid files
size_t ValidObjFileCount = 0;
text << "Objects" << objCounter++ << "=";
for (size_t i=0; i<files.size(); ++i) {

// is this a valid file?
if ( !cmp->GetCmpFileType(files.GetExt(), ft) )
continue;

if ( ft.kind == Compiler::CmpFileKindResource && !OS_WINDOWS) {
continue;
}

ValidObjFileCount++;
if ( ValidObjFileCount && ((ValidObjFileCount % 100) == 0) ) {
text << "\n\n";
text << "Objects" << objCounter++ << "=";
}

wxString objPrefix = DoGetTargetPrefix(files.at(i), cwd, cmp);
if (ft.kind == Compiler::CmpFileKindResource) {
// resource files are handled differently
text << wxT("$(IntermediateDirectory)/") << objPrefix << files.GetFullName() << wxT("$(ObjectSuffix) ");
} else {
// Compiler::CmpFileKindSource file
text << wxT("$(IntermediateDirectory)/") << objPrefix << files.GetName() << wxT("$(ObjectSuffix) ");
}
if (counter % 10 == 0) {
text << wxT("\\\n\t");
}
counter++;
}

text << "\n\nObjects=";
for(size_t i=0; i<objCounter; ++i)
text << "$(Objects" << i << ") ";

text << wxT("\n\n");
m_objectChunks = objCounter;
}
Post Reply