LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-08-2021, 08:59 AM   #1
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
swi-prolog 8.4.1 wouldn't compile (amd64/Centos7/gcc-10.2)


Oh well, why would it compile?
Here is the build script I tried:
Code:
#!/bin/bash

rm -rf build/

mkdir -p man/archive

mkdir -p build; cd build

set -e
set -o pipefail

export CFLAGS="$COMMON_CFLAGS64 -std=c17 $COMMON_CPPFLAGS"
export LDFLAGS="$COMMON_LDFLAGS64 -L/usr/local/lib64 -Wl,-R/usr/local/lib64"

cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. 2>&1 | tee ../log.cmake

make VERBOSE=yes 2>&1 | tee ../log.make.all

ctest -j 4 2>&1 | tee ../log.ctest

make VERBOSE=yes install 2>&1 | tee ../log.make.install
 
Old 12-08-2021, 09:02 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880

Original Poster
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
And here is the error-message:
Code:
make[2]: Entering directory `/usr/local/src/swipl-8.4.1/build'
[ 56%] Building C object src/CMakeFiles/swiplobjs.dir/pl-atom.c.o
cd /usr/local/src/swipl-8.4.1/build/src && /usr/local/bin/cc  -I/usr/local/src/swipl-8.4.1/build/src -I/usr/local/src/swipl-8.4.1/src -m
64 -std=c99 -std=c17 -I/usr/local/include -D__UNIX__ -D__unix__ -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -D_ALL_SOURCE -D_LARGEFILE_SOURCE -D_L
ARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_THREAD_SAFE -O2 -fPIC -fvisibility=hidden -Wall -fno-strict-aliasing -o CMake
Files/swiplobjs.dir/pl-atom.c.o -c /usr/local/src/swipl-8.4.1/src/pl-atom.c
In file included from /usr/local/src/swipl-8.4.1/src/pl-incl.h:135,
                 from /usr/local/src/swipl-8.4.1/src/pl-atom.h:36,
                 from /usr/local/src/swipl-8.4.1/src/pl-atom.c:38:
/usr/local/src/swipl-8.4.1/src/pl-builtin.h:295:5: error: expected declaration specifiers or '...' before '(' token
  295 |     ( sizeof(*__PL_ld) > 1 ? (PL_local_data_t *)(__PL_ld) \
      |     ^
/usr/local/src/swipl-8.4.1/src/pl-macros.h:98:24: note: in definition of macro '_M_IF0b'
   98 | #define _M_IF0b(...)   __VA_ARGS__
      |                        ^~~~~~~~~~~
/usr/local/src/swipl-8.4.1/src/pl-macros.h:63:26: note: in expansion of macro 'A_ECHO'
   63 | #define A_UNWRAP(list)   A_ECHO list
 
Old 12-08-2021, 09:05 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880

Original Poster
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
pl-builtin.h:
Code:
    291 /* These will never be compiled, they are here simply for scope detection */
    292 extern char *__PL_ld;
    293 extern struct {char *engine;} *PL__ctx;
    294 #define _LD_WITH_FALLBACK(f) \
    295                   ( sizeof(*__PL_ld) > 1 ? (PL_local_data_t *)(__PL_ld) \
    296                   : sizeof(*PL__ctx->engine) > 1 ? (PL_local_data_t *)(PL__ctx->engine) \
    297                   : (PL_local_data_t *)(f) )
    298 #define LOCAL_LD  _LD_WITH_FALLBACK(_ASSERT_LD(sizeof(*__PL_ld) > 1 || sizeof(*PL__ctx->engine) > 1))
    299 #define ANY_LD    _LD_WITH_FALLBACK(GLOBAL_LD)
 
Old 12-08-2021, 09:10 AM   #4
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
Before compiling from source, I'd try rebuilding Fedora Rawhide source RPM package.

This would require some adjustments to the spec file. E.g. readline-devel in CentOS 7 doesn't provide a pkg-config .pc file, so you'll have to BR readline-devel rather than pkgconfig(readline). For some builds, I had to redefine %__cmake_configure as well.

Last edited by shruggy; 12-08-2021 at 09:36 AM.
 
Old 12-08-2021, 09:14 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880

Original Poster
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
Calling only cpp doesn't help much either:
Code:
In file included from /usr/local/src/swipl-8.4.1/src/pl-incl.h:576,
                 from /usr/local/src/swipl-8.4.1/src/pl-atom.h:36,
                 from /usr/local/src/swipl-8.4.1/src/pl-atom.c:38:
/usr/local/src/swipl-8.4.1/src/pl-vmi.h:86:1: error: macro "_M_TEMPLATE1" requires 4 arguments, but only 2 given
   86 |   ),
      | ^ ~~
vmi-metadata.h:
Code:
      7     Note: this file is generated by ./mkvmi from pl-vmi.c.  DO NOT EDIT....

     15 #define FOREACH_VMI_CALL(sep,f,...) f(D_BREAK, ## __VA_ARGS__) sep() <another 7915 bytes>
pl-vmi.h:
Code:
     71 #define FOREACH_VMI(sep,...) FOREACH_VMI_CALL(sep, M_TEMPLATE, __VA_ARGS__)

     83 typedef enum
     84 { FOREACH_VMI(T_COMMA,
     85     ,VMI_NAME,
     86   ),
     87   VMI_END_LIST
     88 } vmi;
pl-macros.h:
Code:
     62 #define A_ECHO(...)              __VA_ARGS__

    105 #define M_TEMPLATE(ctxarg, ...)  A_ECHO(_M_TEMPLATE0(ctxarg, __VA_ARGS__))
    106 #define _M_TEMPLATE0(ctx, lit, f, ...)  lit _M_TPLEXPAND(ctx, f, 1, ## __VA_ARGS__) (ctx, ## __VA_ARGS__)

    118 #define _M_TPLEXPAND(ctx, f, n, ...)  M_IFPAREN(f) (A_UNWRAP(f)) (_M_TPLCALL(f)(ctx)) M_IFEMPTY(__VA_ARGS__) (A_IGNORE) (_M_TPLNEXT(ctx, n, ## __VA_ARGS__))

Last edited by NevemTeve; 12-08-2021 at 09:32 AM.
 
Old 12-08-2021, 01:57 PM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
I've built it and uploaded here. If you want to rebuild it from source, you'll additionally need
  • in order to build pl-doc: texlive-a4wide and texlive-tabulary (can be taken from Fedora 19)
  • in order to build pl-odbc: unixODBC-devel (can be installed from Microsoft Prod repo for RHEL 7, NB: not from their repo for CentOS 7)
  • default GCC 4.8.5 in CentOS 7 is too old, I used devtoolset-8 from the SCLO RH repo
 
1 members found this post helpful.
Old 12-08-2021, 03:28 PM   #7
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,786

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by NevemTeve View Post
Calling only cpp doesn't help much either:
vmi-metadata.h:
Code:
      7     Note: this file is generated by ./mkvmi from pl-vmi.c.  DO NOT EDIT....

     15 #define FOREACH_VMI_CALL(sep,f,...) f(D_BREAK, ## __VA_ARGS__) sep() <another 7915 bytes>
## __VA_ARGS__ is a GNU specific extension and you passed -std=c17. Maybe -std=gnu17 or similar would work?

https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
 
1 members found this post helpful.
Old 12-09-2021, 12:15 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880

Original Poster
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
Thank you guys for your help. Still, I'm about going down to version 7.6.4 -- it compiles out of the box, also it doesn't use cmake. [Don't get me wrong, I know cmake is a great software. Or perhaps `large` is the right term.]

Edit: -std=gnu17 did help though, the compilation stopped elsewhere.
 
Old 12-09-2021, 05:23 AM   #9
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
Does the source RPM I linked to above not compile on your system?
 
Old 12-09-2021, 06:33 AM   #10
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880

Original Poster
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
I'll admit, I didn't try it
I prefer to compile programs for source without distribution modifications... Also I need SWI-prolog only for one purpose, which is running this: https://github.com/fnogatz/xsd2json -- and version 7.6.4 is perfectly able to run it.
 
Old 12-09-2021, 06:46 AM   #11
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
I prefer to compile programs for source without distribution modifications...
Interesting. My preferences are the opposite. I create a DEB / an RPM whenever I can, so that all installed software could be managed with distribution package management tools.

Last edited by shruggy; 12-09-2021 at 06:50 AM.
 
  


Reply

Tags
compilation, swi prolog



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any problem if I install CENTOS7 Workstation over CENTOS7 Server? Rich Strebendt Linux - Software 5 05-03-2018 11:05 PM
[SOLVED] Accidently installed two versions of swi-prolog, need help to fix it PJvG Linux - Software 6 10-01-2013 08:41 AM
[SOLVED] -fPIC error while compiling swi-prolog on RHEL 5.4 64bit Hosferatu Linux - Software 4 10-31-2012 05:59 AM
Puppy does not seem to recognize SWI SD Card USB Device TeePup Linux - Newbie 0 11-24-2011 09:22 AM
how to compile a prolog program Randall Programming 1 06-21-2004 12:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration