I am trying to build lua-5.3.1 in Red Hat Enterprise Linux 6.6 platform. Following binaries will be build :
shared library : liblua.so
executable : lua
executable : luac
I have made the following changes in the provided Makefile :
Existing :
CC= gcc -std=gnu99
LUA_A= liblua.a
$(LUA_A): $(BASE_O)
$(AR) $# $(BASE_O)
$(RANLIB) $#
Modified :
CC= gcc -fPIC
LUA_A= liblua.so
$(LUA_A): $(BASE_O)
$(CC) -mthreads -shared -o $(LUA_A) $(BASE_O)
'liblua.so' and 'lua' have been built successfully using the modified Makefile. But during 'luac' build following linking error is coming :
gcc -fPIC -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -c -o luac.o luac.c
gcc -fPIC -o luac luac.o liblua.so -lm -Wl,-E -ldl -lreadline
luac.o: In function `PrintFunction':
luac.c:(.text+0x947): undefined reference to `luaP_opnames'
luac.c:(.text+0x963): undefined reference to `luaP_opmodes'
luac.o: In function `pmain':
luac.c:(.text+0x11db): undefined reference to `luaU_dump'
/usr/bin/ld: luac: hidden symbol `luaU_dump' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [luac] Error 1
make[1]: Leaving directory `/disk1/u10rhel66/lua-5.3.1/src'
make: *** [linux] Error 2
Any help will be appreciated.
luac must be built statically linked with liblua.a.
If you really want luac linked dynamically, try this:
remove LUAI_DDEF and LUAI_DDEC from lopcodes.c and lopcodes.h
remove LUAI_FUNC from lundump.h
rebuild
Related
Mupdf no longer compiles on macOS 12.16.1. Using MacPorts for instance gives:
:info:build mkdir -p build/shared-release/generated/resources/fonts/noto/ ; /usr/bin/clang -ffunction-sections -fdata-sections -pipe -O2 -DNDEBUG -fomit-frame-pointer -Os -arch x86_64 -Iinclude -MMD -MP -o build/shared-release/generated/resources/fonts/noto/NotoSansOldPermic-Regular.otf.o -c generated/resources/fonts/noto/NotoSansOldPermic-Regular.otf.c -Wall -Wsign-compare -fPIC -O0
:info:build mkdir -p build/shared-release/generated/resources/fonts/noto/ ; /usr/bin/clang -ffunction-sections -fdata-sections -pipe -O2 -DNDEBUG -fomit-frame-pointer -Os -arch x86_64 -Iinclude -MMD -MP -o build/shared-release/generated/resources/fonts/noto/NotoSansOldPersian-Regular.otf.o -c generated/resources/fonts/noto/NotoSansOldPersian-Regular.otf.c -Wall -Wsign-compare -fPIC -O0
:info:build clang: note: diagnostic msg:
:info:build ********************
:info:build PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
:info:build Preprocessed source(s) and associated run script(s) are located at:
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.tmp/SourceHanSerif-Regular-5d1585.c
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.tmp/SourceHanSerif-Regular-5d1585.sh
:info:build clang: note: diagnostic msg: Crash backtrace is located in
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.home/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
:info:build clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
:info:build clang: note: diagnostic msg:
:info:build ********************
:info:build make[1]: *** [build/shared-release/generated/resources/fonts/han/SourceHanSerif-Regular.ttc.o] Error 254
:info:build make[1]: *** Waiting for unfinished jobs....
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source'
:info:build make: *** [shared-release] Error 2
:info:build make: *** Waiting for unfinished jobs....
:info:build make: Leaving directory `/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source'
:info:build Command failed: cd "/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source" && /usr/bin/make -j6 -w all PREFIX=/opt/local CC=/usr/bin/clang CXX=/usr/bin/clang++ CPP=/usr/bin/cpp XCFLAGS="-Os -arch x86_64" XLIBS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" HAVE_GLUT=yes HAVE_X11=no USE_SYSTEM_LIBS=yes build=release verbose=yes shared
:info:build Exit code: 2
:error:build Failed to build mupdf: command execution failed
:debug:build Error code: CHILDSTATUS 99706 2
:debug:build Backtrace: command execution failed
:debug:build while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build (procedure "portbuild::build_main" line 8)
:debug:build invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/main.log for details.
In MacPorts this is a known issue and it seems related to clang not being able to compile something because it runs out of resources when compiling NotoSansOldPersian-Regular.otf
Is there maybe a config or something we could temporary workaround by telling the mupdf configure not to compile this font? People (see ticket) already tried turning optimization off, using another compiler, but it is a more fundamental problem.
I'm using lua-cjson
package.path = package.path .. ";../?.lua"
local json = require('cjson')
And I'm getting:
lua: error loading module 'cjson' from file '/usr/local/lib/lua/5.3/cjson.so':
dlopen(/usr/local/lib/lua/5.3/cjson.so, 6): Symbol not found: _lua_objlen
Referenced from: /usr/local/lib/lua/5.3/cjson.so
Expected in: flat namespace
in /usr/local/lib/lua/5.3/cjson.so
stack traceback:
[C]: in ?
[C]: in function 'require'
log.lua:6: in main chunk
[C]: in ?
Any ideas? Using lua 5.3
Downgrade to 2.1.0-1 as mentioned by #James Penick
luarocks remove lua-cjson
luarocks install lua-cjson 2.1.0-1
Installing https://luarocks.org/lua-cjson-2.1.0-1.src.rock
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c lua_cjson.c -o lua_cjson.o
In file included from lua_cjson.c:47:
./fpconv.h:15:20: warning: inline function 'fpconv_init' is not defined [-Wundefined-inline]
extern inline void fpconv_init();
^
lua_cjson.c:1359:5: note: used here
fpconv_init();
^
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c strbuf.c -o strbuf.o
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c fpconv.c -o fpconv.o
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o cjson.so -L/usr/local/lib lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0-1 is now installed in /usr/local (license: MIT)
The problem is related to the warning message when installing lua-cjson-2.1.0.6-1
Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c lua_cjson.c -o lua_cjson.o
lua_cjson.c:743:19: warning: implicit declaration of function 'lua_objlen' is invalid in C99 [-Wimplicit-function-declaration]
len = lua_objlen(l, -1);
^
1 warning generated.
It looks like an issue was just opened on github for this problem: https://github.com/mpx/lua-cjson/issues/56. For what it's worth, here's the workaround that I posted on github:
I'm seeing the same issue on alpine linux with with version 2.1.0.6-1 of lua-cjson, I'm currently working around the issue by explicitly specifying version 2.1.0-1.
I have written a simple pushbutton example code (Ubuntu 14.01) and it is giving me strange error after make.
Following is the o/p of make:
gcc -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/i386-linux-gnu/qt5/mkspecs/linux-g++ -I. -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o .o /
gcc: warning: /: linker input file unused because linking not done
g++ -Wl,-O1 -o PushButtonExample\ TEMPLATE\ =\ app main.o .o mainwindow.o moc_mainwindow.o -lQt5Widgets -L/usr/lib/i386-linux-gnu -lQt5Gui -lQt5Core -lGL -lpthread
g++: error: .o: No such file or directory
make: *** [PushButtonExample TEMPLATE = app] Error 1
From above o/p, I am not really getting the meaning of g++: error: .o: No such file or directory, because it is not showing any file name. I searched for similar issue on Internet, but everywhere there is a file.o scenario.
Kindly help me through.
Try change your .pro file as below:
TEMPLATE = app
TARGET = QtHelloWorld
QT += core gui
QT += widgets
SOURCES += main.cpp
SOURCES += mainwindow.cpp
HEADERS += mainwindow.h
recently I updated my armadillo to version 5.200.1, but when i tried to compile my code using
g++ -std=c++11 -m64 -O3 -Wall -I. -I/opt/OpenBLAS/include -fopenmp -o code.cpp.o -c code.cpp
g++ -std=c++11 -m64 -O3 -Wall -I. -I/opt/OpenBLAS/include -fopenmp -o main.cpp.o -c main.cpp
g++ -std=c++11 -m64 -O3 -o code.cpp.o main.cpp.o -lgomp -L/opt/OpenBLAS/lib -lopenblas -larmadillo
I got error message in the final linking step
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libarmadillo.so:
undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
make: *** [a.out] Error 1
This error appears in my machine with Ubuntu 14.04LTS + gcc 4.9.2.
The Armadillo itself is linked with OpenBLAS 0.2.14 (I followed the procedure provided by Armadillo in installation)
such error doesn't occur in my macosx laptop (the same library). It means something problems with my ubuntu machine. I tried to re-install the Armadillo 4.650.2 (this version worked before), but the same error kept appearing (now older doesn't work like before). The only thing that i did before updating those libraries were "apt-self update" and "apt-self upgrade" of my ubuntu machine
is there any suggestion to fix this problem?
I also use armadillo on Ubuntu Linux
I had the same problem first when I started to program with armadillo. For g++ I only had to add -larmadillo as command line option. such as this
g++ -O2 -o armadillo_example armadillo_example.cpp -larmadillo
I got a good Automatic Number Plate Recognition Project from github (https://github.com/kornelik/anpr ). In order to run this we need OpenCV and Tesseract Optical Character Recognition library (https://code.google.com/p/tesseract-ocr/). It works fine in my Ubuntu 12.04 , 32bit system.
The problem is that while I setting the same working code in another system (Ubuntu 12.04 , 32 bit) after configuring OpenCV and Tesseract it produces the following error while making the project.I am struggling to find out what is the issue
The error is
g++ -Wall -Werror -O2 -c main.cpp -o main.o
g++ -Wall -Werror -O2 -c recognizer.cpp -o recognizer.o
g++ -Wall -Werror -O2 -c conio.cpp -o conio.o
g++ -Wall -Werror -O2 -c ocr_char.cpp -o ocr_char.o
ocr_char.cpp: In constructor ‘anpr::OCRChar::Impl::Impl(const string&, const string&)’:
ocr_char.cpp:17:9: error: ‘set’ is not a member of ‘std’
ocr_char.cpp:17:18: error: expected primary-expression before ‘char’
ocr_char.cpp:17:18: error: expected ‘;’ before ‘char’
ocr_char.cpp:23:17: error: ‘goodChars’ was not declared in this scope
make: *** [ocr_char.o] Error 1
Is your code updated? On nov 2013 there was a commit to include the set header:
https://github.com/kornelik/anpr/commit/2a63fb362e6fc79ac73f172195a893b37287d3bf
The error message you got seems to be related to that.
Compiled ok on Ubuntu 14.04 64 bits.