1. Linking errors

Hi all
Having just retired, I'm getting back to programming after many years and look forward to reacquainting with Euphoria. I set up both the Geany editor and Wee and tried out hello world, which was fine when interpreted but got these linking errors when I tried to translate and compile (The compilation part succeeded 100% so I'm only showing the linking errors):

/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a(be_runtime.o): in function `power': 
be_runtime.c:(.text+0x4061): undefined reference to `__powl_finite' 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a(be_runtime.o): in function `Dpower': 
be_runtime.c:(.text+0x40dc): undefined reference to `__powl_finite' 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a(be_runtime.o): in function `e_log': 
be_runtime.c:(.text+0x417f): undefined reference to `__log_finite' 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a(be_runtime.o): in function `De_log': 
be_runtime.c:(.text+0x41c1): undefined reference to `__log_finite' 
collect2: error: ld returned 1 exit status 
Unable to link /home/peter/Projects/Tests/hello 
Status: 1 Command: gcc -o /home/peter/Projects/Tests/hello  init-.o hello.o main-.o   /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a -m64 -ldl -lm -lpthread 
which: no upx in (/usr/local/bin:/usr/bin:/bin) 
/tmp/wee_run_722663.sh: line 5: ./hello: No such file or directory 
Any idea what's wrong here.? (Running linux OpenSuse 15.6 - current version).
PeterR

new topic     » topic index » view message » categorize

2. Re: Linking errors

I "think" I got those kinds of errors when trying to compile with Euphoria 4.1. I've been using 4.2 for a while now, and it compiles in the usual manner: euc hello

You could try this to see if it helps:

Although for most purposes, interpreting or binding programs works fine, if you wish to compile your program, on newest Linux distros (e.g. Mint 19 and later) euc fails: You'll need to run a short script, shown below.

Replace the -j8 with -j[n] where [n] is the number of processors you have. Makes things faster.

euc -build-dir build -extra-lflags="-no-pie" -makefile $1.ex
make -j8 -f $1.mak -C build

I named the script 'compile', make it executable, and call it like this: ./compile hello

irv@irv-desktop:~$ ./compile hello 
Translating code, pass: 1 2 3  generating 
 
3.c files were created. 
To build your project, change directory to build/ and type make -f hello.mak 
make: Entering directory '/home/irv/build' 
gcc -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -I/usr/local/euphoria-4.1.0-Linux-x64 -ffast-math init-.c -o init-.o 
gcc -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -I/usr/local/euphoria-4.1.0-Linux-x64 -ffast-math hello.c -o hello.o 
gcc -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -I/usr/local/euphoria-4.1.0-Linux-x64 -ffast-math main-.c -o main-.o 
gcc -o /home/irv/hello init-.o hello.o main-.o  /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a -m64 -ldl -lm -lpthread -no-pie 
make: Leaving directory '/home/irv/build' 

You can ignore all that extra text, don't bother about the changing to build and typing make, etc... it's already been done for you.

irv@irv-desktop:~$ ./hello 
Hello World! 

new topic     » goto parent     » topic index » view message » categorize

3. Re: Linking errors

peterR said...

Having just retired, I'm getting back to programming after many years and look forward to reacquainting with Euphoria.

Welcome back!

peterR said...

Any idea what's wrong here.? (Running linux OpenSuse 15.6 - current version).

This is caused by later versions of libm having removed those functions (__powl_finite, etc.) in recent distros.

For reference, this was also discussed here:

There's no immediate fix until we can get a new release out. Best solutions I can offer, as stated in the last thread:

  • don't bother with translating for now (you probably don't need it)
  • build on an older distro (the executable should be forward-compatible)
  • build your own copy of the library from source: https://openeuphoria.org/forum/m/136073.wc

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: Linking errors

Thanks for that, Irv, but I'm afraid it doesn't work for me. I get the same errors as before but preceded by those extra words that you cite. The fact that it works for you but not for me makes me more curious. As has been said elsewhere, binding works really well so compilation is unnecessary - but I may explore a bit more. (By the way, I had already tried out your suggestion as I found it on the Wiki re GTK, though at the time I had no idea whether it was GTK-specific).
Cheers
Peter

new topic     » goto parent     » topic index » view message » categorize

5. Re: Linking errors

Thanks, Greg.
I'm happy with binding at the moment, but my interest is piqued. I did try to locate the errors in forum history but obviously did a poor search. I mainly posted because I deliberately followed the instructions available to a new user and found that the compiler didn't work for the simplest program, which I thought might put off new users.
The posts seem to suggest that this is not a problem for the new version of the compiler. Could I just download the 4.2 version and replace euc? Would that work with Open Euphoria 4.1?
Cheers
Peter
PS Should I be forking these replies rather than just adding them to the Reply list? The fork option looked like it created a new thread.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Linking errors

I followed the "build from source" instructions on the downloads page, and had no trouble building 4.2

Granted, that is off-putting to prospective new users.

That said, there's really little to no benefit to compiling a program. It's mostly a waste of time, in my opinion, one that might have been useful when we were running original IBM pc's back in the previous century.

The only reason someone might have to compile a Eu program would be if they're planning to sell or distribute it to the public. And so far, that has never happened AFAIK.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Linking errors

Hi

Beg to differ there was a t least one music program, a winamp like affair that was sold.

And wasn't Lemon Heads shareware?

C

new topic     » goto parent     » topic index » view message » categorize

8. Re: Linking errors

irv said...

That said, there's really little to no benefit to compiling a program. It's mostly a waste of time, in my opinion, one that might have been useful when we were running original IBM pc's back in the previous century.

I agree that translating is mostly unnecessary, but I have had a few occasions where I'm doing enough work that it has saved me a lot of time.

You'd think it's the "this will take hours" type of work but no, it's actually the "this takes several seconds" and it's just long enough to be frustrating.

Run the program through the translator and now it runs in half a second, and I can move on to actually using it for whatever I intended.

irv said...

The only reason someone might have to compile a Eu program would be if they're planning to sell or distribute it to the public. And so far, that has never happened AFAIK.

The binaries for Euphoria itself are built with the translator and distributed to the public. So at least we're eating our own dog food, so to speak.

-Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu