fix compilation issue with NULL on GCC 4.6+
Hi all,
I tried the WG compilation from scratch but it fails to build in
https://www.assembla.com/spaces/gdpl/wiki/How_to_compile_WG_from_scratch
This was running the latest revision fr
changeset: 237:1e9e441930b2
tag: tip
user: cixot
date: Sat Jun 25 03:28:37 2011 +0200
summary: wylaczam embedowanie manifestu
The error was while doing :-
make -f Makefile.x86_64
This is the error message which came :-
Any pointers.
I ran
$make clean
twice thinking perhaps its a local fault/issue.
I also tried to do an hg update but still nothing.
/usr/local/src/warlockgauntlet$ hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Looking forward to more info.
--
Regards,
Shirish Agarwal शिरीष अग्रवाल
My quotes in this email licensed under CC 3.0
http://creativecommons.org/licenses/by-nc/3.0/
http://flossexperiences.wordpress.com
065C 6D79 A68C E7EA 52B3 8D70 950D 53FB 729A 8B17
I tried the WG compilation from scratch but it fails to build in
https://www.assembla.com/spaces/gdpl/wiki/How_to_compile_WG_from_scratch
This was running the latest revision fr
changeset: 237:1e9e441930b2
tag: tip
user: cixot
date: Sat Jun 25 03:28:37 2011 +0200
summary: wylaczam embedowanie manifestu
The error was while doing :-
make -f Makefile.x86_64
This is the error message which came :-
src/Map/CRandomMapGenerator.h:75:36: warning:
‘CRandomMapGenerator::SPhysical::bossPlaylist’ will be initialized
after [-Wreorder]
src/Map/CRandomMapGenerator.h:73:15: warning: ‘float
CRandomMapGenerator::SPhysical::bossTriggerRadius’ [-Wreorder]
src/Map/CRandomMapGenerator.h:76:9: warning: when initialized here [-Wreorder]
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o
src/Map/CMapObjectDescriptor.o src/Map/CMapObjectDescriptor.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o
src/Map/CRandomMapGenerator.o src/Map/CRandomMapGenerator.cpp
In file included from src/Map/CRandomMapGenerator.cpp:1:0:
src/Map/CRandomMapGenerator.h: In constructor
‘CRandomMapGenerator::SPhysical::SPhysical(std::string, std::string,
int, int, float, float, std::string, std::string)’:
src/Map/CRandomMapGenerator.h:75:36: warning:
‘CRandomMapGenerator::SPhysical::bossPlaylist’ will be initialized
after [-Wreorder]
src/Map/CRandomMapGenerator.h:73:15: warning: ‘float
CRandomMapGenerator::SPhysical::bossTriggerRadius’ [-Wreorder]
src/Map/CRandomMapGenerator.h:76:9: warning: when initialized here [-Wreorder]
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CRegionDescriptor.o
src/Map/CRegionDescriptor.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CTile.o
src/Map/CTile.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CCamera.o
src/Rendering/CCamera.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include"
-I"build/includes" -DPLATFORM_LINUX -c -o
src/Rendering/CDisplayable.o src/Rendering/CDisplayable.cpp
In file included from
build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from
build/includes/SFML-1.6/include/SFML/Graphics/Sprite.hpp:31,
from src/Rendering/CWGSprite.h:4,
from src/Rendering/CDisplayable.h:19,
from src/Rendering/CDisplayable.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In
constructor ‘sf::ResourcePtr< <template-parameter-1-1>
>::ResourcePtr()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:31:12:
error: ‘NULL’ was not declared in this scope
In file included from
build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from
build/includes/SFML-1.6/include/SFML/Graphics/Sprite.hpp:31,
from src/Rendering/CWGSprite.h:4,
from src/Rendering/CDisplayable.h:19,
from src/Rendering/CDisplayable.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In member
function ‘void sf::ResourcePtr< <template-parameter-1-1>
>::OnResourceDestroyed()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:148:18:
error: ‘NULL’ was not declared in this scope
make: *** [src/Rendering/CDisplayable.o] Error 1
Any pointers.
I ran
$make clean
twice thinking perhaps its a local fault/issue.
I also tried to do an hg update but still nothing.
/usr/local/src/warlockgauntlet$ hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Looking forward to more info.
--
Regards,
Shirish Agarwal शिरीष अग्रवाल
My quotes in this email licensed under CC 3.0
http://creativecommons.org/licenses/by-nc/3.0/
http://flossexperiences.wordpress.com
065C 6D79 A68C E7EA 52B3 8D70 950D 53FB 729A 8B17
Leave a comment
on 2011-06-27 22:41 *
By shirishag75
Summary changed from Compiling issues ? to test #1064 adding for gcc 4.6 + NULL issue
Summary changed from Compiling issues ? to test #1064 adding for gcc 4.6 + NULL issue
on 2011-06-27 23:21 *
By shirishag75
Summary changed from test #1064 adding for gcc 4.6 + NULL issue to test #1064 adding for gcc 4.6 + NULL issue
Summary changed from test #1064 adding for gcc 4.6 + NULL issue to test #1064 adding for gcc 4.6 + NULL issue
on 2011-06-28 15:02 *
By shirishag75
E-mail does not work at my end, assembla strips no matter what i do.
Anyway here's the answer to your question :-
And this is what's been happening
Anyway here's the answer to your question :-
$ gcc --version
gcc (Debian 4.6.1-1) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
And this is what's been happening
/usr/local/src/warlockgauntlet$ make -f Makefile.x86_64
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CMultiColorString.o src/Rendering/CMultiColorString.cpp
In file included from build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from build/includes/SFML-1.6/include/SFML/Graphics/String.hpp:31,
from src/Rendering/CMultiColorString.h:4,
from src/Rendering/CMultiColorString.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In constructor ‘sf::ResourcePtr< <template-parameter-1-1> >::ResourcePtr()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:31:12: error: ‘NULL’ was not declared in this scope
In file included from build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from build/includes/SFML-1.6/include/SFML/Graphics/String.hpp:31,
from src/Rendering/CMultiColorString.h:4,
from src/Rendering/CMultiColorString.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In member function ‘void sf::ResourcePtr< <template-parameter-1-1> >::OnResourceDestroyed()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:148:18: error: ‘NULL’ was not declared in this scope
make: *** [src/Rendering/CMultiColorString.o] Error 1
on 2011-06-28 15:13 *
By shirishag75
my mistake. I did not run make clean. Still after doing that, came with the same error at the same place today.
This is with changeset 242 .
Please let me know if any more info. is required.
In file included from src/Map/CMapManager.cpp:20:0:
src/Map/CRandomMapGenerator.h: In constructor ‘CRandomMapGenerator::SPhysical::SPhysical(std::string, std::string, int, int, float, float, std::string, std::string)’:
src/Map/CRandomMapGenerator.h:75:36: warning: ‘CRandomMapGenerator::SPhysical::bossPlaylist’ will be initialized after [-Wreorder]
src/Map/CRandomMapGenerator.h:73:15: warning: ‘float CRandomMapGenerator::SPhysical::bossTriggerRadius’ [-Wreorder]
src/Map/CRandomMapGenerator.h:76:9: warning: when initialized here [-Wreorder]
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CMapObjectDescriptor.o src/Map/CMapObjectDescriptor.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CRandomMapGenerator.o src/Map/CRandomMapGenerator.cpp
In file included from src/Map/CRandomMapGenerator.cpp:1:0:
src/Map/CRandomMapGenerator.h: In constructor ‘CRandomMapGenerator::SPhysical::SPhysical(std::string, std::string, int, int, float, float, std::string, std::string)’:
src/Map/CRandomMapGenerator.h:75:36: warning: ‘CRandomMapGenerator::SPhysical::bossPlaylist’ will be initialized after [-Wreorder]
src/Map/CRandomMapGenerator.h:73:15: warning: ‘float CRandomMapGenerator::SPhysical::bossTriggerRadius’ [-Wreorder]
src/Map/CRandomMapGenerator.h:76:9: warning: when initialized here [-Wreorder]
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CRegionDescriptor.o src/Map/CRegionDescriptor.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Map/CTile.o src/Map/CTile.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CCamera.o src/Rendering/CCamera.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CDisplayable.o src/Rendering/CDisplayable.cpp
src/Rendering/CDisplayable.cpp: In member function ‘void CDisplayable::SetSubRect(sf::IntRect)’:
src/Rendering/CDisplayable.cpp:197:18: warning: variable ‘oldSize’ set but not used [-Wunused-but-set-variable]
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CDrawableManager.o src/Rendering/CDrawableManager.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CHudSprite.o src/Rendering/CHudSprite.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CHudStaticText.o src/Rendering/CHudStaticText.cpp
g++ -g -Wall -m64 -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Rendering/CMultiColorString.o src/Rendering/CMultiColorString.cpp
In file included from build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from build/includes/SFML-1.6/include/SFML/Graphics/String.hpp:31,
from src/Rendering/CMultiColorString.h:4,
from src/Rendering/CMultiColorString.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In constructor ‘sf::ResourcePtr< <template-parameter-1-1> >::ResourcePtr()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:31:12: error: ‘NULL’ was not declared in this scope
In file included from build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from build/includes/SFML-1.6/include/SFML/Graphics/String.hpp:31,
from src/Rendering/CMultiColorString.h:4,
from src/Rendering/CMultiColorString.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In member function ‘void sf::ResourcePtr< <template-parameter-1-1> >::OnResourceDestroyed()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:148:18: error: ‘NULL’ was not declared in this scope
make: *** [src/Rendering/CMultiColorString.o] Error 1
This is with changeset 242 .
Please let me know if any more info. is required.
on 2011-06-28 17:46 *
By cixot
Assigned to changed from cixot to shirishag75
Status changed from Test to New
Assigned to changed from cixot to shirishag75
Status changed from Test to New
No, not more info is needed.
I believe this is the 'bug' with GCC 4.6 where it needs to explicit include <cstddef> before NULL identifier is used. Weird. (BTW: I'm running on GCC 4.4.5)
Anyway, we're unable at the moment to efficiently find all references to the NULL in our project, so what you should do:
1) Make -f Makefile.x86_64
2) Scan the output, starting from the last line. Search for the "error: 'NULL' was not declared in this scope":
3) In the above snippets find the first occurence of file in src/* directory:
4) edit that file, and just before line 4 add the following include:
5) repeat steps 1-4 until application is successfully built
I believe this is the 'bug' with GCC 4.6 where it needs to explicit include <cstddef> before NULL identifier is used. Weird. (BTW: I'm running on GCC 4.4.5)
Anyway, we're unable at the moment to efficiently find all references to the NULL in our project, so what you should do:
1) Make -f Makefile.x86_64
2) Scan the output, starting from the last line. Search for the "error: 'NULL' was not declared in this scope":
In file included from build/includes/SFML-1.6/include/SFML/System/Resource.hpp:211:0,
from build/includes/SFML-1.6/include/SFML/Graphics/String.hpp:31,
from src/Rendering/CMultiColorString.h:4,
from src/Rendering/CMultiColorString.cpp:1:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl: In member function ‘void sf::ResourcePtr< <template-parameter-1-1> >::OnResourceDestroyed()’:
build/includes/SFML-1.6/include/SFML/System/ResourcePtr.inl:148:18: error: ‘NULL’ was not declared in this scope
3) In the above snippets find the first occurence of file in src/* directory:
from src/Rendering/CMultiColorString.h:4
4) edit that file, and just before line 4 add the following include:
#include <cstddef>
5) repeat steps 1-4 until application is successfully built
on 2011-06-28 21:47 *
By shirishag75
Hi all,
While I did as requested, I am not sure I am cut out for this sort of stuff. This is what I did :-
As can be seen that was line 3.
I do understand your predicament as you do not use the same version as me.
I tried to see if there was I could alleviate that problem/issue so you get a sense of what needs to be done. Hence posted the make process online . (For clarification ran make clean before doing make)
http://paste.debian.net/121272/ (this is the paste so might be useful or not)
[URL=http://www.wupload.com/file/36528457/warlock-gauntlet-make.txt]
The same thing as a .txt file ready to be used for the same.
While I did as requested, I am not sure I am cut out for this sort of stuff. This is what I did :-
/usr/local/src/warlockgauntlet/src/Rendering$ leafpad CMultiColorString.h
#ifndef __CMULTICOLORSTRING_H__
#define __CMULTICOLORSTRING_H__
#include <cstddef>
#include <SFML/Graphics/String.hpp>
class CMultiColorString: public sf::String
{
public:
static const std::wstring NextColor(sf::Color col);
virtual void Render(sf::RenderTarget& target) const;
};
#endif // __CMULTICOLORSTRING_H__
As can be seen that was line 3.
I do understand your predicament as you do not use the same version as me.
I tried to see if there was I could alleviate that problem/issue so you get a sense of what needs to be done. Hence posted the make process online . (For clarification ran make clean before doing make)
http://paste.debian.net/121272/ (this is the paste so might be useful or not)
[URL=http://www.wupload.com/file/36528457/warlock-gauntlet-make.txt]
The same thing as a .txt file ready to be used for the same.
on 2011-06-28 21:56 *
By cixot
Assigned to changed from shirishag75 to -none-
Milestone changed from A1 Forum/Wishlist/Junkie/Rozmowy to Bliżej nieokreślona przyszłość (a.k.a backlog)
Summary changed from test #1064 adding for gcc 4.6 + NULL issue to fix compilation issue with NULL on GCC 4.6+
Assigned to changed from shirishag75 to -none-
Milestone changed from A1 Forum/Wishlist/Junkie/Rozmowy to Bliżej nieokreślona przyszłość (a.k.a backlog)
Summary changed from test #1064 adding for gcc 4.6 + NULL issue to fix compilation issue with NULL on GCC 4.6+
Cool, thanks!
We won't fix that problem (no appropriate environment ATM), but will keep this ticket for further reference.
We won't fix that problem (no appropriate environment ATM), but will keep this ticket for further reference.
on 2011-06-28 23:26 *
By shirishag75
ok, please download or/and put that file for reference somewhere. While the doc/paste at paste.debian.net would expire in about 72 hours, the one at wupload would probably not exist for more than a month.
on 2011-06-29 03:56 *
By shirishag75
Ok, compiled again, this time its these lines :-
now where should I put the
Should I just put it in line 3 in src/Utils/SafeFunctions.h like this ?
Is the above correct ?
In file included from src/Utils/SafeFunctions.cpp:1:0:
src/Utils/SafeFunctions.h: In function ‘void SafeVectorRelease(std::vector<T>*)’:
src/Utils/SafeFunctions.h:8:12: error: ‘NULL’ was not declared in this scope
src/Utils/SafeFunctions.h:12:10: error: ‘NULL’ was not declared in this scope
make: *** [src/Utils/SafeFunctions.o] Error 1
now where should I put the
#include <cstddef>
Should I just put it in line 3 in src/Utils/SafeFunctions.h like this ?
#ifndef __SAFE_FUNCTIONS_H__
#define __SAFE_FUNCTIONS_H__
#include <cstddef>
#include <vector>
Is the above correct ?
on 2011-06-29 04:12 *
By shirishag75
Thank you for that quick comment. So what I would do is keep plugging away and putting whatever changes I am doing on the bug itself. This way if I do break something people would be able to point, at the same time if I am doing the right thing, then other people might be able to benefit from it (Somebody unlucky to have gcc version 4.6 and have this bug/whatever. )
Anyways, after that and another round of make clean and make, came up with this :-
So here the problem is in src/Map/SearchTools/CWaypoint.cpp
So fixing it in the first line itself .
I do see that there is also a CWaypoint.h as well, dunno if the change needed to be made there or not.
Anyways, after that and another round of make clean and make, came up with this :-
g++ -g -Wall -I"build/includes/SFML-1.6/include" -I"build/includes" -DPLATFORM_LINUX -c -o src/Map/SearchTools/CWaypoint.o src/Map/SearchTools/CWaypoint.cpp
src/Map/SearchTools/CWaypoint.cpp: In constructor ‘CWaypoint::CWaypoint()’:
src/Map/SearchTools/CWaypoint.cpp:10:48: error: ‘NULL’ was not declared in this scope
make: *** [src/Map/SearchTools/CWaypoint.o] Error 1
So here the problem is in src/Map/SearchTools/CWaypoint.cpp
So fixing it in the first line itself .
#include <cstddef>
#include "CWaypoint.h"
I do see that there is also a CWaypoint.h as well, dunno if the change needed to be made there or not.
on 2011-06-29 04:19 *
By shirishag75
Did the above, did a make clean and compiled again, this time was hit with another one but this one seems different, a different bug perhaps ?
Or maybe something to do with that Cwaypoint.cpp thing instead ?
/includes" -DPLATFORM_LINUX -L"./libs32" -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
/usr/bin/ld: skipping incompatible ./libs32/libsfml-graphics.so when searching for -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: skipping incompatible ./libs32/libsfml-window.so when searching for -lsfml-window
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: skipping incompatible ./libs32/libsfml-system.so when searching for -lsfml-system
/usr/bin/ld: cannot find -lsfml-system
/usr/bin/ld: skipping incompatible ./libs32/libsfml-audio.so when searching for -lsfml-audio
/usr/bin/ld: cannot find -lsfml-audio
collect2: ld returned 1 exit status
make: *** [WarlocksGauntlet.bin32] Error 1
Or maybe something to do with that Cwaypoint.cpp thing instead ?
It compiled - great! Means all the NULL troubles are gone. Now it's a different problem - the linker.
However, I have no idea what the problem is :( I'm guessing you're trying to build a 64b version ( the -m64 option ) yet linking against 32b libs (-L"./libs32"). Why - I don't know, since you're using our makefile... toxic?
However, I have no idea what the problem is :( I'm guessing you're trying to build a 64b version ( the -m64 option ) yet linking against 32b libs (-L"./libs32"). Why - I don't know, since you're using our makefile... toxic?
on 2011-06-29 04:33 *
By shirishag75
Uh oh..... my bad, my mistake. forgot its not plain make, going back to make clean and
Made clean,
Did run make -f Makefile.x86_64
and now run into this :-
make -f Makefile.x86_64
Made clean,
Did run make -f Makefile.x86_64
and now run into this :-
/usr/bin/ld: src/Audio/CAudioManager.o: undefined reference to symbol 'alGetError'
/usr/bin/ld: note: 'alGetError' is defined in DSO /usr/lib64/libopenal.so.1 so try adding it to the linker command line
/usr/lib64/libopenal.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [WarlocksGauntlet.bin64] Error 1
on 2011-06-29 05:08 *
By shirishag75
Interesting, see this :-
I do see that in my system atleast /usr/lib64 is symlinked to /usr/lib
Maybe this could help you guys telling me what I need to do, or maybe something needs to be done at your end ?
$ apt-file search libopenal.so.1
ia32-libs: /usr/lib32/libopenal.so.1
ia32-libs: /usr/lib32/libopenal.so.1.12.854
libopenal1: /usr/lib/libopenal.so.1
libopenal1: /usr/lib/libopenal.so.1.12.854
libopenal1: /usr/lib/libopenal.so.1.13.0
libopenal1-dbg: /usr/lib/debug/usr/lib/libopenal.so.1.12.854
I do see that in my system atleast /usr/lib64 is symlinked to /usr/lib
/usr$ ll -h lib64
lrwxrwxrwx 1 root root 3 May 12 11:23 lib64 -> lib
Maybe this could help you guys telling me what I need to do, or maybe something needs to be done at your end ?
on 2011-06-29 05:45 *
By shirishag75
Talked to dextero in the chat-room and added to Makefile.x86_64 line 13 -lopenal so now the line reads as :-
LIBS = -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lopenal