Skip to content
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

CMake generate_projects.sh problem on Arch Linux #39

Open
datgame opened this issue Jan 16, 2019 · 6 comments · May be fixed by #215
Open

CMake generate_projects.sh problem on Arch Linux #39

datgame opened this issue Jan 16, 2019 · 6 comments · May be fixed by #215

Comments

@datgame
Copy link

datgame commented Jan 16, 2019

CMake 3.13.2

Preset parameter required, available presets:
(0) mac64 <--- macOS Xcode PhysX general settings
(1) ios64 <--- iOS Xcode PhysX general settings
(2) linux-aarch64 <--- Linux-aarch64 gcc PhysX SDK general settings
(3) linux <--- Linux clang PhysX SDK general settings
Enter preset number: 3
Running generate_projects.bat linux
Using preset xml: buildtools/presets/public/linux.xml
Target platform: linux using compiler: clang
PM_CMakeModules_PATH: /files/thirdparty/PhysX/physx/../externals/cmakemodules
PM_PATHS: /files/thirdparty/PhysX/physx/../externals/opengl-linux
Cmake: cmake
Not searching for unused variables given on the command line.
PHYSX ROOT /files/thirdparty/PhysX/physx
PhysX Build Platform: linux
Using CXX Compiler: /usr/bin/clang++
CMake Error at /files/thirdparty/PhysX/externals/cmakemodules/GetCompilerAndPlatform.cmake:244 (IF):
  if given arguments:

    "STREQUAL" "x86_64-unknown-linux-gnu" "OR" "STREQUAL" "x86_64-linux-gnu"

  Unknown arguments specified
Call Stack (most recent call first):
  /files/thirdparty/PhysX/externals/cmakemodules/NvidiaBuildOptions.cmake:99 (GetPlatformBinName)
  /files/thirdparty/PhysX/physx/source/compiler/cmake/CMakeLists.txt:73 (INCLUDE)


-- Configuring incomplete, errors occurred!
See also "/files/thirdparty/PhysX/physx/compiler/linux-debug/CMakeFiles/CMakeOutput.log".```

etc
@AlesBorovicka
Copy link

Hmm looks like that CMAKE_LIBRARY_ARCHITECTURE is not set in your case.
You can try to add the CMAKE_LIBRARY_ARCHITECTURE and set it to "x86_64-linux-gnu". But you might need to set more stuff. The custom linux toolchain files are in externals/cmakemodules/linux, maybe you need a toolchain file on your system.

@sapphous
Copy link

sapphous commented Jan 25, 2019

I'm not sure what all is necessary to properly fix this. But it seems to be working after the following hack (edit in response to comment: I've consistentized the casing):

After line 234 of physx/buildtools/cmake_generate_projects.py, add outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + os.environ['PM_CMakeModules_PATH'] + '/linux/LinuxRegular.cmake'. Then add a file externals/cmakemodules/linux/LinuxRegular.cmake containing

SET(CMAKE_CROSSCOMPILING FALSE)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)

SET(CMAKE_SYSROOT ${LINUX_ROOT})
SET(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)

@datgame
Copy link
Author

datgame commented Jan 26, 2019

Thanks, @sapphous !
That worked. Just had to fix the casing in your paste of "LinuxRegular"
After line 234 of physx/buildtools/cmake_generate_projects.py, add
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + os.environ['PM_CMakeModules_PATH'] + '/linux/LinuxRegular.cmake'
Then add a file externals/cmakemodules/linux/LinuxRegular.cmake containing SET(CMAKE_CROSSCOMPILING FALSE)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSROOT ${LINUX_ROOT})
SET(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)

jbeard4 added a commit to jbeard4/PhysX that referenced this issue Apr 25, 2019
no-preserve-root added a commit to no-preserve-root/PhysX that referenced this issue Sep 5, 2019
…d of guessing using the linker search path.

This method works on Arch Linux and related distros that do not prefix their library paths.
Fixes NVIDIAGameWorks#39.
@datgame
Copy link
Author

datgame commented Oct 14, 2019

got latest from git today (4.1) in a clean new folder and the same issue is still there.
the same fix works still though.

@phcerdan
Copy link

phcerdan commented Nov 4, 2019

Facing this as well. No need to add the LinuxRegular.cmake file, just add one line after

elif self.compiler == 'clang':

 elif self.compiler == 'clang':
+ outString = outString + ' -DCMAKE_LIBRARY_ARCHITECTURE=x86_64-linux-gnu'

@phcerdan
Copy link

phcerdan commented Nov 6, 2019

After some research, using CMAKE_LIBRARY_ARCHITECTURE to detect the platform is wrong. That variable is engineered to work with Debian-derived distros, but not in general (i.e, not in RHEL, Arch, etc), see bug report mozilla and CMake docs.

The solution is to use CMAKE_CXX_COMPILER_ID if you want to distinguish between clang, and arm. As you did for windows in the same CMake file.

Will open a PR shortly.

phcerdan added a commit to phcerdan/PhysX that referenced this issue Nov 6, 2019
CMAKE_LIBRARY_ARCHITECTURE is engineered for Debian-derived linux,
not for other distros such as RHEL-derived, Arch, etc.

To detect compilers in GetCompilerAndPlatform, use instead
`CMAKE_CXX_COMPILER_ID` and `CMAKE_CXX_COMPILER`, as it is used
already for the `windows` case.

Note that the arm version is untested, so a double check with
COMPILER_ID and just COMPILER is in place.

Fixes NVIDIAGameWorks#39
qoh pushed a commit to qoh/PhysX that referenced this issue Feb 3, 2020
CMAKE_LIBRARY_ARCHITECTURE is engineered for Debian-derived linux,
not for other distros such as RHEL-derived, Arch, etc.

To detect compilers in GetCompilerAndPlatform, use instead
`CMAKE_CXX_COMPILER_ID` and `CMAKE_CXX_COMPILER`, as it is used
already for the `windows` case.

Note that the arm version is untested, so a double check with
COMPILER_ID and just COMPILER is in place.

Fixes NVIDIAGameWorks#39

Signed-off-by: ns <portification@gmail.com>
borodust added a commit to borodust/PhysX that referenced this issue Nov 1, 2020
borodust added a commit to borodust/PhysX that referenced this issue Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants