To bKgu

This particular forum is archives, bug reports should be made at https://github.com/visualboyadvance-m/v ... e-m/issues


Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

I found that if I delete the CMakeFiles directory, and run "cmake -DWINCROSS=1 ." again, it works now. Is there an official method to delete that directory, like "make distclean" or something?

 

Also, is there perhaps the possibility that we can have different parameters like that perhaps create a CMakeFiles-win directory and Makefile.win, so I can have both UNIX and Windows builds at the same time?

 

I also found an issue, it's using the wrong ar and ranlib in the process. How do I override those so it uses the proper ones?

It's also doing this in the final step:

Code: Select all

-o vbam -rdynamic -L/home/nach/SVN/vbam/trunk libvbamcore.a -lSDL -lz -lpng -lGLU -lGL -lSM -lICE -lX11 -lXext

This should be vbam.exe, and not be linking in -lSM -lICE -lX11 -lXext, nor using -rdynamic. How can I get rid of these?

 

There's also a problem with the assembly or something here.

It's doing this:

Code: Select all

/usr/bin/nasm -f elf -Isrc/hq/asm/ -O1 -DELF -I/usr/include/SDL   -DSYSCONFDIR='"/etc"' -DVERSION='"1.8.0-SVN"' -DPKGDATADIR='"/usr/local/share/vbam"' -DPACKAGE='' -o CMakeFiles/vbam.dir/src/hq/asm/hq4x_32.o /home/nach/SVN/vbam/trunk/src/hq/asm/hq4x_32.asm

ELF should not be used in Windows mode.

 

I specifically have:

Code: Select all

IF ( WIN32 )
   SET( CMAKE_ASM_FLAGS "-Isrc/hq/asm/ -O1")
ELSE ( WIN32 )
   SET( CMAKE_ASM_FLAGS "-Isrc/hq/asm/ -O1 -DELF")
ENDIF ( WIN32 )

 

And the included NASM build rules also has win32 specified as follows:

Code: Select all

       IF(WIN32)
               SET(CMAKE_ASM_COMPILE_OBJECT " -f win32 -DWIN32  -o  -c ")
       ENDIF(WIN32)

But the -DWIN32 and all isn't appearing.

Last edited by Nach on Fri Jun 06, 2008 5:03 am, edited 1 time in total.
Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

So I did some more digging and fixes, set a few more variables. Now for "ar", it's running "cr", any ideas what's going on? I check the cache, and I see these:

 

Code: Select all

########################
# EXTERNAL cache entries
########################

//Path to a program.
CMAKE_AR:FILEPATH=

//ASM compiler.
CMAKE_ASM_COMPILER:FILEPATH=/usr/bin/nasm

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/var/chroot/sid-ia32/usr/i586-mingw32/bin/i586-mingw32-g++

//Path to a program.
CMAKE_CXX_COMPILER_WITH_PATH:FILEPATH=/var/chroot/sid-ia32/usr/i586-mingw32/bin/i586-mingw32-g++

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/var/chroot/sid-ia32/usr/i586-mingw32/bin/i586-mingw32-gcc

//Path to a program.
CMAKE_C_COMPILER_WITH_PATH:FILEPATH=/var/chroot/sid-ia32/usr/i586-mingw32/bin/i586-mingw32-gcc

//Path to a program.
CMAKE_LINKER:FILEPATH=

//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make

//Path to a program.
CMAKE_NM:FILEPATH=

//Path to a program.
CMAKE_OBJCOPY:FILEPATH=

//Path to a program.
CMAKE_OBJDUMP:FILEPATH=

//Path to a program.
CMAKE_STRIP:FILEPATH=

 

If you check latest SVN, you'll see that I setup ar, ld and friends, yet only my C and C++ changes seem to be working. Any ideas?

 

Also, this having to delete the cache file and directories and Makefile is getting annoying each time, is there a clean command?

xKiv
Junior Member
Posts: 36
Joined: Fri Mar 21, 2008 9:47 am

To bKgu

Post by xKiv »

So I did some more digging and fixes, set a few more variables. Now for "ar", it's running "cr", any ideas what's going on? I check the cache, and I see these:

...

 

What's in your CMakeFiles/vbamcore.dir/link.txt?

Mine starts "/usr/bin/ar cr libvbamcore.a " ...

Maybe you actually set the AR program to empty string somewhere (hint: line 1: "CMAKE_AR:FILEPATH=" and nothing else .. and of course my cache has "CMAKE_AR:FILEPATH=/usr/bin/ar", but I didn't "rerun [rm -rf CMakeFiles CMakeCache.txt]" cmake yet ...)?

 

 

As for applying changed CMakeLists.txt ... tough luck ... it is supposed to be hand-editable. How would cmake now which parts were hand-edited and which of those it should keep?

Just delete.

Or run cmake from a different build directory every time [img]<fileStore.core_Emoticons>/emoticons/sad.png[/img]/emoticons/sad@2x.png 2x" width="20" height="20" />

Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="114" data-ipsquote-contentclass="forums_Topic"><div>

So I did some more digging and fixes, set a few more variables. Now for "ar", it's running "cr", any ideas what's going on? I check the cache, and I see these:

...

 

What's in your CMakeFiles/vbamcore.dir/link.txt?

</div></blockquote>
 

Code: Select all

cr libvbamcore.a  CMakeFiles/vbamcore.dir/src/2xSaI.obj CMakeFiles/vbamcore.dir/src/admame.obj CMakeFiles/vbamcore.dir/src/armdis.obj CMakeFiles/vbamcore.dir/src/bilinear.obj CMakeFiles/vbamcore.dir/src/bios.obj CMakeFiles/vbamcore.dir/src/Cheats.obj CMakeFiles/vbamcore.dir/src/CheatSearch.obj CMakeFiles/vbamcore.dir/src/EEprom.obj CMakeFiles/vbamcore.dir/src/elf.obj CMakeFiles/vbamcore.dir/src/Flash.obj CMakeFiles/vbamcore.dir/src/Globals.obj CMakeFiles/vbamcore.dir/src/interframe.obj CMakeFiles/vbamcore.dir/src/hq2x.obj CMakeFiles/vbamcore.dir/src/Mode0.obj CMakeFiles/vbamcore.dir/src/Mode1.obj CMakeFiles/vbamcore.dir/src/Mode2.obj CMakeFiles/vbamcore.dir/src/Mode3.obj CMakeFiles/vbamcore.dir/src/Mode4.obj CMakeFiles/vbamcore.dir/src/Mode5.obj CMakeFiles/vbamcore.dir/src/pixel.obj CMakeFiles/vbamcore.dir/src/remote.obj CMakeFiles/vbamcore.dir/src/RTC.obj CMakeFiles/vbamcore.dir/src/scanline.obj CMakeFiles/vbamcore.dir/src/Sound.obj CMakeFiles/vbamcore.dir/src/Sram.obj CMakeFiles/vbamcore.dir/src/Util.obj CMakeFiles/vbamcore.dir/src/expr.obj CMakeFiles/vbamcore.dir/src/exprNode.obj CMakeFiles/vbamcore.dir/src/expr-lex.obj CMakeFiles/vbamcore.dir/src/memgzio.obj CMakeFiles/vbamcore.dir/src/agb/agbprint.obj CMakeFiles/vbamcore.dir/src/agb/GBA.obj CMakeFiles/vbamcore.dir/src/agb/gbafilter.obj CMakeFiles/vbamcore.dir/src/agb/GBAGfx.obj CMakeFiles/vbamcore.dir/src/agb/GBA-thumb.obj CMakeFiles/vbamcore.dir/src/agb/GBA-arm.obj CMakeFiles/vbamcore.dir/src/dmg/GB.obj CMakeFiles/vbamcore.dir/src/dmg/gbCheats.obj CMakeFiles/vbamcore.dir/src/dmg/gbDis.obj CMakeFiles/vbamcore.dir/src/dmg/gbGfx.obj CMakeFiles/vbamcore.dir/src/dmg/gbGlobals.obj CMakeFiles/vbamcore.dir/src/dmg/gbMemory.obj CMakeFiles/vbamcore.dir/src/dmg/gbPrinter.obj CMakeFiles/vbamcore.dir/src/dmg/gbSGB.obj CMakeFiles/vbamcore.dir/src/dmg/gbSound.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Blip_Buffer.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Effects_Buffer.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Gb_Apu.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Gb_Apu_State.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Gb_Oscs.obj CMakeFiles/vbamcore.dir/src/dmg/gb_apu/Multi_Buffer.obj CMakeFiles/vbamcore.dir/src/fex_mini.obj
libvbamcore.a

 

Mine starts "/usr/bin/ar cr libvbamcore.a " ...

Which is invalid. I need a different ar.

 

Maybe you actually set the AR program to empty string somewhere (hint: line 1: "CMAKE_AR:FILEPATH=" and nothing else .. and of course my cache has "CMAKE_AR:FILEPATH=/usr/bin/ar", but I didn't "rerun [rm -rf CMakeFiles CMakeCache.txt]" cmake yet ...)?

 

Uh no, you're not cross compiling, or even reading the subject above. I'm overriding CMAKE_AR to the proper ar, and instead it's just leaving it blank, as opposed to using my changes.

Last edited by Nach on Fri Jun 06, 2008 11:03 am, edited 1 time in total.
Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

So I thought I've seen it all, now get this.

 

If I do as follows:

rm -rf CMakeCache.txt Makefile CMakeFiles

then insert INCLUDE(CMakeDetermineCCompiler) prior to ENDIF ( WINCROSS ) into CMakeLists.txt, then run

cmake -DWINCROSS=1 .

which will not produce a Makefile due to errors, then I replace INCLUDE(CMakeDetermineCCompiler) with INCLUDE(CMakeDetermineCXXCompiler) and run

cmake -DWINCROSS=1 .

make VERBOSE=1

 

Now it will find the proper ar and ranlib, but only if I do things in that order, with the first call to CMake failing. Someone want to explain this to me?

xKiv
Junior Member
Posts: 36
Joined: Fri Mar 21, 2008 9:47 am

To bKgu

Post by xKiv »

Which is invalid. I need a different ar.

It is invalid, yes, but not for the reason you think.

It is not using "cr" for "ar".

It is using " cr" for "ar cr" [1], because your CMAKE_AR is empty, as I pointed out. Look at the first non-empty non-comment (which you posted):

CMAKE_AR:FILEPATH=

 

I don't know how that happened. Your CMakeLists.txt clearly states that CMAKE_AR should be i586-mingw32-ar.

 

[1] the "cr" just stands for "create the archive (unless it already exists) and insert named files into it (replace those that are already inside).

 

Uh no, you're not cross compiling, or even reading the subject above. I'm overriding CMAKE_AR to the proper ar, and instead it's just leaving it blank, as opposed to using my changes.

 

I don't need to cross-compile ... with empty CMAKE_AR, even straight-compiling would fail.

Of course, I can't test, because without the mingw32 suite cmake won't generate WINCROSS Makefiles for me ...


So I thought I've seen it all, now get this.

 

If I do as follows:

rm -rf CMakeCache.txt Makefile CMakeFiles

then insert INCLUDE(CMakeDetermineCCompiler) prior to ENDIF ( WINCROSS ) into CMakeLists.txt, then run

cmake -DWINCROSS=1 .

which will not produce a Makefile due to errors, then I replace INCLUDE(CMakeDetermineCCompiler) with INCLUDE(CMakeDetermineCXXCompiler) and run

cmake -DWINCROSS=1 .

make VERBOSE=1

 

Now it will find the proper ar and ranlib, but only if I do things in that order, with the first call to CMake failing. Someone want to explain this to me?

 

This one looks EASY to me.

 

CMakeDetermineCCompiler says it overrides CMAKE_C_COMPILER, CMAKE_AR, CMAKE_RANLIB, CMAKE_COMPILER_IS_GNUCC.

It will find your native gcc for C compiling. It will put this value into the cache. It will probably also find (and put into cache) your native ar and ranlib, but that isn't that bad - the archive format is (at least I think) the same. (or it will not find none and use the specified ones)

But it doesn't look for compiler of C++ so the value you specified in CMakeLists.txt is used (and put into CMakeCache.txt).

Then something will fail because cmake will be trying to compile windows binaries from C sources to make sure, OSLT, ...

 

On the second run, CMakeDetermineCXXCompiler might do something useful, but it will absolutely not overwrite anything that already is specified in the cache. Like the values for ar, ranlib and C compiler found previously - or the C++ compiler you specified.

Then the mingw C++ compiler is used to actually compile everything (there are no pure C sources, right?), which works.

And then it uses the ar and ranlib from previous run - which work, I assume, whether they are native or mingw32.

 

But I am no seer.

 

 

I think you should try

SET(_CMAKE_TOOLCHAIN_PREFIX i586-mingw32-)

include(CMakeDetermineCCompiler)

include(CMakeDetermineCXXCompiler)

somewhere in the WINCROSS section. It may help.

Last edited by xKiv on Fri Jun 06, 2008 11:27 am, edited 1 time in total.
Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="114" data-ipsquote-contentclass="forums_Topic"><div>

Which is invalid. I need a different ar.

It is invalid, yes, but not for the reason you think.

It is not using "cr" for "ar".

It is using " cr" for "ar cr" [1], because your CMAKE_AR is empty, as I pointed out. Look at the first non-empty non-comment (which you posted):

CMAKE_AR:FILEPATH=

</div></blockquote>

Yeah, I realized later where the cr came from, it still left me scratching my head as to why it was ignoring my ar override.

 

<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="114" data-ipsquote-contentclass="forums_Topic"><div>

Uh no, you're not cross compiling, or even reading the subject above. I'm overriding CMAKE_AR to the proper ar, and instead it's just leaving it blank, as opposed to using my changes.

 

This one looks EASY to me.

 

CMakeDetermineCCompiler says it overrides CMAKE_C_COMPILER, CMAKE_AR, CMAKE_RANLIB, CMAKE_COMPILER_IS_GNUCC.

It will find your native gcc for C compiling. It will put this value into the cache. It will probably also find (and put into cache) your native ar and ranlib, but that isn't that bad - the archive format is (at least I think) the same. (or it will not find none and use the specified ones)

</div></blockquote>

I'm not sure about ar, but ranlib must be the MinGW one and not the system one, because the headers are indeed different. And indeed, when run this way, it puts in my overrides.

 

But it doesn't look for compiler of C++ so the value you specified in CMakeLists.txt is used (and put into CMakeCache.txt).

Then something will fail because cmake will be trying to compile windows binaries from C sources to make sure, OSLT, ...

No, it fails because it says it doesn't have permission to write new files to /, I'm not even sure why it's trying to put anything in /.

 

And then it uses the ar and ranlib from previous run - which work, I assume, whether they are native or mingw32.

MinGW.

 

I think you should try

SET(_CMAKE_TOOLCHAIN_PREFIX i586-mingw32-)

include(CMakeDetermineCCompiler)

include(CMakeDetermineCXXCompiler)

somewhere in the WINCROSS section. It may help.

This is actually working. Thanks. I have no idea why the other overrides wouldn't work.

Now I just have to figure out how to fix the NASM problem I mentioned above, and some linking issues.

Last edited by Nach on Fri Jun 06, 2008 12:39 pm, edited 1 time in total.
bgK
Member
Posts: 88
Joined: Thu Apr 17, 2008 3:58 pm

To bKgu

Post by bgK »

Ok, I got it to work.

 

You have to use a recent cmake (2.6 series)

Create a new file named Toolchain-mingw32.cmake

Fill it with something like that :

Code: Select all

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc /home/bbouclet/mingw )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

 

Then call cmake with :

cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain-mingw32.cmake -DNO_GTK=1 .

 

It should then build without problem when using the updated CMakeLists.txt (rev 568)

Nach
Junior Member
Posts: 31
Joined: Tue Mar 18, 2008 10:02 am

To bKgu

Post by Nach »

Latest SVN doesn't bother to build or link the assembly files:

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0x244): undefined reference to `_hq3x_32'

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0x712): undefined reference to `_hq4x_32'

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0x93c): undefined reference to `_hq3x_32'

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0xb5c): undefined reference to `_hq4x_32'

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0x443): undefined reference to `_hq3x_16'

CMakeFiles/vbam.dir/src/hq/asm/hq3x32.obj:hq3x32.cpp: (.text+0x5c3): undefined reference to `_hq4x_16'

 

Is there something I should be doing to cleanup between different builds besides?:

rm -rf CMakeCache.txt Makefile CMakeFiles

 

Although bgK, it seems I can compile builds now as long as they're not using assembly [img]<fileStore.core_Emoticons>/emoticons/smile.png[/img]/emoticons/smile@2x.png 2x" width="20" height="20" />

Last edited by Nach on Sat Jun 07, 2008 2:52 pm, edited 1 time in total.
chrono
Junior Member
Posts: 32
Joined: Tue Mar 18, 2008 9:23 pm

To bKgu

Post by chrono »

Is there something I should be doing to cleanup between different builds besides?:
rm -rf CMakeCache.txt Makefile CMakeFiles

Code: Select all

make clean
Post Reply