Can't make Cocos2d-x compile on Ubuntu 18.04

but the instructions don’t say to do this for 18.x :slight_smile:

ok i downloaded again through git, repeated steps from documentation and i still get the same error (in this case i don’t run ./install-deps-linux.sh). I’m sure i run git submodule update --init, git submodule update, ./download-deps.py, download the dependency, and then build the makefile for linux-build as the documentation.

Ok let me test on a clean Ubuntu 18.04 install.

thank you. I try to install with zip from cocos website, build the make file as the step from documentation, and the build is complete (I still don’t know and wondering why). But when i try to run the binary cpp-tests it’s say the error like this.

According to this thread i’m finaly solve the problem.

But i still wondering why it’s failed to build when cloning from git repository.

I’ll run through the instructions again just to be sure.

I didn’t run into any issues, but in the sake of not leaving someone hanging I added the thread you referenced to the docs. This PR

Hi,
i’m relaunching this thread because it looks like this problem is not solved.
I have reinstalled cocos2d-x (following the documentation’s instructions) on my Ubuntu 18.04, and had the exact same error than Gdrop.

[ 68%] Linking CXX executable …/…/bin/cpp-empty-test/cpp-empty-test
/usr/bin/ld: …/…/…/…/external/bullet/prebuilt/linux/64-bit/libBulletDynamics.a(btSequentialImpulseConstraintSolver.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: ../../../../external/bullet/prebuilt/linux/64-bit/libBulletDynamics.a(btTypedConstraint.o): relocation R_X86_64_32S against symbol _ZTV17btTypedConstraint’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: …/…/…/…/external/bullet/prebuilt/linux/64-
etc…

Then i did the exact same thing than doyoque (install from the zip form cocos website)
and now the error occures at 98% of the compilation.
I really want to fix this issues, if you have any what this error is related to , it would be very nice

Linux is my primary platform, these days.

You need to add this to your CMakeLists:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie -fexceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder")

1 Like

AH it works, thanks :slight_smile:
maybe it can be useful to add it to the linux install documentation, only for ubuntu 18 users