gobo-eiffel / gobo

The Gobo Eiffel Project provides the Eiffel community with free and portable Eiffel tools and libraries.
https://sourceforge.net/projects/gobo-eiffel/
Other
59 stars 24 forks source link

Installation problem #78

Open rpx99 opened 2 months ago

rpx99 commented 2 months ago

Hi,

wanted to try gobo and ran the install file. Unfortunately not successful:

tron$ cc -v 
OpenBSD clang version 16.0.6
Target: amd64-unknown-openbsd7.5
Thread model: posix
InstalledDir: /usr/b

tron$ $GOBO/bin/install.sh cc

I receive lots of warnings like:

/home/rpx/Downloads/eiffel/gobo/tool/gec/bootstrap/gec1.c:102915:13: warning: left operand of comma operator has no effect [-Wunused-value]
                R = ((m1, a1, (T0*)0));
                          ^~
58 warnings generated.

And then error:

ld: error: undefined symbol: pthread_mutexattr_init
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_mutex_create)

ld: error: undefined symbol: pthread_mutexattr_settype
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_mutex_create)

ld: error: undefined symbol: pthread_mutexattr_destroy
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_mutex_create)

ld: error: undefined symbol: sem_init
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_semaphore_create)

ld: error: undefined symbol: sem_wait
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_semaphore_wait)

ld: error: undefined symbol: sem_trywait
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_semaphore_try_wait)

ld: error: undefined symbol: sem_post
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_semaphore_post)

ld: error: undefined symbol: sem_destroy
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_semaphore_destroy)

ld: error: undefined symbol: pthread_rwlock_init
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_read_write_lock_create)

ld: error: undefined symbol: pthread_rwlock_rdlock
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_read_write_lock_read_lock)

ld: error: undefined symbol: pthread_rwlock_wrlock
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_read_write_lock_write_lock)

ld: error: undefined symbol: pthread_rwlock_unlock
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_read_write_lock_unlock)

ld: error: undefined symbol: pthread_rwlock_destroy
>>> referenced by gec8.c
>>>               gec8.o:(GE_unprotected_read_write_lock_destroy)

ld: error: undefined symbol: pthread_attr_init
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_attr_setstacksize
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_attr_setschedpolicy
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_attr_setschedparam
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_attr_setdetachstate
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_create
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: undefined symbol: pthread_attr_destroy
>>> referenced by gec8.c
>>>               gec8.o:(GE_thread_create_with_attr)

ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
mv: /home/rpx/Downloads/eiffel/gobo/bin/gec: No such file or directory
/home/rpx/Downloads/eiffel/gobo/tool/gec/bootstrap/bootstrap.sh[245]: /home/rpx/Downloads/eiffel/gobo/bin/gec1: not found
rm: /home/rpx/Downloads/eiffel/gobo/bin/gec1: No such file or directory
mv: /home/rpx/Downloads/eiffel/gobo/bin/gec: No such file or directory
/home/rpx/Downloads/eiffel/gobo/tool/gec/bootstrap/bootstrap.sh[245]: /home/rpx/Downloads/eiffel/gobo/bin/gec1: not found
rm: /home/rpx/Downloads/eiffel/gobo/bin/gec1: No such file or directory
strip: error: 'gec': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gecc': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'geant': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gedoc': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'getest': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gelint': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gecop': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'geimage': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gelex': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'geyacc': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gepp': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[152]: /home/rpx/Downloads/eiffel/gobo/bin/gec: not found
strip: error: 'gexslt': No such file or directory
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[161]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[162]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[163]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[164]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[165]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[166]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[167]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[174]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[174]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[174]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[174]: geant: not found
/home/rpx/Downloads/eiffel/gobo/bin/install.sh[174]: geant: not found
ebezault commented 2 months ago

Although I never tried it on openBSD, I guess that the problem above comes from the fact that the install script does not know that cc means clang. Can clang be called directly on your machine?

$ clang -v

If so, you can try to run:

$GOBO/bin/install.sh clang

Also note that you may run into other problems because as I said above, openBSD is not part of my available platforms. GitHub Actions only provides Linux Ubuntu, MacOs and Windows.

rpx99 commented 2 months ago

Thanks for your swift reply and your suggestion! Looks better but does not compile fully.

tron$ clang -v
OpenBSD clang version 16.0.6
Target: amd64-unknown-openbsd7.5
Thread model: posix
InstalledDir: /usr/bin

tron$ ./bootstrap.sh clang                
Executing bootstrap.sh...
Compiling gec (bootstrap 0)...
gec8.c(gec8.o:(GE_append_to_exception_trace_buffer)): warning: strcpy() is almost always misused, please use strlcpy()
gec8.c(gec8.o:(GE_raise_exception)): warning: sprintf() is often misused, please use snprintf()
Compiling gec (bootstrap 1)...
Degree 6: 0/0/0 0:0:0.049
Degree 5: 0/0/0 0:0:0.287
Degree 4: 0/0/0 0:0:0.153
Degree 3: 0/0/0 0:0:0.225
Degree -2: 0/0/0 0:0:1.625
Degree -3: 0/0/0 0:0:1.031
In file included from gec1.c:59:
In file included from /home/rpx/Downloads/eiffel/gobo/tool/gec/backend/c/boehm_gc/extra/gc.c:75:
/home/rpx/Downloads/eiffel/gobo/tool/gec/backend/c/boehm_gc/extra/../pthread_support.c:392:20: warning: call to undeclared function 'pthread_setname_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (EXPECT(pthread_setname_np(pthread_self(), name_buf) != 0, FALSE))
                   ^
1 warning generated.
gec2.c(gec2.o:(T49s1)): warning: strcpy() is almost always misused, please use strlcpy()
gec11.c(gec11.o:(GE_raise_exception)): warning: sprintf() is often misused, please use snprintf()
ld: error: undefined symbol: pthread_setname_np
>>> referenced by gec1.c
>>>               gec1.o:(GC_mark_thread)
>>> did you mean: pthread_set_name_np
>>> defined in: /usr/lib/libpthread.so.27.1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Degree -4: 0/0/0 0:0:24.008
Total Time: 0/0/0 0:0:27.379
Compiling gec (bootstrap 2)...
mv: /home/rpx/Downloads/eiffel/gobo/bin/gec: No such file or directory
./bootstrap.sh[247]: /home/rpx/Downloads/eiffel/gobo/bin/gec1: not found
rm: /home/rpx/Downloads/eiffel/gobo/bin/gec1: No such file or directory
strip: error: 'gec': No such file or directory

Btw. I tried to copy the clang options as cc options in the bootstrap.sh file but this errors earlier as there are more switches later on.

Executing bootstrap.sh...
Compiling gec (bootstrap 0)...
gec8.c(gec8.o:(GE_append_to_exception_trace_buffer)): warning: strcpy() is almost always misused, please use strlcpy()
gec8.c(gec8.o:(GE_raise_exception)): warning: sprintf() is often misused, please use snprintf()
Compiling gec (bootstrap 1)...
Degree 6: 0/0/0 0:0:0.047
Degree 5: 0/0/0 0:0:0.335
Degree 4: 0/0/0 0:0:0.158
Degree 3: 0/0/0 0:0:0.210
Degree -2: 0/0/0 0:0:1.681
Degree -3: 0/0/0 0:0:1.051
cc: warning: argument unused during compilation: '-fast' [-Wunused-command-line-argument]
In file included from gec11.c:1:
./gec.h:2316:10: fatal error: 'gc.h' file not found
#include "gc.h"
         ^~~~~~
1 error generated.
Degree -4: 0/0/0 0:0:4.035
Total Time: 0/0/0 0:0:7.519
Compiling gec (bootstrap 2)...
mv: /home/rpx/Downloads/eiffel/gobo/bin/gec: No such file or directory
./bootstrap.sh[247]: /home/rpx/Downloads/eiffel/gobo/bin/gec1: not found
rm: /home/rpx/Downloads/eiffel/gobo/bin/gec1: No such file or directory
strip: error: 'gec': No such file or directory

Wonder if cc should not be equal to clang in general?

rpx99 commented 2 months ago

There seems to be even a switch in pthread:support.c


#     ifdef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID /* iOS, OS X */
        (void)pthread_setname_np(name_buf);
#     elif defined(HAVE_PTHREAD_SET_NAME_NP) /* OpenBSD */
        pthread_set_name_np(pthread_self(), name_buf);
#     else /* Linux, Solaris, etc. */
        if (EXPECT(pthread_setname_np(pthread_self(), name_buf) != 0, FALSE))
          WARN("pthread_setname_np failed\n", 0);
#     endif

So it seems HAVE_PTHREAD_SET_NAME_NP is not set?

rpx99 commented 2 months ago

For now I simply removed the code I do not need:


diff --git a/tool/gec/backend/c/boehm_gc/pthread_support.c b/tool/gec/backend/c/boehm_gc/pthread_support.c
index d344503da..295e84032 100644
--- a/tool/gec/backend/c/boehm_gc/pthread_support.c
+++ b/tool/gec/backend/c/boehm_gc/pthread_support.c
@@ -384,14 +384,7 @@
       name_buf[len] = (char)('0' + id % 10);
       name_buf[len + 1] = '\0';

-#     ifdef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID /* iOS, OS X */
-        (void)pthread_setname_np(name_buf);
-#     elif defined(HAVE_PTHREAD_SET_NAME_NP) /* OpenBSD */
-        pthread_set_name_np(pthread_self(), name_buf);
-#     else /* Linux, Solaris, etc. */
-        if (EXPECT(pthread_setname_np(pthread_self(), name_buf) != 0, FALSE))
-          WARN("pthread_setname_np failed\n", 0);
-#     endif
+      pthread_set_name_np(pthread_self(), name_buf);
     }

 # elif defined(GC_WIN32_THREADS) && !defined(MSWINCE)

Doing it properly would mean to define HAVE_PTHREAD_SET_NAME_NP in gec.h ?


#if defined(__clang__)
#   define HAVE_DL_ITERATE_PHDR
#   define GC_REQUIRE_WCSDUP
#   define HAVE_DLADDR
#   define HAVE_SYS_TYPES_H
#   define HAVE_UNISTD_H
#   if defined(GE_MACOS)
#       define HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
#   elif !defined(GE_WINDOWS)
#       define HAVE_PTHREAD_SETNAME_NP_WITH_TID
#       define HAVE_PTHREAD_SIGMASK
#       define NO_GETCONTEXT
#   endif
#endif
rpx99 commented 2 months ago

The next issue appears now here:


Compiling gexslt...
Degree 6: 0/0/0 0:0:0.038
Degree 5: 0/0/0 0:0:0.550
Degree 4: 0/0/0 0:0:0.241
Degree 3: 0/0/0 0:0:0.159
Degree -2: 0/0/0 0:0:6.527
Degree -3: 0/0/0 0:0:2.742
gexslt25.c(gexslt25.o:(GE_append_to_exception_trace_buffer)): warning: strcpy() is almost always misused, please use strlcpy()
gexslt25.c(gexslt25.o:(GE_raise_exception)): warning: sprintf() is often misused, please use snprintf()
ld: error: undefined symbol: pow
>>> referenced by gexslt6.c
>>>               gexslt6.o:(T371f46)
>>> referenced by gexslt6.c
>>>               gexslt6.o:(T371f46)
>>> referenced by gexslt6.c
>>>               gexslt6.o:(T17f41)
>>> referenced 13 more times

ld: error: undefined symbol: floor
>>> referenced by gexslt19.c
>>>               gexslt19.o:(T836f115)
>>> referenced by gexslt19.c
>>>               gexslt19.o:(T835f113)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Degree -4: 0/0/0 0:0:49.197
Total Time: 0/0/0 0:0:59.454
strip: error: 'gexslt': No such file or directory
Cleaning up...

I tried to link with -lm but doesn't seem to work. Any idea ?

/* description:

    "C functions used to implement class REAL"

system: "Gobo Eiffel Compiler"
copyright: "Copyright (c) 2006-2019, Eric Bezault and others"
license: "MIT License"

*/

ifndef GE_REAL_H

define GE_REAL_H

if defined(_MSC_VER) && (_MSC_VER >= 1020)

pragma once

endif

ifndef GE_EIFFEL_H

include "ge_eiffel.h"

endif

include

ifndef GE_power

define GE_power(x,y) pow((x),(y))

endif

define GE_ceiling(x) ceil(x)

define GE_floor(x) floor(x)