Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cannot compile v3.4.1 (centos) #2415

Closed
cc123450 opened this issue Oct 22, 2022 · 7 comments · Fixed by #2443
Closed

cannot compile v3.4.1 (centos) #2415

cc123450 opened this issue Oct 22, 2022 · 7 comments · Fixed by #2443
Assignees
Milestone

Comments

@cc123450
Copy link

Problem

when I build from source, it gives me error
I can successfully build version 3.2.2

[ 0%] Building C object src/circuits/CMakeFiles/circuits.dir/hawickCircuits.c.o
cc: error: unrecognized command line option ‘-Wfloat-conversion’

To Reproduce

make

Platform/versions

centos 7.9
pgrouting 3.4.1
gcc 4.8.5
boost 1.6.9
cmake 3.17.5
postgresql 13.8
postgis 3.2
@cc123450 cc123450 added the bug label Oct 22, 2022
@nieyankai
Copy link

I encountered the same problem

@cvvergara
Copy link
Member

Hi, can you post all that is output when you do the cmake command.

@cvvergara cvvergara added this to the 3.4.2 milestone Nov 29, 2022
@cvvergara cvvergara changed the title cannot compile v3.4.1 cannot compile v3.4.1 (centos) Nov 29, 2022
@robe2
Copy link
Member

robe2 commented Nov 29, 2022

I'll take a stab at replicating. I can spin up a centos vm.

@robe2 robe2 self-assigned this Nov 29, 2022
@robe2
Copy link
Member

robe2 commented Nov 29, 2022

I assume the above should be boost 1.69, since 3.4.1 requires boost 1.56 or above.
I was able to replicate the issue.

I am running with:

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
cmake3 version 3.17.5
boost 1.69.0
postgresql 13.9 from yum.postgresql.org
postgis 3.2 from yum.postgresql.org

the output shows:

For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.

-- POSTGRESQL_PG_CONFIG is /usr/pgsql-13/bin/pg_config
-- POSTGRESQL_EXECUTABLE is /usr/pgsql-13/bin/postgres
-- POSTGRESQL_VERSION_STRING in FindPostgreSQL.cmake is PostgreSQL 13.9
-- POSTGRESQL_INCLUDE_DIR: /usr/pgsql-13/include/server
-- POSTGRESQL_LIBRARIES: /usr/pgsql-13/lib
-- POSTGRESQL_VERSION_STRING=PostgreSQL 13.9
-- POSTGRESQL_VERSION=13.9
-- PGSQL_VERSION=139
-- LIBRARY_INSTALL_PATH /usr/pgsql-13/lib
-- Performing Test C_COMPILER_SUPPORTS_FPIC
-- Performing Test C_COMPILER_SUPPORTS_FPIC - Success
-- Performing Test CXX_COMPILER_SUPPORTS_FPIC
-- Performing Test CXX_COMPILER_SUPPORTS_FPIC - Success
-- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH
-- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH - Success
-- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH
-- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /projects/pgrouting/build

sudo make

Scanning dependencies of target circuits
[ 0%] Building C object src/circuits/CMakeFiles/circuits.dir/hawickCircuits.c.o
cc: error: unrecognized command line option '-Wfloat-conversion'
make[2]: *** [src/circuits/CMakeFiles/circuits.dir/hawickCircuits.c.o] Error 1
make[1]: *** [src/circuits/CMakeFiles/circuits.dir/all] Error 2
make: *** [all] Error 2

All the stuff on Centos 7 is too old to build pgrouting 3.4.1 so had to do the below:

the default cmake that comes with centos is 2.8 so had to do below

yum install cmake3
cmake3 --version

outputs: cmake3 version 3.17.5

mkdir /projects
cd /projects
# the default boost I get when running yum install boost is 1.53, so pulled from source instead
wget https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.bz2
tar -xvf boost_1_69_0.tar.bz2
cd boost_1_*
./bootstrap.sh --prefix=/opt/boost
sudo ./b2 install --prefix=/opt/boost --with=all

# install postgresql from yum.postgresql.org
sudo yum install epel-release 
sudo tee /etc/yum.repos.d/pgdg.repo<<EOF
[pgdg-13]
name=PostgreSQL for 13 RHEL/CentOS 7 - x86_64
baseurl=https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-7-x86_64/
enabled=1
gpgcheck=0

[pgdg-depends]
name=PostgreSQL RHEL/CentOS 7 - x86_64 common
baseurl=https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-7-x86_64/
enabled=1
gpgcheck=0
EOF

sudo yum install centos-release-scl #needed for llvm for postgreql13-devel
sudo yum update
sudo yum install postgresql13 postgresql13-server postgresql13-devel postgis32_13
cd /projects 
git clone -b v3.4.1 https://github.com/pgRouting/pgrouting.git
cd /projects/pgrouting
mkdir build
cd build
export PATH=${PATH}:/usr/pgsql-13/bin
cmake3 -DBOOST_ROOT:PATH="/opt/boost"  ..
sudo make

@robe2
Copy link
Member

robe2 commented Nov 29, 2022

As suggested by @cvvergara , replacing

add_definitions(-Wsign-conversion -Wfloat-conversion) -> add_definitions(-Wsign-conversion)

on https://github.com/pgRouting/pgrouting/blob/v3.4.1/CMakeLists.txt#L317
got passed that step, but now fails with:

Scanning dependencies of target trsp
[ 29%] Building C object src/trsp/CMakeFiles/trsp.dir/trsp.c.o
/projects/pgrouting/src/trsp/trsp.c: In function 'compute_trsp':
/projects/pgrouting/src/trsp/trsp.c:162:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (size_t z = 0; z < total_tuples; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:162:3: note: use option -std=c99 or -std=gnu99 to compile your code
/projects/pgrouting/src/trsp/trsp.c:184:15: error: redefinition of 'z'
for (size_t z = 0; z < total_tuples; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:162:15: note: previous definition of 'z' was here
for (size_t z = 0; z < total_tuples; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:184:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (size_t z = 0; z < total_tuples; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:312:15: error: redefinition of 'z'
for (size_t z = 0; z < *path_count; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:184:15: note: previous definition of 'z' was here
for (size_t z = 0; z < total_tuples; z++) {
^
/projects/pgrouting/src/trsp/trsp.c:312:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (size_t z = 0; z < *path_count; z++) {
^

@robe2
Copy link
Member

robe2 commented Nov 30, 2022

Okay after running:

perl -pi -e 's/for \(size_t z/size_t z; for (z/' src/trsp/trsp.c

and removing the size_t z declarations on /src/trsp/trsp.c:185 and 314 the compile finished.

but failed on building the .sql

The .sql error I think is specific to my setup with missing locale, so I suspect most other users will not run into this issue

Scanning dependencies of target pgrouting-3.4
[ 87%] Linking CXX shared library lib/libpgrouting-3.4.so
[ 87%] Built target pgrouting-3.4
Scanning dependencies of target extension_file
[ 87%] Generating pgrouting--3.4.1.sql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
[ 87%] Built target extension_file
Scanning dependencies of target update_files
[ 87%] Generating pgrouting--3.4.0--3.4.1.sql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't locate version.pm in @inc (@inc contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./scripts/build-extension-update-files.pl line 44.
BEGIN failed--compilation aborted at ./scripts/build-extension-update-files.pl line 44.
make[2]: *** [sql/pgrouting--3.4.0--3.4.1.sql] Error 2
make[1]: *** [sql/CMakeFiles/update_files.dir/all] Error 2

@robe2
Copy link
Member

robe2 commented Nov 30, 2022

Okay success.

Had to do:

yum install perl-version
cd /projects/pgrouting/build
make
make install

and voila success:

[ 87%] Built target ordering
[ 87%] Built target pgrouting-3.4
[ 87%] Built target extension_file
[100%] Built target update_files
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/pgsql-13/lib/libpgrouting-3.4.so
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.4.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.5--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.4--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.3--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.2--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.1--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.3.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.2.2--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.2.1--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.2.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.1.4--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.1.3--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.1.2--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.1.1--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.1.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.6--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.5--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.4--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.3--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.2--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.1--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.0.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--2.6.3--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--2.6.2--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--2.6.1--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--2.6.0--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting--3.4.1.sql
-- Installing: /usr/pgsql-13/share/extension/pgrouting.control

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants