1. BROKE AGAIN euc on UBUNTU 20.04 LTS

-- 
-- Euc.ex 
-- 
 
constant USAGE = sprintf("%s", {""" 

   usage: 
   eui Euc.ex appname.ex     -- default compile with only one core utilized 
   eui Euc.ex appname.ex x   -- where x is the number of jobs/cores to utilize 
   Euc appname.ex x          -- if Euc.ex is compiled/bound/shrouded and  
                              -- placed in bin directory 
   """})                             

 
include std/filesys.e 
include std/convert.e 
include std/text.e 
include std/console.e 
 
integer CORES     
constant CORES_MAX = 8  -- system dependent 
sequence cmd, appname, appname_mak, COMPILE 
 
cmd = command_line()  
if length(cmd)<3 then 
   display(USAGE) 
   any_key() 
   abort(0) 
elsif length(cmd)>=3 then 
   appname = cmd[3] 
   COMPILE = filebase(appname) 
end if 
 
if length(cmd) = 3 then 
   system_exec("euc -extra-lflags=\"-no-pie\""&' '& cmd[3]) 
elsif length(cmd) = 4 then 
   CORES = to_number(cmd[4]) 
   if CORES > CORES_MAX then CORES = CORES_MAX end if 
    appname_mak = filebase(appname)&".mak" 
    system_exec("euc -build-dir build -extra-lflags=\"-no-pie\" -makefile"&' '&appname) 
    system(text:format("make -j[] -f [] -C build",{CORES,appname_mak})) -- Thanks Irv Mullins! 
end if 
 
system("upx "&COMPILE) 
----------------------------------------------------------------------------------------------------- 
--  Based on ghaberak's compile script from OpenEuForum. 
--  https://openeuphoria.org/forum/m/134187.wc: 
--  euc -build-dir build -extra-lflags="-no-pie" -makefile appname.ex  
--  make -j8 -f appname.mak -C build  
----------------------------------------------------------------------------------------------------- 
--  https://openeuphoria.org/forum/m/134183.wc: 
--  "As of Ubuntu 17.10, their GCC uses -fPIE (position independent executable)  
--  as the default over -fPIC (position independent code).  
--  You just need to add -extra-lflags="-no-pie" to the command line.  
--  euc -extra-lflags="-no-pie" search.ex"  
----------------------------------------------------------------------------------------------------- 
--  euc options 
-- 
--    -build-dir - use the named directory (default is build-[random number]) 
--    -extra-lflags - required on Ubuntu 17.10+ as discussed previously 
--    -makefile - generate a makefile instead of compiling directly  
--                      (will be named [build-dir]/[basename].mak)  
-- 
--   make options 
-- 
--    -j (or --jobs) - use this many simultaneous jobs  
--                        (usually one job per core/thread) 
--    -f (or --file) - use the specified makefile (default is Makefile) 
--    -C (or --directory) - change to the specified directory before doing anything  
-- 
-- This works on Windows or Linux. Only difference is you need to use  
-- mingw32-make instead of just make on Windows.  
----------------------------------------------------------------------------------------------------- 

Compiling  98% db_tools.c 
Linking 100% ../budget_builder 
/usr/bin/ld: /home/ken/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/bin/ld: /home/ken/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/bin/ld: /home/ken/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/bin/ld: /home/ken/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/ken/euprogs/bank_book/budget_builder 
Status: 1 Command: gcc -o /home/ken/euprogs/bank_book/budget_builder  init-.o budget_builder.o main-.o eds.o types.o convert.o search.o text.o error.o filesys.o datetime.o dll.o machine.o memory.o get.o io.o scinot.o math.o sequence.o sort.o wildcard.o pretty.o console.o eumem.o graphcst.o get_datetime.o reg_graphics.o graphics.o register.o xbackup.o db_tools.o   /home/ken/euphoria-4.1.0-Linux-x64/bin/eu.a -m64 -ldl -lm -lpthread -no-pie 

Any suggestions will be deeply appreciated..

Regards, Ken

new topic     » topic index » view message » categorize

2. Re: BROKE AGAIN euc on UBUNTU 20.04 LTS

Seems other people are having the same problem, but I don't know enough to have a solution:

https://stackoverflow.com/questions/61580159/undefined-references-to-libm-symbols-after-upgrading-linux-distro

https://github.com/JohannesBuchner/cuba/issues/1

It seems that there is some connection with the use of -ffast-math flag in gcc? Euc uses that:

gcc -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -I/usr/local/include -ffast-math hello.c -o hello.o

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

3. DOES euc work with the latest version of Linux Mint?

Which version of Linux Mint are you using now, Irv?

Anyone else using a recent version Linux Distro which runs euc up to snuff?

Regards, Ken

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

4. Re: DOES euc work with the latest version of Linux Mint?

Senator said...

Which version of Linux Mint are you using now, Irv?

Anyone else using a recent version Linux Distro which runs euc up to snuff?

Regards, Ken

System: Host: irv-Mint19 Kernel: 4.15.0-54-generic x86_64 bits: 64 compiler: gcc v: 7.4.0 Desktop: Cinnamon 4.2.3 wm: muffin dm: LightDM Distro: Linux Mint 19.2 Tina base: Ubuntu 18.04 bionic

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

5. Re: DOES euc work with the latest version of Linux Mint?

Here's something you can try, since most of the discussion on the web involves -ffast-math:

euc -keep -build-dir build -extra-lflags="-no-pie" -makefile hello.ex

Open the /build/hello.mak file

 
CC     = gcc 
CFLAGS =  -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -I/usr/local/include -ffast-math 
LINKER = gcc 
LFLAGS =  $(RUNTIME_LIBRARY) -m64 -ldl -lm -lpthread -no-pie 
... 

Remove the -ffast-math from the end of the 2nd line and save it. Then run make (specify no. of cores with -j, or leave it out)

make -j8 -f hello.mak -C build

On my Linux version, test program compiles correctly with or without the -ffast-math.

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

6. Re: BROKE AGAIN euc on UBUNTU 20.04 LTS

I can confirm this seems to be broken on Ubuntu 20.04. I believe it's related to the later version of libc changing the way finite math functions are presented in the math library (libm).

Ken is running Ubuntu 20.04 while Irv is running Linux Mint 19, which is based on Ubuntu 18.04. I've got a VM of each set up and you can see the differences here:

libc on Linux Mint 19 is version 2.27

greg@linuxmint-vbox:~$ apt show libc6 
Package: libc6 
Version: 2.27-3ubuntu1.2 

libc on Ubuntu 20.04 is version 2.31

greg@ubuntu-vbox:~$ apt show libc6 
Package: libc6 
Version: 2.31-0ubuntu9.1 

This thread on the libc-alpha mailing list seems to confirm the problem: https://sourceware.org/pipermail/libc-alpha/2020-May/thread.html#113773

I don't really have a solution at the moment. You could just build your project on Ubuntu 18.04 and it should work on all future versions.

You could also build Euphoria from source on the Ubuntu 20.04 system and it should work, but obviously that has its own set of issues.

-Greg

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

7. Re: BROKE AGAIN euc on UBUNTU 20.04 LTS

I've read what I could find, and I haven't found a proposed solution that I understand how to implement. What does "link with -lm" mean? And how to do it?

Edit 1: also, some change I made recently in EuGTK causes it to seg-fault, so I rolled it back to Oct. 2019

I haven't compiled a program in a long time. Finding the cause of the seg-fault isn't something that interests me very much, since I discovered that binding vs. compiling shows very little difference even on a lowly Raspberry Pi 3.

Edit 2: comparing bear.ex - a rather large program that includes several libraries:

Compiled version - load and display window and controls, and 2 files, ready for input - .6049 sec Interpreted version- .6845 sec Bound version - .6197 sec.

I don't think 8/100ths of a second is going to make a lot of difference :)

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

8. Re: BROKE AGAIN euc on UBUNTU 20.04 LTS

irv said...

I've read what I could find, and I haven't found a proposed solution that I understand how to implement. What does "link with -lm" mean? And how to do it?

libm is the math library for libc. The interpreter is already linked against that and the translator links your app against libm as well.

When I look at libm with objdump or nm, it looks like those symbols are present, but the linker still says they're not. I'm unsure of why.

irv said...

I haven't compiled a program in a long time. Finding the cause of the seg-fault isn't something that interests me very much, since I discovered that binding vs. compiling shows very little difference even on a lowly Raspberry Pi 3.

Compiled version - load and display window and controls, and 2 files, ready for input - .6049 sec Interpreted version- .6845 sec Bound version - .6197 sec.

I don't think 8/100ths of a second is going to make a lot of difference :)

Yeah that's a pretty insignificant difference.

I think translating is only really necessary when A) there's a speed gain to be had, or B) you need to something advanced like linking static resources (i.e. adding an icon on Windows).

-Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu