I am trying to build assimp-5.0.0 using MinGW64.
CMake CMakeLists.txt -G"MinGW Makefiles" ran without issues.
But when I call mingw32-make, I get the following issue at
[ 73%] Linking CXX executable ..\..\bin\assimp.exe:
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x8d): undefined reference to Assimp::Importer::ValidateFlags(unsigned int) const
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0xc4): undefined reference to Assimp::Importer::ReadFile(char const*, unsigned int)
...
CMakeFiles\assimp_cmd.dir/objects.a(Export.cpp.obj):Export.cpp:(.text+0xf44): undefined reference to `Assimp::Exporter::GetExportFormatDescription(unsigned long long) const'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [tools\assimp_cmd\CMakeFiles\assimp_cmd.dir\build.make:195: bin/assimp.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:337: tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2
I have found a github thread with the same issue here https://github.com/assimp/assimp/issues/2431 and the creator says it is fixed... but it doesn't seem that way.
Any idea on how to fix it?
Sorry for the inconvenience. I thought that this issue was already fixed by another commit. I have reopened the issue report.
When building assimp 5.0.1 with MinGW-w64 I noticed there were some dllexport/dllimport issues.
In my case they were resolved by this patch:
patch -ulbf include/assimp/defs.h << EOF
## -128,3 +128,3 ##
-#ifdef _MSC_VER
+#ifdef _WIN32
# undef ASSIMP_API
EOF
Related
I am trying to build libvpx as a static library, to be later used in an FFmpeg build and I am having trouble. The version of libvpx I am using is 1.6.0.
Here's my config:
./configure --prefix=/home/test/Dev/build-x64/libvpx/ --enable-static --disable-shared --target=x86_64-linux-gcc
And during make, there are lots of errors being dumped on screen:
[LD] test_libvpx
test/add_noise_test.cc.o: In function `(anonymous namespace)::gtest_CAddNoiseTest_EvalGenerator_()':
add_noise_test.cc:(.text+0x342): undefined reference to `vpx_plane_add_noise_c'
test/add_noise_test.cc.o: In function `(anonymous namespace)::gtest_SSE2AddNoiseTest_EvalGenerator_()':
add_noise_test.cc:(.text+0x492): undefined reference to `vpx_plane_add_noise_sse2'
test/add_noise_test.cc.o: In function `(anonymous namespace)::AddNoiseTest_CheckCvsAssembly_Test::TestBody()':
add_noise_test.cc:(.text+0x2437): undefined reference to `vpx_setup_noise'
add_noise_test.cc:(.text+0x2448): undefined reference to `vpx_calloc'
add_noise_test.cc:(.text+0x245a): undefined reference to `vpx_calloc'
add_noise_test.cc:(.text+0x2779): undefined reference to `vpx_plane_add_noise_c'
add_noise_test.cc:(.text+0x2934): undefined reference to `vpx_free'
add_noise_test.cc:(.text+0x293c): undefined reference to `vpx_free'
(...and a lot more.)
Recognising that the error started with tests, I tried disabling unit test:
./configure --prefix=/home/test/Dev/build-x64/libvpx/ --enable-static --disable-shared --target=x86_64-linux-gcc --disable-unit-tests
And got this instead:
(...lots of lines...)
[CC] examples/resize_util.c.o
[LD] examples/resize_util
examples/resize_util.c.o: In function main':
resize_util.c:(.text.startup+0x1e8): undefined reference tovp9_resize_frame420'
collect2: error: ld returned 1 exit status
make[1]: * [examples/resize_util] Error 1
make: * [.DEFAULT] Error 2
I have libogg 1.3.1 and libvorbis 1.3.2 on my computer. (Not sure if they're used at all.)
I'm stumped, and I would really appreciate some guidance here.
Some files from earlier builds are still present (libs-armv7-linux-gcc.mk), despite having called make clean earlier.
I decided to give it one last shot, by starting over in a new directory and it worked. The files from earlier build might be interfering somehow. I should have used make distclean instead.
I would like to cross-compile lmbench for ARM64, on a x86 machine. I have built my own cross-compiler according to the guide here: http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
When I tried cross-compiling lmbench3 with this cross-compiler I first had to:
remove all the lines where bk.ver was used in the src/Makefile
replace bk.ver by 3 at line 200 of the Makefile, so that I have:
sed -e "s/<version>/3/g" < ../scripts/lmbench > $O/lmbench
Set CC=aarch64-linux-gcc, OS=aarch64-linux-gnu, CFLAGS="$CFLAGS -static"
Put all the glibc-2.20/sunrpc/rpc header files into /opt/cross/aarch64-linux/include/rpc folder
Then when I type the make command I get the following error:
gmake[1]: Entering directory `/home/florian/lmbench3/src'
aarch64-linux-gcc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -DHAVE_SCHED_SETAFFINITY=1 -o ../bin/aarch64-linux-gnu/bw_tcp bw_tcp.c ../bin/aarch64-linux-gnu/lmbench.a -lm
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_done':
lib_tcp.c:(.text+0x18): undefined reference to `pmap_unset'
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_connect':
lib_tcp.c:(.text+0x338): undefined reference to `pmap_getport'
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_server':
lib_tcp.c:(.text+0x568): undefined reference to `pmap_unset'
lib_tcp.c:(.text+0x584): undefined reference to `pmap_set'
collect2: error: ld returned 1 exit status
gmake[1]: *** [../bin/aarch64-linux-gnu/bw_tcp] Error 1
gmake[1]: Leaving directory `/home/florian/lmbench3/src'
make: *** [lmbench] Error 2
I know that pmap_set, pmap_unset and pmap_getport are called in lib_tcp.c, but I don't find anywhere their definitions. When I compile lmbench3 for x86 I don't get this error, and I checked everywhere on the host machine for the definition of these functions, but still don't find them anywhere.
Does anyone know what to do with this error? I guess I still need to use RPC, so I'd prefer not commenting any line.
From the error info, ld didn't find the lib, try following
make results LDFLAGS=-ltirpc
I've tired to maintenance the latest VIM/GVIM for windows, here is my OpenSource project.
However, I found the compile always failed by cygwin since the vim version higher than v7.4.399 (including v7.4.399).
Version less than v7.4.399 can be compiled with the same command successfully!
Failed Information:
obj/ex_docmd.o:ex_docmd.c:(.text+0x45f): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xbb7): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0xbe6): undefined reference to `crypt_encode_alloc'
obj/fileio.o:fileio.c:(.text+0xd69): undefined reference to `crypt_encode_inplace'
obj/fileio.o:fileio.c:(.text+0x69e3): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c66): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c97): undefined reference to `crypt_free_key'
obj/fileio.o:fileio.c:(.text+0x716f): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x7177): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x8e48): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0x8e73): undefined reference to `crypt_decode_inplace'
obj/fileio.o:fileio.c:(.text+0x906d): undefined reference to `crypt_method_nr_from_magic'
obj/fileio.o:fileio.c:(.text+0x9098): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90c8): undefined reference to `crypt_create_from_header'
obj/fileio.o:fileio.c:(.text+0x90df): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90e7): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x9158): undefined reference to `crypt_decode_alloc'
obj/fileio.o:fileio.c:(.text+0x9e3f): undefined reference to `crypt_append_msg'
obj/fileio.o:fileio.c:(.text+0x9ed4): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x9edc): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0xa5bc): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xca32): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0xdd15): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0xdd37): undefined reference to `crypt_create_for_writing'
obj/fileio.o:fileio.c:(.text+0xe2d2): undefined reference to `crypt_append_msg'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: obj/fileio.o: bad reloc address 0x2e8 in section `.rdata'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Make_cyg.mak:603: recipe for target 'vim.exe' failed
make: *** [vim.exe] Error 1
The compile command:
make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
I checked the difference between v7-4-398 and v7-4-399, and found there something updated with encryption. Then I added the libs and other stuff about crypt in cygwin as below, but the compile still CANNOT work....
What should I do can compile the higher version vim ?
Environments:
Cygwin version: Latest setup-x86_64.exe, mintty 1.2-beta1 (x86_64-pc-cygwin)
Have you tried compiling with all the patches that are currently available. I think Bram Moolenaar (Maintainer for vim) forgot to add some of the files in one of the patches and one of the later one fixes that. If not post to vim_dev#vim.org
This was also reported to at https://groups.google.com/forum/#!topic/vim_dev/D8FyRd0EwlE.
Patch 7.4.401 should fix it https://groups.google.com/forum/#!topic/vim_dev/q0dbl0_9k9U
Got this issue again on CentOS 7, Python 2.7.10, 64bit.
According to this answer, this issue has been fixed;
export vi_cv_path_python_plibs="-L/<python_config_path> ..."
For example in my situation:
export vi_cv_path_python_plibs="-L/usr/local/lib/python2.7/config ..."
Compile command:
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp --with-python-config-dir=/usr/local/lib/python2.7/config --with-features=huge --disable-smack --enable-cscope --with-tlib=ncurses --with-compiledby=marslo#china
$ cd src && make first
$ cd .. && make
$ make install
You can disable sodium library in ./configure such as :
./configure -disable-libsodium
Recently when I try to compile a large Fortran code, I met an error, which is in terms of hypre:
/ccs/home/phimar/opt/hypre//lib/libHYPRE.a(par_cr.o): In function `hypre_BoomerAMGCoarsenCR1':
par_cr.c:(.text+0x20e): undefined reference to `_simd_drand48_pd64x2'
/ccs/home/xialing/opt/hypre//lib/libHYPRE.a(par_cr.o): In function `cr':
par_cr.c:(.text+0xd4e): undefined reference to `_simd_drand48_pd64x2'
/usr/bin/ld: link errors found, deleting executable `/tmp/work/phimar/NGA_2way/bin/arts'
make[1]: *** [arts] Error 1
make[1]: Leaving directory `/autofs/na3_home1/phimar/NGA/src'
make: *** [default] Error 2
which seems to me that it has something to do with the compiler or the hypre src itself. So I tried to start from a clean version, unzip the hypre 2.6.0b zip file and then load the Intel compiler (with the newest version 13.1.3.192 on Titan). But I ended up with the same error.
Do offer your wisdom if this rings a bell. Really appreciate your help!
I am porting an application from Solaris to Linux
The object files which are linked do not have a main() defined. But compilation and linking is done properly in Solaris and executable is generated. In Linux I get this error
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
My problem is, I cannot include new .c/.o files since its a huge application and has been running for years. How can I get rid of this error?
Code extractes of makefile:
RPCAPPN = api
LINK = cc
$(RPCAPPN)_server: $(RPCAPIOBJ)
$(LINK) -g $(RPCAPIOBJ) -o $(RPCAPPN)_server $(IDALIBS) $(LIBS) $(ORALIBS) $(COMMONLIB) $(LIBAPI) $(CCLIB) $(THREADLIB) $(DBSERVERLIB) $(ENCLIB)
Try adding -nostartfiles to your linker options, i.e.
$(LINK) -nostartfiles -g ...
From the gcc documentation:
-nostartfiles
Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used.
This causes crt1.o not to be linked (it's normally linked by default) - normally only used when you implement your own _start code.
-shared link option must be used when you compile a .so
The issue for me was, I by mistake put int main() in a namespace. Make sure don't do that otherwise you will get this annoying link error.
Hope this helps anyone :)
I had similar result when trying to build a new test project with boost, and it turned out that I was missing one declaration :
#define BOOST_TEST_MODULE <yourtestName>
I had this same problem when creating my c project, and I forgot to save my main.c file, so there was no main function.
I had a similar result when compiling a Fortran program that had C++ components linked in. In my case, CMake failed to detect that Fortran should be used for the final linking. The messages returned by make then ended with
[100%] Linking CXX executable myprogram
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
make[3]: *** [myprogram] Error 1
make[2]: *** [CMakeFiles/myprogram.dir/all] Error 2
make[1]: *** [CMakeFiles/myprogram.dir/rule] Error 2
make: *** [myprogram] Error 2
The solution was to add
set_target_properties(myprogram PROPERTIES LINKER_LANGUAGE Fortran)
to the CMakeLists.txt, so that make prints out:
[100%] Linking Fortran executable myprogram
[100%] Built target myprogram
I had the same issue with a large CMake project, after I moved some functions from one code file to another. I deleted the build folder, recreated it and rebuilt. Then it worked.
Generally, with suddenly appearing linker errors, try completely deleting your build folder and rebuilding first. That can save you the headaches from trying to hunt down an error that actually simply shouldn't be there: There might be CMake cache variables floating around that have the wrong values, or something was renamed and not deleted, ...
I had the same issue as to OP but on on FreeBSD 13.1.
What solved the issue was simply adding:
int main()
{
}
Since the .cpp file was only an object file containing definitions and declarations using:
extern "C"
{
<all definitions and declarations code goes here>
}
Every time I tried compiling this, the compiler kept throwing the same error as to OP.
So all I did was add an empty main() function all the way at the bottom and code compiled with no errors.