premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.13k stars 611 forks source link

Error while building Premake 5 on CentOS 7 #2180

Open anr2me opened 5 months ago

anr2me commented 5 months ago

Before opening a new issue, please use the issue search feature to see if a similar issue already exists. If not, please help us help you by filling in the template below.

What are you trying to do? A short, concise description of the outcome you are trying to achieve, ex. "Add build settings to a specific file".

I want to try building premake5 from release source:

cd build/gmake2.unix
make config=release

Due to the pre-built binary requires a different version of shared libm.so.6 and libc.so.6 (the one i have are a different GLIBC versions, and i'm not sure how to get those missing specific version properly):

# /root/premake5
/root/premake5: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /root/premake5)
/root/premake5: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /root/premake5)

# ldd /root/premake5
/root/premake5: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /root/premake5)
/root/premake5: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /root/premake5)
        linux-vdso.so.1 =>  (0x00007ffc0bbc5000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fde7fd18000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fde7fb14000)
        libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fde7f90f000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fde7f541000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fde80220000)

# strings /lib64/libm.so.6 | grep GLIBC_
GLIBC_2.2.5
GLIBC_2.4
GLIBC_2.15
GLIBC_PRIVATE
...

# strings /usr/lib64/libc.so.6 | grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE
...

What problem are you having? A clear and concise description of the problem that is blocking you from your desired outcome, ex. "Premake is crashing with this error message: ..." or "I don't know how to do it."

Getting this error while doing make config=release

ssl_cache.c
ssl_ciphersuites.c
ssl_cli.c
ssl_cookie.c
ssl_msg.c
../../contrib/mbedtls/library/ssl_msg.c: In function ‘mbedtls_ssl_cf_memcpy_if_eq’:
../../contrib/mbedtls/library/ssl_msg.c:1169:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for( size_t i = 0; i < len; i++ )
     ^
../../contrib/mbedtls/library/ssl_msg.c:1169:5: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [obj/Release/mbedtls-lib/ssl_msg.o] Error 1
make: *** [mbedtls-lib] Error 2

I've also tried make -f Bootstrap.mak linux but getting a different error:

# make -f Bootstrap.mak linux
rm -rf ./bin
rm -rf ./build
rm -rf ./obj
mkdir -p build/bootstrap
cc -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"contrib/lua/src" -I"contrib/luashim" src/host/*.c contrib/lua/src/lapi.c contrib/lua/src/lbaselib.c contrib/lua/src/lbitlib.c contrib/lua/src/lcode.c contrib/lua/src/lcorolib.c contrib/lua/src/lctype.c contrib/lua/src/ldblib.c contrib/lua/src/ldebug.c contrib/lua/src/ldo.c contrib/lua/src/ldump.c contrib/lua/src/lfunc.c contrib/lua/src/lgc.c contrib/lua/src/linit.c contrib/lua/src/liolib.c contrib/lua/src/llex.c contrib/lua/src/lmathlib.c contrib/lua/src/lmem.c contrib/lua/src/loadlib.c contrib/lua/src/lobject.c contrib/lua/src/lopcodes.c contrib/lua/src/loslib.c contrib/lua/src/lparser.c contrib/lua/src/lstate.c contrib/lua/src/lstring.c contrib/lua/src/lstrlib.c contrib/lua/src/ltable.c contrib/lua/src/ltablib.c contrib/lua/src/ltm.c contrib/lua/src/lundump.c contrib/lua/src/lutf8lib.c contrib/lua/src/lvm.c contrib/lua/src/lzio.c  -lm -ldl -lrt -luuid
src/host/os_uuid.c:12:23: fatal error: uuid/uuid.h: No such file or directory
 #include <uuid/uuid.h>
                       ^
compilation terminated.
make: *** [linux] Error 1

What have you tried so far? Describe any steps you've already taken to try to get past this issue.

Not sure what to do here, i wished there is an easier way to get premake on CentOS 7 (eg. through yum or something) or at least the pre-built binary doesn't relies on specific version of shared libs (specific major version are okay) or use static libs.

What version of Premake are you using? premake5 --version will show you the version. If you are running a "-dev" version, please make sure you are up to date with the latest master branch. Doesn't have any working premake.

Anything else we should know? Add any other context about the problem here.

Btw, I'm using gcc & g++ 4.8.5 which came from yum install gcc g++, and libc from yum install glibc, not sure what else needed to be installed as there are no library/package prerequisites that need to be installed first on premake's build guide/wiki.

(You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to issues like these!)

nickclark2016 commented 4 months ago

For the uuid header issue, you'll need to install libuuid. I believe for CentOS/RedHat based distros, it is the following install: sudo yum install libuuid libuuid-devel

anr2me commented 4 months ago

Since make config=release failed with an error. Will the make -f Bootstrap.mak linux creates a release version? or build version?

nickclark2016 commented 4 months ago

I'm not 100% sure, what you can do is run make -f Bootstrap.mak to create a premake binary, use that premake binary to generate new makefiles with the gmake2 exporter, then run make on the newly generated makefiles to ensure you've built release. A bit of a roundabout way to do it, but it works well (and is how you would do it if you're building from repository sources instead of release sources).

nickclark2016 commented 4 months ago

Just following up to see if this resolved your question.

anr2me commented 4 months ago

Sorry i didn't had the chance to try it yet (kinda busy with other things), i will update/close this issue if it works.

anr2me commented 4 months ago

Apparently, doing make -f Bootstrap.mak linux gets the same error to make config=release

ssl_msg.c
select.c
../../contrib/mbedtls/library/ssl_msg.c: In function ‘mbedtls_ssl_cf_memcpy_if_eq’:
../../contrib/mbedtls/library/ssl_msg.c:1169:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for( size_t i = 0; i < len; i++ )
     ^
../../contrib/mbedtls/library/ssl_msg.c:1169:5: note: use option -std=c99 or -std=gnu99 to compile your code
sendf.c
share.c
make[2]: *** [obj/Release/mbedtls-lib/ssl_msg.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Btw, I can get a working premake4 binary by installing rpm from opensuse leap 15.5 https://opensuse.pkgs.org/15.5/opensuse-oss-x86_64/premake4-4.4beta4-bp155.2.10.x86_64.rpm.html

And do premake4 gmake (since gmake2 is not valid on premake4), followed by make But getting an error:

==== Building Premake5 (release) ====
Creating obj/Release
ldump.c
lmem.c
lstate.c
liolib.c
loslib.c
lapi.c
lparser.c
ltable.c
...
os_copyfile.c
lua_auxlib.c
path_normalize.c
Linking Premake5
obj/Release/os_uuid.o: In function `os_uuid':
os_uuid.c:(.text+0xb4): undefined reference to `uuid_generate'
collect2: error: ld returned 1 exit status
make[1]: *** [bin/release/premake5] Error 1
make: *** [Premake5] Error 2

I've also tried to do make clean before make but still getting the same error.