New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cocos2d-x compile broken on Ubuntu 17、18 #19246
Comments
Hi, you can add " set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") " to CMakeList below line 70.It worked for me! |
@flykule Thank you for commenting! I am going to try this out. |
@flykule Thank you so much! I have to modify a bit to: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fexceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder") |
Compiling with -no-pie option just for one library (freetype2) sounds a little bit strange. In my opinion the prebuilt of libfreetype.a should be compiled with -fPIC option, or i am wrong? Sorry, i am not a compiler/linker expert. If you remove the dependency to libfreetype.a (i.e. in link.txt) you are able to successfully link everything with a clean/new project. I compiled and linked the libfreetype.a by myself and replaced it with the prebuilt. Now it's linking. |
@playmyskay Yeah, true perhaps. I have tried a few things, so far and nothing works. elseif(LINUX)
#target_compile_options(${target} PUBLIC -fPIC)
#target_compile_options(${target} PUBLIC -no-pie) |
step1:
output file: step2: file to replace: The file in repo 'https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin' must be replaced with a correct binary. |
Thank you very much i had the same problem and it solved it |
It solve by rollback gcc version and g++ version ,reference the file ........
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60
echo "Cocos uses GCC Version: `gcc --version`"
echo "Cocos uses G++ Version: `g++ --version`"
echo "Cocos uses ld Version: `ld --version`"
echo "Cocos uses /usr/bin/ld Version: `/usr/bin/ld --version`" the "-fPIC" error occur because gcc\g++ version too new (ubuntu17 or 18) , may be cocos2d-x should update gcc version |
i think we can use ubuntu 18 for next the testing version |
That would be fantastic, @minggo! I just started learning Cocos and this was a pain point. |
Just to share another [easier] solution for 3.17.1 (Ubuntu 18.04 LTS / LinuxMint 19.1):
(Edit) Note: The package libfreetype6-dev must be installed. |
I just had a similar issue with libfmod:
How can I solve it? |
Can you improve the documentation for cocos2dx installation in Linux? It’s best not to set the operating system dependency. but I can’t see it in the documentation. I use kubuntu 20.04 |
compile errors like:
The text was updated successfully, but these errors were encountered: